Spider II and J11D networking

I’m trying to get the network running using a Spider II board and an J11D adapter.

When I start the program in the debugger, the DebugLED on the Board stays off and no output is printed in the debug output window.

Then I use the “Debug Pause” button and the debugger shows that the progam is at “new Thread(RunWebServer).Start();”. I didn’t set any breakpoint, so I’d expect that the program just startes and prints out everthing immediately.

Now I can use “Continue” to resume the application and I get all the output in the debug output window and the DebugLED is turned on and the other LEDs are blinking.

The other problem is that the IP address is always 0.0.0.0 and both LEDs on the J11D adapter stay on all the time.

Here is the program I use:

namespace HelloLED
{
    public partial class Program
    {
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            Mainboard.SetDebugLED(false);

            InitEthernet();

            Mainboard.SetDebugLED(true);

            GT.Timer timer = new GT.Timer(100); // Create a timer
            timer.Tick += timer_Tick; // Run the method timer_tick when the timer ticks
            timer.Start(); // Start the timer

            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");
        }
 
        bool state = false;
        void timer_Tick(GT.Timer timer)
        {
            state = !state; // Invert the state (to blink the LED)
            ledStrip.SetLed(1, state);
            ledStrip.SetLed(2, !state);
        }

        void InitEthernet()
        {
            ethernetJ11D.UseThisNetworkInterface();
            ethernetJ11D.UseDHCP();
            ethernetJ11D.NetworkUp += ethernetJ11D_NetworkUp;
            ethernetJ11D.NetworkDown += ethernetJ11D_NetworkDown;

            new Thread(RunWebServer).Start();
        }

        void ethernetJ11D_NetworkDown(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
        {
            Debug.Print("Network is down!");
        }

        void ethernetJ11D_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
        {
            Debug.Print("Network is up!");
            Debug.Print("My IP is: " + ethernetJ11D.NetworkSettings.IPAddress);
        }

        void RunWebServer()
        {
            // Wait for the network...
            while (ethernetJ11D.IsNetworkUp == false)
            {
                Debug.Print("Waiting...");
                Thread.Sleep(1000);
            }
        }
    }
}

Agreed, but this is just a test program to see how things are working. I used parts from different examples for this.

The two problems I have now are:

  1. The funny startup. I have to use Pause and Resume with the debugger to get any of the Debug.Print() messages.

  2. The IP Adress I get is 0.0.0.0 which isn’t what I’d expect.

Network Up isn’t the same as Address Changed :wink:

1 Like

The funny startup problem seems to be solved. I’m using a VMWare virtual maching on a Linux Host system. I have switched the USB type of the virtual maching to USB2 and now I get the debug output messages as expected.

I played around some more and wasn’t able to get any IP address using DHCP. Using a static IP address works fine. I can ping the spider and even get a response. :wink:

That is what wireshark is for. I found that the DHCP server is repsonding with a NAK to the request. Do you have any ideas why the router sinds a NAK to the request?

The spider II mac address is 00:21:03:80:5f:3e . It is the one printed on the label. I have set it using the FEZ tool and it shows up in the wireshark log.