Wednesday, 20 August 2014

Upgrading the RN171 WiFi chip to v4.41 and enabling the access point

Finally, I came across a good reason to enable the access point on the RN171 chip, so I did just that by upgrading it from the stock firmware - v2.38.3 - to v4.41. Setting it up the first time took me an hour or so, mostly looking around for which version of software I should upgrade to, etc. So hopefully, this guide will provide you with enough information to quickly and easily upgrade your own RN171.

First of all, the specific chip I was upgrading was the Wifi Bee v2.0 (pictured below, in a Bee Socket v0.9b. These sockets aren't sold anymore, and have been replaced by the Grove), but this guide should apply to any of the many XBee RN171 variants out there.


The thing that took me the most time was finding the latest firmware version and the manual for that version. Really and truly, this should have been quick, but I derped out and forgot to look in the most obvious place. The manufacturer's website. So, here you will find Microchip's own page of info about the RN171, which contains both the latest firmware version and the manual for v4.41. As of the time of me posting this, v4.41 is the latest stable version, so of course, that's what version I'll talk about upgrading to.

To talk to the chip, you'll need an FTDI chip (like this one) and a serial application (like PuTTY), or some similar setup you've already got going. I'm not going to go into detail about this, as there are plenty of posts out there that will give you a full tutorial on how to speak to USART devices from a terminal.

To upgrade the chip to v4.41, the chip first needs to be connected to a network that has an internet connection. To do this, I used the following commands:

CMD    // Typing '$$$' starts command mode
set wlan ssid YourAccessPoint
AOK
<2.38.3> set wlan passphrase YourAccessPointPassword
AOK
<2.38.3> save
Storing in config
<2.38.3> reboot

Next, the update over FTP can be initiated:

CMD
ftp update wifly7-441.img    // If a timeout error occurs with the ftp download, try rebooting the chip and wait to see that it connects to your network, before trying the ftp command again
<2.38.3> FTP connecting to 198.175.253.161
FTP file=35
................................................................
FTP OK.
UPDATE OK
// MAKE SURE you run this factory reset and reboot straight after the update!
factory R
Set Factory Defaults
<2.38.3> reboot
*Reboot**CFG-ERR*
wifly-EZX Ver: 4.41 Build: r1057, Jan 17 2014 10:23:54 on RN-171
MAC Addr=00:06:66:51:0b:0c
*READY*

Now, you’ll need to connect to your network again because it needs to download some more files, so put the chip in ad hoc mode and set up the network:

CMD
set wlan join 1    // Turns on ad hoc mode
AOK
<4.41> set wlan ssid YourAccessPoint
AOK
<4.41> set wlan passphrase YourAccessPointPassword
AOK
<4.41> save
Storing in config
<4.41> reboot
*Reboot*wifly-EZX Ver: 4.41 Build: r1057, Jan 17 2014 10:23:54 on RN-171
MAC Addr=00:06:66:51:0b:0c
*READY*

Download the extra system files (for more info, see p80 of the manual):

CMD
ftp update wifly7-441.mif
<4.41> FTP connecting to 198.175.253.161
FTP file=58:................................................................
FTP file=59:..................................
FTP file=60:................................................
FTP file=61:.........................................................
FTP file=62:....................................
FTP file=63:...
FTP file=64:.......
UPDATE OK
*Reboot*wifly-EZX Ver: 4.41 Build: r1057, Jan 17 2014 10:23:54 on RN-171
MAC Addr=00:06:66:51:0b:0c
*READY*

Finally, set the chip up to act as an access point. The values below are just the defaults, apart from the ssid and passphrase (more info on this on p47 of the manual):

CMD
set wlan join 7    // Turns on access point mode
AOK
<4.41> set apmode ssid SomeSSID
AOK
<4.41> set apmode passphrase SomePassword
AOK
<4.41> set ip dhcp 4
AOK
<4.41> set ip address 192.168.1.1
AOK
<4.41> set ip net 255.255.255.0
AOK
<4.41> set ip gateway 192.168.1.1
AOK
<4.41> save
Storing in config
<4.41> reboot
*Reboot*wifly-EZX Ver: 4.41 Build: r1057, Jan 17 2014 10:23:54 on RN-171
MAC Addr=00:06:66:51:0b:0c
*READY*
Using WPA2-PSK
AP mode as SomeSSID on chan 1
Listen on 2000
DHCP Server Init

All done! Now you can test your access point. Try seeing if it is in your available networks on your computer and connect to it. Assuming that goes smoothly, use Netcat (or something similar) to open up a TCP connection to 192.168.1.1 on port 2000. You should now be able to type into your Netcat or serial window and see what you are typing appear in the other window, like in the picture below.