Unable to get wifi to work on CobraIII / G120

Hello, I am trying to get networking to work on a Cobra III. I am following the example on the support site to no avail. I also tried the setup in a recent post using ports/pins as below. What am I missing? Are there certain pins/spi ports that need to be used?

‘Microsoft.SPOT.Debugger.CorDebug.14.dll’ (Managed): Loaded 'C:\Program Files (x86)\GHI Electronics\NETMF v4.3 SDK\Libraries\le\GHI.Pins.dll’
The thread ‘’ (0x2) has exited with code 0 (0x0).
#### Exception System.ArgumentException - 0xfd000000 (1) ####
#### Message:
#### Microsoft.SPOT.Hardware.Port::.ctor [IP: 0000] ####
#### Microsoft.SPOT.Hardware.OutputPort::.ctor [IP: 0006] ####
#### GHI.Networking.WiFiRS9110::.ctor [IP: 00c0] ####
#### GHI.Networking.WiFiRS9110::.ctor [IP: 000e] ####
#### FEZWirelessTesting.Program::Main [IP: 0026] ####
Exception thrown: ‘System.ArgumentException’ in Microsoft.SPOT.Hardware.dll
SRCSRV: The module ‘C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.3\Assemblies\le\Microsoft.SPOT.Hardware.dll’ does not contain source server information.
An unhandled exception of type ‘System.ArgumentException’ occurred in Microsoft.SPOT.Hardware.dll

The program ‘[3] Micro Framework application: Managed’ has exited with code 0 (0x0).

 private static WiFiRS9110 netif;

        public static void Main()
        {
            NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged;
            NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged;
            
            //error on the next line
            netif = new WiFiRS9110(G120E.SpiBus.Spi2, G120E.Gpio.P3_30, G120E.Gpio.P2_30, G120E.Gpio.P4_31);
            netif.Open();
            netif.EnableDhcp();
            netif.EnableDynamicDns();
            netif.Join("SSID", "Password");

            while (netif.IPAddress == "0.0.0.0")
            {
                Debug.Print("Waiting for DHCP");
                Thread.Sleep(250);
            }

            //The network is now ready to use.
        }

tried different pins and get an UpdateFirmware exception now:

Exception thrown: ‘GHI.Networking.WiFiRS9110.HardwareFailureException’ in GHI.Networking.dll
#### Exception GHI.Networking.WiFiRS9110+HardwareFailureException - 0x00000000 (1) ####
#### Message:
#### GHI.Networking.WiFiRS9110::ThrowFailure [IP: 0007] ####
#### GHI.Networking.WiFiRS9110::UpdateFirmware [IP: 0031] ####
#### GHI.Networking.WiFiRS9110::.ctor [IP: 000e] ####
#### FEZWirelessTesting.Program::Main [IP: 00c0] ####
Exception thrown: ‘GHI.Networking.WiFiRS9110.HardwareFailureException’ in GHI.Networking.dll
Exception thrown: ‘GHI.Networking.WiFiRS9110.HardwareFailureException’ in FEZWirelessTesting.exe

@ jrowe88 -
Far from an expert on the subject but I am using a WiFiRS9110 on a G120E (Dev Board)

It uses the pins that you first stated:
wifi = new WiFiRS9110(G120E.SpiBus.Spi2, G120E.Gpio.P3_30, G120E.Gpio.P2_30, G120E.Gpio.P4_31)

I remember I had some funny things happening at first and I used the FEZ Config Network Configuration.
RS910 WiFi tab:

  1. Button Load RS910 WiFi Config
    then
  2. Button Apply RS910 WiFi Config

And things settled down…

Worth a try?

I do not have a Cobra III so I cannot comment on what header pins to use.

@ jrowe88 - The Cobra III is based on the G120 while the example code you posted uses the G120E pin definitions. Which will throw the exception you see.

@ John - Thanks; what pins are allowable for the G120?

@ jrowe88 - you can find them in the G120 datasheet in the catalog entry and the GHI.Pins.G120 class.

@ John - Ok; changed the pins and still no dice… different error now. Any suggestions?

//neither of these worked
netif = new WiFiRS9110(GHI.Pins.G120.SpiBus.Spi2, GHI.Pins.G120.P0_10, GHI.Pins.G120.P0_11, GHI.Pins.G120.P0_12);
netif = new WiFiRS9110(FEZCobraIII.SpiBus.Spi2, FEZCobraIII.Gpio.D10, FEZCobraIII.Gpio.D11, FEZCobraIII.Gpio.D12);

