Roving Networks WiFly RN-171-XV

Roving Networks (acquired by Microchip Technology) WiFly RN-171-XV is 802.11 b/g solution especially designed for customer who want to migrate their existing 802.15.4 architecture to a more standard TCP/IP based platform.

Hello World

Import programWebsocket_Wifly_HelloWorld

WebSocket Hello World using the wifly interface

Library

Import libraryWiflyInterface

mbed official WiflyInterface (interface for Roving Networks Wifly modules)

Pinout

Datasheet

http://ww1.microchip.com/downloads/en/DeviceDoc/rn-171-xv-ds-v1.04r.pdf

Notes

Connectivity

mbed pinRN-171-XV pin
GND10 - GND
VDD1 - VDD_3V3
p102 - TXD
p93 - RXD
p305 - RESET_N
p2915 - GPIO6/SEN7

Features

  • Direct internet connectivity provides internet access to every node
  • Point to point connectivity to every node without the need for custom profiles
  • Based on common 802.15.4 footprint
  • 3 Antenna options available - wire, reverse polarity SMA connector, and U.FL connector
  • Ultra low power: 4uA sleep mode, 38mA active
  • Onboard TCP/IP stack includes DHCP, UDP, DNS, ARP, ICMP, HTTP client, FTP client and TCP
  • Firmware configurable transmit power: 0dBm to 12dBm
  • Hardware interfaces: TTL UART
  • Host data rate up to 464Kbps over UART
  • Supports Adhoc and infrastructure networking
  • 8 general purpose digital I/O
  • 3 analog sensor inputs
  • Real-time clock for time-stamping, auto-sleep, and auto-wakeup modes
  • Accepts 3.3VDC regulated power supply
  • Configuration over UART or wireless interface (via Telnet) using simple ASCII commands
  • Over the air firmware upgrade (FTP)
  • Secure Wi-Fi authentication: WEP, WPA-TKIP , WPA2-AES

Warning

Device Won't connect to WiFi but you're sure the settings are correct

For me this fixed the problem being that I was 1000% certain that the ssid and phrase were correct and I always got:

<4.00> join
Auto-Assoc McGroves chan=0 mode=NONE FAILED

or

Auto-Assoc McGroves chan=1 mode=MIXED SCAN OK
<4.00> Joining McGroves now..
Disconn from McGroves,AUTH-ERR
AP mode as McGroves on chan 1
DCHP Server Init

From either of these states you can see the result from scan:

<4.00> scan
<4.00>
SCAN:Found 0
END:
scan
<4.00>
SCAN:Found 6
01,01,-85,04,3104,1c,00,c0:83:0a:41:99:e1,2WIRE819
02,01,-40,04,1104,1c,00,14:5b:d1:ec:6e:00,McGroves
03,02,-73,04,3104,28,c0,00:26:f2:fa:de:f5,JANOV2
04,06,-70,04,3104,28,40,28:c6:8e:16:89:b8,NETGEAR50
05,11,-84,04,1104,28,40,f8:7b:8c:0b:18:e9,JANOV
06,11,-82,04,1104,1c,40,58:6d:8f:6c:83:38,Gpatrick
END:

Try this:

Note

You will have to change the wifi pinnames to match the tx and rx pins as routed for your specific hardware. Also, make sure to update the mbed SDK library to ensure you have platform support.

Import programWifly_configure

Configure wifly module

  1. power cycle the device
  2. send $$$
  3. send factory RESET
  4. send scan (if your device isn't here or if all 000000's are returned, there's your problem)
    • if 0 networks are returned or all the info is 0's keep sending scan until you get multiple valid networks. Then send factory RESET
    • I think the critical step is that you get valid networks upon sending the first scan. Otherwise reset the device and start again
  5. send set wlan ssid network_name
  6. send set wlan phrase password (spaces don't seem to be supported - I didn't test this but read about other peoples problems while looking for a solution here)
  7. send join
  8. send ftp update
  9. send boot image _ _ (the number of file returned from ftp update)
  10. send factory R
  11. power cycle the board

Not sure if this problem is fixed with 4.0.0.1 or greater. Every device I had was 4.0.0 (problems) and once connected to a network I updated the firmware.

Firmware update

Microchip now has available firmware 4.7.5. With some initial testing, it seems to be better than the 4.0.0.

Test Program

The following test program, set up for the Application Board, boots the WiFly module, joins the network, disconnects, and repeats. If things go wrong - the WiFly module hangs, then the mbed Watchdog kicks in.

With firmware version 4.75, it has reasonably promising results.

Total Number of TestsSuccessful ConnectsSuccess (on retry)Hang - WatchDog ResetWhen
70216926 (98.7 % includes retry)78 (1.1%)17First day
3012330031 (99.6% includes retry)547 (1.8%)92Several days later

So, not 100%, but it was able to successfully recover. I had run a similar test with v4.0.0 and don't recall the results - other than substantially worse.

Repo's

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

/* wifly object where:
*     - p9 and p10 are for the serial communication
*     - p25 is for the reset pin
*     - p26 is for the connection status
*     - "mbed" is the ssid of the network
*     - "password" is the password
*     - WPA is the security
*/

#include "C12832.h"
C12832 disp(p5, p7, p6, p8, p11);
WiflyInterface wifly(p9, p10, p30, p29, "mbed", "password", WPA);

Watchdog wd;
extern "C" void mbed_reset();

int main() {
    uint16_t bootCount;
    uint16_t bootCheck;
    uint16_t wdCount;
    uint16_t retryCount;
    
    wd.Configure(60.0);                         // Set time limit for each test run
    bootCount =  (LPC_RTC->GPREG0 & 0xFFFF);    // Count boots here
    bootCheck =  (LPC_RTC->GPREG0 >> 16);       // copy of bootCount
    wdCount =    (LPC_RTC->GPREG1 >> 16);
    retryCount = (LPC_RTC->GPREG1 & 0xFFFF);

    if (bootCheck != bootCount) {
        bootCount = 1;
        wdCount = 0;
        retryCount = 0;
    } else {
        bootCount++;
    }
    bootCheck = bootCount;
    
    LPC_RTC->GPREG0 = ((uint32_t)bootCheck << 16) | bootCount;
    if (wd.WatchdogCausedReset()) {
        wdCount++;  // Count Watchdog events here
        LPC_RTC->GPREG1 = (wdCount << 16) | retryCount;
    }
    wait_ms(200);
    
    // Wifly: 12345 boots, 1234 WD
    // 1234 retries
    // IP: 192.168.1.165 Disc. OK.
    disp.locate(0,0);
    disp.printf("Wifly:%5d boots, %3d retry     %4d WD ", 
        bootCount, retryCount, wdCount);
    wifly.reset();
    wifly.init(); // use DHCP
    disp.printf("Con- ");
    while (0 != wifly.connect()) {
        retryCount++;
        LPC_RTC->GPREG1 = (wdCount << 16) | retryCount;
        disp.printf("retry- ");
        wait_ms(100);
    }
    disp.locate(0,20);
    disp.printf("IP: %s. ", wifly.getIPAddress());    
    disp.printf("Disc. ");
    wifly.disconnect();
    disp.printf("OK.");
    wait(5);
    mbed_reset();                           // reset here indicates successful communication
}