Problem with HD44780 driver code

I’m probably doing something quite dumb, but I’ve been away from my Cerberus board for a long while and just getting back into it now.

First, I’ve taken the code posted here at

and gotten it to work quite nicely. Next, I thought I’d throw the HD44780 based LCD module on, and I copied the driver provided by GHI into its own .cs file and included in the project.

For some reason, the first line in the constructor:

        Socket socket = Socket.GetSocket(socketNumber, true, null , null);

throws an invalid socket exception, no matter what socket I try to use!
My project’s properties have the target hardwaare set to Cerb-family_gadgeteer, and it builds and runs fine as a web server. Just adding this little extra code to support the display ain’t cutting it.

Is there anything obvious I am missing here? It’s been quite frustrating, any help would be greatly appreciated!

Thanks in advance :slight_smile:

Check Gadgeteer source code on codeplex. It might shed some light why you are getting that exception.

I looked at lots of the Gadgeteer source code. All I can come up with is that maybe something in a layer underneath my app code isn’t getting called, so the board sockets are never initialized. But as I mentioned, this project works fine with the ENJ28 ethernet which is a SPI interface but his code doesn’t use the GHI Socket class at all.

I’ve used that GetSocket() function in my own projects before no problem, and here I’ve tried every permutation I could think of but still no dice, for any socket number or even giving a module instead of null.

And this HD44780 driver came from the GHI codeplex too.

Are you using Gadgeteer projet or pure .NET MF?

It looks like the project I am working with was originally a .net mf project, to which I attempted to include the Gadgeteer assemblies. I thought I was successful as everything compiles and runs fine with the exception of this Socket.GetSocket() always failing.