Hi,
After reading several problem topics about Wifi RS21 module and trying all solutions proposed on these topics, i cannot solve my problem for connecting Wifi RS21 module on my home network. I post here my code and exception errors raising when deploying on FEZSpider. Note that all releases for GHI SDK & Gadgeteer Core, etc… have been installed and updated. Pls help me ! and give me a solution, I’m really frustrating !!
EMX Version : 4.2.10.1
Using mainboard GHI Electronics FEZSpider version 1.0
RS9110 firmware version Number is 4.4.5
RS9110 driver version Number is 4.4.5
Error :
Exception System.Exception - 0x00000000 (1)
#### Message:
#### GHI.Premium.Net.RS9110Helper::Join [IP: 003b] ####
#### GHI.Premium.Net.WiFiRS9110::Join [IP: 008b] ####
#### Technosvalg.Program::WiFiRS21Connect [IP: 00d4] ####
#### Technosvalg.Program::ReadConfiguration [IP: 00d1] ####
#### Technosvalg.Program::ProgramStarted [IP: 000a] ####
#### Exception GHI.Premium.Net.NetworkInterfaceExtensionException - 0x00000000 (1) ####
#### Message:
#### GHI.Premium.Net.WiFiRS9110::Join [IP: 00e7] ####
#### Technosvalg.Program::WiFiRS21Connect [IP: 00d4] ####
#### Technosvalg.Program::ReadConfiguration [IP: 00d1] ####
#### Technosvalg.Program::ProgramStarted [IP: 000a] ####
A first chance exception of type ‘GHI.Premium.Net.NetworkInterfaceExtensionException’ occurred in GHI.Premium.Net.dll
Exception was thrown: GHI.Premium.Net.NetworkInterfaceExtensionException
private void WiFiRS21Connect()
{
if (!wifi_RS21.Interface.IsOpen)
wifi_RS21.Interface.Open();
if (!wifi_RS21.Interface.NetworkInterface.IsDhcpEnabled)
wifi_RS21.Interface.NetworkInterface.EnableDhcp();
else
wifi_RS21.Interface.NetworkInterface.RenewDhcpLease();
NetworkInterfaceExtension.AssignNetworkingStackTo(wifi_RS21.Interface);
wifi_RS21.NetworkUp += new GTM.Module.NetworkModule.NetworkEventHandler(wifi_NetworkUp);
wifi_RS21.NetworkDown += new GTM.Module.NetworkModule.NetworkEventHandler(wifi_NetworkDown);
wifi_RS21.Interface.NetworkAddressChanged +=
new NetworkInterfaceExtension.NetworkAddressChangedEventHandler(wifiRS21_NetworkAddressChanged);
wifi_RS21.Interface.WirelessConnectivityChanged +=
new WiFiRS9110.WirelessConnectivityChangedEventHandler(wifi_RS21_WirelessConnectivityChanged);
try
{
Debug.Print("Scan for wireless networks");
WiFiNetworkInfo[] scanResult = wifi_RS21.Interface.Scan(AppSettings.NetworkSSID);
if (scanResult != null && scanResult.Length > 0)
{
wifi_RS21.Interface.Join(scanResult[0], AppSettings.NetworkPassphrase);
Debug.Print("Connected");
}
else
{
Debug.Print(" Wireless network was not found : " + AppSettings.NetworkSSID);
}
Debug.Print("IP Address: " + wifi_RS21.Interface.NetworkInterface.IPAddress);
Debug.Print("Subnet Mask: " + wifi_RS21.Interface.NetworkInterface.SubnetMask);
Debug.Print("Default Getway: " + wifi_RS21.Interface.NetworkInterface.GatewayAddress);
for (int j = 0; j < wifi_RS21.Interface.NetworkInterface.DnsAddresses.Length; j++)
{
Debug.Print("DNS Server: " + wifi_RS21.Interface.NetworkInterface.DnsAddresses[j]);
}
}
catch (Exception e)
{
Debug.Print(e.Message);
}
}
void wifi_RS21_WirelessConnectivityChanged(object sender, WiFiRS9110.WirelessConnectivityEventArgs e)
{
if (wifi_RS21.Interface != null && !wifi_RS21.Interface.IsActivated
&& !wifi_RS21.Interface.IsOpen && !wifi_RS21.Interface.IsLinkConnected && !e.IsConnected)
{
Debug.Print("WiFi is Disconnected! -> event: Wirless Connectivity Changed.");
}
else
{
Debug.Print("Wireless Connectivity Changed event.");
WiFiNetworkInfo infoNetwork = e.NetworkInformation;
if (infoNetwork != null)
{
string str1 = WiFiNetworkInfoToString(infoNetwork);
Debug.Print(str1);
}
Debug.Print("Is DhCp enabled: " + wifi_RS21.Interface.NetworkInterface.IsDhcpEnabled);
Debug.Print("Is DynamicDnsEnabled enabled: " + wifi_RS21.Interface.NetworkInterface.IsDynamicDnsEnabled);
Debug.Print("NetworkInterfaceType " + wifi_RS21.Interface.NetworkInterface.NetworkInterfaceType);
Debug.Print("Network settings:");
Debug.Print("IP Address: " + wifi_RS21.Interface.NetworkInterface.IPAddress);
Debug.Print("Subnet Mask: " + wifi_RS21.Interface.NetworkInterface.SubnetMask);
Debug.Print("Default Getway: " + wifi_RS21.Interface.NetworkInterface.GatewayAddress);
Debug.Print("Number of DNS servers:" + wifi_RS21.Interface.NetworkInterface.DnsAddresses.Length);
for (int i = 0; i < wifi_RS21.Interface.NetworkInterface.DnsAddresses.Length; i++)
Debug.Print("DNS Server " + i.ToString() + ":" + wifi_RS21.Interface.NetworkInterface.DnsAddresses[i]);
Debug.Print("------------------------------------------------------");
}
}
void wifiRS21_NetworkAddressChanged(object sender, EventArgs e)
{
if (wifi_RS21.Interface != null && !wifi_RS21.Interface.IsLinkConnected)
{
Debug.Print("wifi.Interface is Disconnected! -> event: Network Address Changed.");
}
else
{
Debug.Print("Network Address Changed event.");
Debug.Print("Is DhCp enabled: " + wifi_RS21.Interface.NetworkInterface.IsDhcpEnabled);
Debug.Print("Is DynamicDnsEnabled enabled: " + wifi_RS21.Interface.NetworkInterface.IsDynamicDnsEnabled);
Debug.Print("NetworkInterfaceType " + wifi_RS21.Interface.NetworkInterface.NetworkInterfaceType);
Debug.Print("Network settings:");
Debug.Print("IP Address: " + wifi_RS21.Interface.NetworkInterface.IPAddress);
Debug.Print("Subnet Mask: " + wifi_RS21.Interface.NetworkInterface.SubnetMask);
Debug.Print("Default Getway: " + wifi_RS21.Interface.NetworkInterface.GatewayAddress);
Debug.Print("Number of DNS servers:" + wifi_RS21.Interface.NetworkInterface.DnsAddresses.Length);
for (int i = 0; i < wifi_RS21.Interface.NetworkInterface.DnsAddresses.Length; i++)
Debug.Print("DNS Server " + i.ToString() + ":" + wifi_RS21.Interface.NetworkInterface.DnsAddresses[i]);
Debug.Print("------------------------------------------------------");
}
}
void wifi_NetworkDown(GT.Modules.Module.NetworkModule sender, GT.Modules.Module.NetworkModule.NetworkState state)
{
if (state == GT.Modules.Module.NetworkModule.NetworkState.Down)
Debug.Print("Network Up event; state = Down");
else
Debug.Print("Network Up event; state = Up");
}
private void wifi_NetworkUp(GTM.Module.NetworkModule sender, GTM.Module.NetworkModule.NetworkState state)
{
// Network is available.
AppSettings.IPAddress = wifi_RS21.NetworkSettings.IPAddress;
// Synchronize the Clock with a Reference Server on the Internet.
WindowsManager.StartupScreen.SetStatusMessage("Synchronizing time...");
TimeManager timeManager = TimeManager.Instance;
timeManager.TimeSynchronized += new EventHandler(timeManager_TimeSynchronized);
timeManager.Synchronize(AppSettings.TimeZoneOffset);
}