Trouble with Wifi RS21 and .NET Micro Framework 4.2

Hi all!

I have installed the October 24th release of .NET Gadgeteer package. I have successfully updated the firmware of my FEZ Spider to version 4.2.5.0. However, if I try the following code to connect to Wi-Fi network:

void ProgramStarted()
{
	if (!wifi_RS21.Interface.IsOpen)
		wifi_RS21.Interface.Open();

	if (!wifi_RS21.Interface.NetworkInterface.IsDhcpEnabled)
		wifi_RS21.Interface.NetworkInterface.EnableDhcp();

	NetworkInterfaceExtension.AssignNetworkingStackTo(wifi_RS21.Interface);            

	wifi_RS21.Interface.WirelessConnectivityChanged += new WiFiRS9110.WirelessConnectivityChangedEventHandler(Interface_WirelessConnectivityChanged);
	wifi_RS21.Interface.NetworkAddressChanged += new NetworkInterfaceExtension.NetworkAddressChangedEventHandler(Interface_NetworkAddressChanged);
	wifi_RS21.NetworkDown += new GTM.Module.NetworkModule.NetworkEventHandler(wifi_RS21_NetworkDown);
	wifi_RS21.NetworkUp += new GTM.Module.NetworkModule.NetworkEventHandler(wifi_RS21_NetworkUp);

	WiFiNetworkInfo[] ScanResp = wifi_RS21.Interface.Scan("myAP");
	if (ScanResp != null && ScanResp.Length > 0)
		wifi_RS21.Interface.Join(ScanResp[0], "myPWD");

	// Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
	Debug.Print("Program Started");
}

void wifi_RS21_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
{
	Debug.Print("NetworkUp event!");
}

void wifi_RS21_NetworkDown(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
{
	Debug.Print("NetworkDown event!");
}

void Interface_WirelessConnectivityChanged(object sender, WiFiRS9110.WirelessConnectivityEventArgs e)
{
	Debug.Print("WirelessConnectivityChanged event!");
	Debug.Print("Connected: " + e.IsConnected);
	Debug.Print("IP Address : " + wifi_RS21.Interface.NetworkInterface.IPAddress);
}

void Interface_NetworkAddressChanged(object sender, EventArgs e)
{
	Debug.Print("NetworkAddressChanged event!");
	Debug.Print("IP Address : " + wifi_RS21.Interface.NetworkInterface.IPAddress);
}

I always obtain the following result:

Using mainboard GHI Electronics FEZSpider version 1.0
RS9110 firmware version Number is 4.4.5
RS9110 driver version Number is 4.4.5
Program Started
NetworkDown event!
WirelessConnectivityChanged event!
Connected: True
IP Address : 0.0.0.0

And nothing else.

In particular, the application tells me that network is connected, but IP Address is always 0.0.0.0.

Instead, if I use a FEZ Spider with .NET Micro Framework 4.1 and the April .NET Gadgeteer Package, I manage to correctly connect to Wi-Fi and to obtain a valid IP address, so the problem isn’t related to the network.

What am I doing wrong?

Thanks in advance for the attention.

I wonder if you need to call

NetworkInterfaceExtension.AssignNetworkingStackTo(wifi_RS21.Interface); 

before enabling the DHCP not after.

I think this is an open issue. I have seen similar posting about the 0.0.0.0 address.

I tried the code copied ‘as is’ from the sample provided.

I receive the following Print.Debug() messages

Using mainboard GHI Electronics FEZSpider version 1.0
RS9110 firmware version Number is 4.4.5
RS9110 driver version Number is 4.4.5
Program Started
NetworkDown event!
The thread ‘’ (0x3) has exited with code 0 (0x0).
NetworkAddressChanged event!
IP Address : 192.168.2.8
WirelessConnectivityChanged event!
Connected: True
IP Address : 192.168.2.8
NetworkAddressChanged event! I always seem to receive two NetworkAddressChanged event!
IP Address : 0.0.0.0
NetworkAddressChanged event! <---------------------------
IP Address : 192.168.2.8

Not sure why but I thought I would post my results

Using a Spider with 4.2

I had a similar problem: http://www.tinyclr.com/forum/topic?id=9411