FEZ Spider & Ethernet J11D - NetworkUp never raise

I connected Ethernet J11D module to FEZ Spider, but event NetworkUp is never raised :frowning: I found some older discussions about this problem, but found no solution. I use .NET Micro Framework 4.2.

When I try code from Setting up Ethernet on the .NET Gadgeteer - Pete Brown's 10rem.net, i get this output:
Program Started
Network down.

When I change code to…

void SetupEthernet()
{
  //ethernet.UseDHCP();

  ethernet.UseStaticIP(
      "169.254.81.121",
      "255.255.0.0",
      "169.254.81.122");
}

… I get en exception:

Program Started
#### Exception System.NullReferenceException - CLR_E_NULL_REFERENCE (1) ####
#### Message:
#### Gadgeteer.Modules.Module+NetworkModule::UseStaticIP [IP: 000f] ####
#### Gadgeteer.Modules.Module+NetworkModule::UseStaticIP [IP: 0008] ####
#### Gadgeteer.Examples.Program::SetupEthernet [IP: 0011] ####
#### Gadgeteer.Examples.Program::ProgramStarted [IP: 000c] ####
A first chance exception of type ‘System.NullReferenceException’ occurred in Gadgeteer.dll
An unhandled exception of type ‘System.NullReferenceException’ occurred in Gadgeteer.dll

Is there a solution, I haven’t found? Or am I doing something wrong?

I forgot to mention, that I also have problem to add module in designer (see attached image). I resolved this by adding field manually into Program.generated.cs file as

public partial class Program : Gadgeteer.Program
    {
        // GTM.Module definitions
        ...
        Gadgeteer.Modules.GHIElectronics.Ethernet_J11D ethernet;

        ...

        private void InitializeModules()
        {   
            // Initialize GTM.Modules and event handlers here.		
            ...
            ethernet = new GTM.GHIElectronics.Ethernet_J11D(7);

        }

Maybe it is related to the problem, maybe not.

see this forum link the same thing.

the j11 module does not require adding to the project

http://www.tinyclr.com/forum/topic?id=8573&page=2

1 Like

Thans, Nubiarn! It seams working!

But now - is there a way to recognize, that ethernet cable has ben plugged in/out?

I found it :slight_smile:


      Microsoft.SPOT.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged += (s, e) =>
      {
        if (e.IsAvailable)
          Debug.Print("Network cable connected.");
        else
          Debug.Print("Network cable disconnected.");
      };