Visual Studio - J11D module - Designer error

I’ve just taken delivery of my first Gadgeteer kit using a Spider, Music module, and a J11D Ethernet. Rightly or wrongly, I’ve downloaded all of the RC2 for NETMF 4.2 QFE2 s/w and everything installed ok. I then started a new project and dragged the Spider into the designer, the music module and J11D. However, the J11D wont drag, reporting “Module not found”. Being a complete novice with netmf, how to get the J11D into the designer? Something I’ve forgotten to do ?

Thank in advance

I was able to recreate this problem.

It only occurs with a 4.2 project. A 4.1 project works fine.

That module driver is looking for the assembly GHI.Premium.Net, which does not exist at this time. However, the good news is that you do not have to use that assembly or have the module in the designer to use networking in 4.2.

@ Steven;
So, I skipped the designer and added a reference to GTM.GHIElectronics.Ethernet_J11D
However, it will crash, see code snippet;

Gadgeteer.Modules.GHIElectronics.Ethernet_J11D ethernet;
ethernet = new GTM.GHIElectronics.Ethernet_J11D(7);

// The following statement will crash; “An unhandled exception of type ‘System.NullReferenceException’ occurred in Gadgeteer.dll”
// #### Message:
// #### Gadgeteer.Modules.Module+NetworkModule::UseStaticIP [IP: 000f] ####
ethernet.UseStaticIP(“”, “”, “”);

// However, the following works;
// Retrieve the network interface
Microsoft.SPOT.Net.NetworkInformation.NetworkInterface NI = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0];
// After this statement I can ping the Spider from my computer; ping
NI.EnableStaticIP(“”, “”, “”);

Any idea why the gadgeteer code does not work?

Do not add it, not even in code and all will work just fine.

Sorry Gus,

What do you mean "Do not add it, not even in code and all will work just fine."
How do I tell the spider which ip, subnet and gateway to use for example?


You do not need to any of the initialization that was done with a Gadgeteer module.
Just start coding the normal networking stuff, like setting the ip address etc.

Many thanks for the prompt responses. Will digest and attempt some coding and not worry about the designer.

I just can’t get my J11D to go at all. I’ve stumbled on the same thing as Lambertus. Because the designer didnt add in the J11D, I added the following line in Program.generated.cs:

            ethernet = new GTM.GHIElectronics.Ethernet_J11D (7);

then, in Program.cs, I’ve put a single line:

           ethernet.UseStaticIP ("", "", "");

and it throws a Null Reference exception. This feels like the right way to be doing things. The workaround of:

Microsoft.SPOT.Net.NetworkInformation.NetworkInterface NI = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0];
 NI.EnableStaticIP("", "", "");

also throws a null reference exception. I feel there is something fundamentally wrong with talking to any module (my Music, RS21)…

If you think there’s something fundamentally wrong with talking to modules, then are you sure you have the firmware matching the SDK version you have installed? Please go to MFDeploy and confirm what DeviceCapabilities reports, and then confirm what SDK version you have installed and what the firmware version that is. If those two things do not match, exactly, then you’ll have weird stuff going on.

Please see my last reply :slight_smile: you do not need to use the driver at all.

all you need to do is,

create a socket, next create a local endpoint and then bind the endpoint to the newly created socket. that is all that is needed to configure the j11d in 4.2

So, just to be clear, in order for me to set the J11D in “Static IP” address mode and assign it a static IP, I have to create a socket ? Is it that the UseStaticIP () call is not the preferred approach in 4.2?

Thanks again… starting to burn the midnight oil now…

something like this is all you need, although note the while true statement isnt exactly the best way to do this, in the program started section, but it should be enough to get you going. the text to replace can be exchnged for html code to serve a web page for example.

 void ProgramStarted()
            // Create a socket, bind it to the server's port, and listen for client connections.
            Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, 80);

            while (true)
                // Wait for a client to connect.
                Socket clientSocket = server.Accept();
                byte[] messageBytes = Encoding.UTF8.GetBytes("some reply here replace me with stuff to send");

@ Brett, everything checked out as 4.2, thanks for indicating how to do that.
@ Nubiarn, thanks for your suggested lines of code. It produced an exception at Listen(), so I prefixed it with the :

NetworkInterface networkInterface = NetworkInterface.GetAllNetworkInterfaces()[0];
networkInterface.EnableStaticIP("", "", "");

to set my static IP address, and then your code sprang into life. Strangely, I removed the above two lines on second and subsequent runs, and it still remembers the static IP address (even through power downs). Thank you for your patience.

Sorry for delayed join.
Meantime the assemblie become available :slight_smile: … you always can set network interface using “mfDeploy” and in theory “I think” the settings remains in flash until you decide make another change.

Hope this helps

        NetworkInterface networkInterface = NetworkInterface.GetAllNetworkInterfaces()[0];
        WebEvent myweb;
        void ProgramStarted()
            Debug.Print("Program Started");
            Debug.Print("IP Address: "  + networkInterface.IPAddress.ToString());
            Debug.Print("Subnet Mask: " + networkInterface.SubnetMask.ToString());
            Debug.Print("Gateway: "     + networkInterface.GatewayAddress.ToString());
            Debug.Print("DNS Server: "  + networkInterface.DnsAddresses[0].ToString());
            WebServer.StartLocalServer(networkInterface.IPAddress.ToString(), 80);
            myweb = WebServer.SetupWebEvent("Hello");
            myweb.WebEventReceived +=new WebEvent.ReceivedWebEventHandler(myweb_WebEventReceived);

        void myweb_WebEventReceived(string path, WebServer.HttpMethod method, Responder responder)
            byte[] bte = new System.Text.UTF8Encoding().GetBytes("Hello from " + networkInterface.IPAddress.ToString());
            responder.Respond(bte, "text/html");


@ mfDevices: Very helpful. I’ve just read up some more on mfDeploy so understand a bit more about its capabilities, including the network configuration. Thanks. Appreciate the code fragment.

@ Davestone,

I forget mention that is possible set IP programatically with this expresion :

Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].EnableStaticIP("192.168.x.x", "", "192.168.x.x");

I’m thinking in change my name by “Delayed Response” LoL!

@ mfDevices - Think I’ve caught the delayed response bug as well! I like the line of code… could it get any longer ? :wink:

@ davestone,

Yes of course. But can you redefine exactly what function are trying to test?.