10 years, 6 months ago.

WPA security not working with Wifly module

I have two Roving Networks Wifly modules, RN-171. Neither of them will work with a security level other than "NONE", WEP_64 and WEP_128. They fail with 'Disconn "from" MY_SSID, AUTH- ERR'. I have a hardware analyzer attached to the RX and TX pins of the Wifly module and can see the commands and responses going back and forth. Does anyone know if this module supports WPA security? I've tried WPA, WPA1, WPA2_PSK. They all get the same error. Also, the program hangs after line 33 is executed. My program is as follows:

#include "mbed.h"
#include "WiflyInterface.h"

 Serial pc(USBTX, USBRX);
 WiflyInterface *wifi = new WiflyInterface(p9, p10, p20, p26, "Testing", "4053588641", WPA1);
 
 int main()
 {
   pc.printf("Trying to init...\r\n");
   
   if(wifi->init() != 0)
   {
     pc.printf("Unable to init.\r\n");
     exit(0);
   }
   else
   {
    pc.printf("Init worked.\r\n");      
   }
   
   pc.printf("Trying to connect...\r\n");
   
  if(wifi->connect() != true)
  {
    pc.printf("Unable to connect.\r\n");
    exit(0);
  }
  else
  {
    pc.printf("Connect worked.\r\n");    
  }
        
  pc.printf("Getting the IP address.\r\n");   
  
  if(wifi->getIPAddress() == NULL)
    pc.printf("NULL for IP address\r\n");
  else
    pc.printf("IP address = %s\r\n", wifi->getIPAddress());   
   
  wifi->disconnect(); 
  pc.printf("DONE\r\n");
} _

Question relating to:

3 Answers

10 years, 5 months ago.

Hi, Terry the module works indeed with WPA but some libraries dont have the code for WPA try the David Smart library available here:

http://mbed.org/users/WiredHome/code/WiflyInterface/

this library works with WPA security

if you check the page 24 of the rn-171 user manual you will see the command that set the authentication mode

http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Wireless/WiFi/WiFly-RN-UM.pdf

The command for WPA is set wlan auth 4

So yes again, the WPA security is available in this module

Greetings

10 years, 5 months ago.

Thanks, I loaded the library from David Smart as you suggested which was modified Oct 12, 2013 but it too failed. I used WPA2_PSK, which is in the Wifly.cpp file. As you can see in the next section, it fails with Can't find [DHCP=ON] from [join . Any suggestions?

Trying to connect...
[INF Wifly 90] join
[INF Wifly368] sendCommand set w j 0
[DBG Wifly565]  found CMD.
[DBG Wifly565]  found AOK.
[INF Wifly368] sendCommand set u m 1
[DBG Wifly565]  found >.
[DBG Wifly565]  found AOK.
[INF Wifly368] sendCommand set c t 30
[DBG Wifly565]  found >.
[DBG Wifly565]  found AOK.
[INF Wifly368] sendCommand set c s 1420
[DBG Wifly565]  found >.
[DBG Wifly565]  found AOK.
[INF Wifly368] sendCommand set s i 0x40
[DBG Wifly565]  found >.
[DBG Wifly565]  found AOK.
[INF Wifly368] sendCommand set c r 0
[DBG Wifly565]  found >.
[DBG Wifly565]  found AOK.
[INF Wifly368] sendCommand set i p 2
[DBG Wifly565]  found >.
[DBG Wifly565]  found AOK.
[INF Wifly368] sendCommand set i f 0x7
[DBG Wifly565]  found >.
[DBG Wifly565]  found AOK.
[INF Wifly368] sendCommand set d n rn.microchip.com
[DBG Wifly565]  found >.
[DBG Wifly565]  found AOK.
[INF Wifly368] sendCommand set i d 1
[DBG Wifly565]  found >.
[DBG Wifly565]  found AOK.
[INF Wifly368] sendCommand set w s Testing
[DBG Wifly565]  found >.
[DBG Wifly565]  found AOK.
[INF Wifly368] sendCommand set w a 4
[DBG Wifly565]  found >.
[DBG Wifly565]  found AOK.
[INF Wifly368] sendCommand set w p 6023588641
[DBG Wifly565]  found >.
[DBG Wifly565]  found AOK.
[INF Wifly368] sendCommand join
[DBG Wifly565]  found >.
]WRN Wifly551] Can't find [DHCP=ON] from [join
[ERR Wifly375] sendCommand: failure 1 when sending: join
[WRN Wifly551] Can't find [CMD] from [$$$]
[ERR Wifly396] cannot enter in cmd mode
]WRN Wifly551] Can't find [DHCP=ON] from [join
[ERR Wifly375] sendCommand: failure 2 when sending: join
[INF Wifly368] sendCommand set w j 0
[WRN Wifly551] Can't find [CMD] from [$$$]
[ERR Wifly396] cannot enter in cmd mode
]WRN Wifly551] Can't find [AOK] from [set w j 0
[ERR Wifly375] sendCommand: failure 1 when sending: set w j 0
[WRN Wifly551] Can't find [CMD] from [$$$]
[ERR Wifly396] cannot enter in cmd mode
]WRN Wifly551] Can't find [AOK] from [set w j 0
[ERR Wifly375] sendCommand: failure 2 when sending: set w j 0
[INF Wifly368] sendCommand set w j 0
[WRN Wifly551] Can't find [CMD] from [$$$]
[ERR Wifly396] cannot enter in cmd mode
]WRN Wifly551] Can't find [AOK] from [set w j 0
[ERR Wifly375] sendCommand: failure 1 when sending: set w j 0
[WRN Wifly551] Can't find [CMD] from [$$$]
[ERR Wifly396] cannot enter in cmd mode
]WRN Wifly551] Can't find [AOK] from [set w j 0
[ERR Wifly375] sendCommand: failure 2 when sending: set w j 0
Unable to connect. 

Hi, try the wifly configure program available here:

https://mbed.org/cookbook/WiflyInterface

And see if you can connect to your network via commands shown in the user manual that i provided to you

Greetings

posted by Ney Palma 29 Oct 2013

I imported the library and program. When I compile I get an error that it can't find rawserial.h.

Terry

posted by Terry Neckar 29 Oct 2013
9 years, 8 months ago.

Hi, try the latest firmware Version 4.41. After the Firmware update WPA-PSK worked