Error:
#### Exception GHI.Networking.WiFiRS9110+HardwareFailureException - 0x00000000 (1) ####
#### Message:
#### GHI.Networking.WiFiRS9110::UpdateInternalMacAddress [IP: 001c] ####
#### GHI.Networking.WiFiRS9110::.ctor [IP: 000e] ####
#### FEZWirelessTesting.Program::Main [IP: 00bd] ####
Exception thrown: ‘GHI.Networking.WiFiRS9110.HardwareFailureException’ in GHI.Networking.dll
#### Exception GHI.Networking.WiFiRS9110+HardwareFailureException - 0x00000000 (1) ####
#### Message:
#### GHI.Networking.WiFiRS9110::ThrowFailure [IP: 0007] ####
#### GHI.Networking.WiFiRS9110::UpdateFirmware [IP: 0031] ####
#### GHI.Networking.WiFiRS9110::.ctor [IP: 000e] ####
#### FEZWirelessTesting.Program::Main [IP: 00bd] ####
Exception thrown: ‘GHI.Networking.WiFiRS9110.HardwareFailureException’ in GHI.Networking.dll
The program ‘[12] Micro Framework application: Managed’ has exited with code 0 (0x0).

@ jrowe88 - Have you verified the connections to the module? Do you have another product you can try it with? Do you see any green lights illuminate on the board?

Which SDK are you using?

@ John - here’s the setup:

  • empty FEZCobra III - nothing plugged in except the micro USB
  • Tiny Booter: 4.3.7.7
  • Tiny CLR: 4.3.7.10

I don’t know if this helps or not, but using the “FEZ Config” app, I am able to Load and Apply WiFi config on the “Network Configuration” tab (Mac is disabled and shows 0-21-3-0-0-3).

I only have a Panda, but that doesn’t have wifi if I recall correctly.

Thanks.

@ jrowe88 - The FEZ Cobra III does not have a WiFi module onboard. You need to connect a WiFi RS21 to it for the class you are using to function.

I’m having this same error on a G120TH with RS21 Module

#### Exception GHI.Networking.WiFiRS9110+HardwareFailureException - 0x00000000 (1) ####
#### Message: 
#### GHI.Networking.WiFiRS9110::UpdateInternalMacAddress [IP: 001c] ####
#### GHI.Networking.BaseInterface::Open [IP: 002a] ####
#### IG.Program::InitNetwork [IP: 0050] ####
#### IG.Program::Main [IP: 003a] ####

Any help on this?

Thanks,

@ mmonteagudo - I’d start with double checking all of the connections. If they’re good, the firmware can sometimes get corrupt on the Wi-Fi module. Using the latest SDK, call UpdateFirmware immediately after the constructor and before you call Open and then try again.

This works for me on Cobra III


WiFiRS9110 netif = new WiFiRS9110(GHI.Pins.FEZCobraIII.SpiBus.Spi2, GHI.Pins.FEZCobraIII.Gpio.D51, GHI.Pins.FEZCobraIII.Gpio.D50, GHI.Pins.FEZCobraIII.Gpio.D59);
// netif = new WiFiRS9110(G120E.SpiBus.Spi2, G120E.Gpio.P3_30, G120E.Gpio.P2_30, G120E.Gpio.P4_31);
netif.Open();
netif.EnableDhcp();
netif.EnableDynamicDns();
netif.Join("SSID", "Password");

while (netif.IPAddress == "0.0.0.0")
{
        Debug.Print("Waiting for DHCP");
        Thread.Sleep(250);
}

For me the code below runs fine (I have a G120TH btw.). I chose those pins, because the are all next to each other on the TH-board ;). Have you tried another SPI-port, because SPI2 is “not recommended”. How is your hardware-setup? With Gadgeteer-modules or something on a breadboard or something? My experience so far showed me, that the module requires a very stable power source and short wires (on breadboards it also doesn’t run fine) in order to run reliable.

            netif = new WiFiRS9110(G120.SpiBus.Spi3, G120.Gpio.P0_2, G120.Gpio.P0_3, G120.Gpio.P0_25);

            netif.Open();
            netif.EnableDhcp();
            netif.EnableDynamicDns();
            netif.Join("AP_02", "WiFiPassword");

            while (netif.IPAddress == "0.0.0.0")
            {
                //Debug.Print("Waiting for DHCP");
                Thread.Sleep(500);
            }