WiFi RS21 always throws authentication failed

I recently purchased a FEZ Spider and a WiFi RS21 Module
. When I look at the documentation at https://www.ghielectronics.com/docs/105/wifi-rs21-module it states that this is obsolete and now I need to use https://www.ghielectronics.com/docs/30/networking

The new documentation uses a class called WiFiRS9110.
Looking at the source code, it seems that Gadgeteer.Modules.GHIElectronics.WiFiRS21 class internally uses the WiFiRS9110 and exposes that class via the property “NetworkInterface”.
So I followed the example at https://www.ghielectronics.com/docs/30/networking and created the code as shown below:

wifiRS21.NetworkDown += new GTM.Module.NetworkModule.NetworkEventHandler(wifiRS21_NetworkDown);
wifiRS21.NetworkUp += new GTM.Module.NetworkModule.NetworkEventHandler(wifiRS21_NetworkUp);

        wifiRS21.NetworkInterface.Join("MySSID", "1234ABCD" /*hex code of passphrase*/);

        while (wifiRS21.NetworkInterface.IPAddress == "")

This code is consistently throwing the error given below (at the Join call):
An unhandled exception of type ‘GHI.Networking.WiFiRS9110.JoinException’ occurred in GHI.Networking.dll

Additional information: Authentication failed.

I could find a related post https://www.ghielectronics.com/community/forum/topic?id=9995 but it was of no help.

Looking for any suggestion to resolve this.

I’m using .NET Micro Framework V4.3 SDK-R2-Beta and the latest GHI package (2014, R5)

Thanks andre.m
As stated in my post, I have already looked at the URL you provided.
In my case, here are the results with various settings:

Open = Works
WEP (64 bit) = Works
WPA , Cipher Type [AUTO(TKIP/AES)], PSK = Authentication Failed
WPA , Cipher Type [TKIP], PSK = Authentication Failed
WPA , Cipher Type [AES], PSK = Authentication Failed
WPA2, Cipher Type [AUTO(TKIP/AES)], PSK = Authentication Failed
WPA2, Cipher Type [TKIP], PSK = Authentication Failed
WPA2, Cipher Type [AES], PSK = Authentication Failed
WPA/WPA2, Cipher Type [AUTO(TKIP/AES)], PSK = Authentication Failed
WPA/WPA2, Cipher Type [TKIP], PSK = Authentication Failed
WPA/WPA2, Cipher Type [AES], PSK = Authentication Failed

and the last post in that thread didn’t help ? It states there that the ASCII versus hex key was a difference. Maybe test with a very clear passphrase that does not use 0-9 and A-F so you know it’s ASCII.

Is it possible you might have some other protection set up as well? MAC address filtering ?

@ vishnusharma -
Hi, I think you missed the scan:

void ProgramStarted()
            wifiRS21.NetworkUp += wifiRS21_NetworkUp;
            wifiRS21.NetworkDown += wifiRS21_NetworkDown;


            WiFiRS9110.NetworkParameters[] scanResult = wifiRS21.NetworkInterface.Scan();

            for (int i = 0; i < scanResult.Length; i++)
                if (scanResult[i].Ssid == "mySSID")
                        wifiRS21.NetworkInterface.Join(scanResult[i].Ssid, "mySecret");
                    catch (WiFiRS9110.JoinException e)
                        Debug.Print("Error Message: " + e.Message);
                        throw new NotImplementedException();

            while (wifiRS21.NetworkInterface.IPAddress == "")
            Debug.Print("Ip-Address = " + wifiRS21.NetworkInterface.IPAddress);

A big thanks to all for showing me direction. Here is what I found and made it working…

  1. If the security type is WEP, then in the passphrase, you pass the hex code. So if passphrase is 12345, you pass 3132333435
  2. If the security type is WPA/WPA2, then in the passphrase put the actual value and not the hex values. SO if passphrase is ABCD@ 1234, then you pass ABCD@ 1234

Thanks Brett for making me review my understanding.

To make this decision, it always makes sense to do a scan first. In the returned NetworkParameters array, the object contains what security type is configured (thanks Ro Schmi)

If above scheme is followed, then it connects. I’m not sure why this difference but it works.

Another thing to keep in mind is that once in a while, even when all parameters are correct, you might either get a JoinException or additionally an Authentication Denied exception. You should ideally try about 3 times before giving up. In my case, the code could always connect in about 3 attempts (if all parameters are correct).

Thanks a ton forum guys !

1 Like

@ vishnusharma - You should be able to find that information on the NetworkParameters.Key property. I will add it to the documentation and the Join method so it is more clear.