|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
? 2014-2015 microchip technology inc. ds50002230b wifly command reference manual downloaded from: http:///
ds50002230b-page 2 ? 2014-2015 microchip technology inc. information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. it is your responsibility to ensure that your application meets with your specifications. microchip makes no representations or warranties of any kind whether express or implied, written or oral, statutory or otherwise, related to the information, including but not limited to its condition, quality, performance, merchantability or fitness for purpose . microchip disclaims all liability arising from this information and its use. use of microchip devices in life support and/or safety applications is entirely at the buyers risk, and the buyer agrees to defend, indemnify and hold harmless microchip from any and all damages, claims, suits, or expenses resulting from such use. no licenses are conveyed, implicitly or otherwise, under any microchip intellectual property rights unless otherwise stated. note the following details of the code protection feature on microchip devices: microchip products meet the specification cont ained in their particular microchip data sheet. microchip believes that its family of products is one of the most secure families of its kind on the market today, when used i n the intended manner and under normal conditions. there are dishonest and possibly illegal methods used to breach the code protection feature. all of these methods, to our knowledge, require using the microchip products in a manner outside the operating specifications contained in microchips data sheets. most likely, the person doing so is engaged in theft of intellectual property. microchip is willing to work with the customer who is concerned about the integrity of their code. neither microchip nor any other semiconductor manufacturer c an guarantee the security of their code. code protection does not mean that we are guaranteeing the product as unbreakable. code protection is constantly evolving. we at microchip are co mmitted to continuously improvi ng the code protection features of our products. attempts to break microchips c ode protection feature may be a violation of the digital millennium copyright act. if such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that act. microchip received iso/ts-16949:2009 certification for its worldwide headquarters, design and wafer fabrication facilities in chandler and tempe, arizona; gresham, oregon and design centers in california and india. the company?s quality system processes and procedures are for its pic ? mcus and dspic ? dscs, k ee l oq ? code hopping devices, serial eeproms, microperipherals, nonvolatile memory an d analog products. in addition, microchip?s quality system for the design and manufacture of development systems is iso 9001:2000 certified. quality management s ystem certified b y dnv == iso/ ts 1 6 9 4 9 == trademarks the microchip name and logo, the microchip logo, dspic, flashflex, flexpwr, jukeblox, k ee l oq , k ee l oq logo, kleer, lancheck, medialb, most, most logo, mplab, optolyzer, pic, picstart, pic 32 logo, righttouch, spynic, sst, sst logo, superflash and uni/o are registered trademarks of microchip technology incorporated in the u.s.a. and other countries. the embedded control solutions company and mtouch are registered trademarks of microc hip technology incorporated in the u.s.a. analog-for-the-digital age, bodycom, chipkit, chipkit logo, codeguard, dspicdem, dspicdem.net, ecan, in-circuit serial programming, icsp, inter-chip connectivity, kleernet, kleernet logo, miwi, motorbench, mpasm, mpf, mplab certified logo, mplib, mplink, multitrak, netdetach, omniscient code generation, picdem, picdem.net, pickit, pictail, righttouch logo, real ice, sqi, serial quad i/o, total endurance, tsharc, usbcheck, varisense, viewspan, wiperlock, wireless dna, and zena are trademarks of microchip technology incorporated in the u.s.a. and other countries. sqtp is a service mark of microchip technology incorporated in the u.s.a. silicon storage technology is a registered trademark of microchip technology inc. in other countries. gestic is a registered tradem ark of microchip technology germany ii gmbh & co. kg, a subsidiary of microchip technology inc., in other countries. all other trademarks mentioned herein are property of their respective companies. ? 2014-2015, microchip technology incorporated, printed in the u.s.a., all rights reserved. isbn: 978-1-63277-737-9 downloaded from: http:/// ? 2014-2015 microchip technology inc. ds50002230b-page 3 w i f ly command reference manual table of contents chapter 1. introduction 1.1 overview ........................................................................................ .............. 11 1.2 features ......................................................................................... .............. 12 1.3 supported access points ........................................... .................................. 12 chapter 2. getting started 2.1 prerequisites ........................................... ................................................... .. 13 2.2 firmware version check .................................................................. ............ 13 2.3 common tasks ................................................... ......................................... 14 chapter 3. features and settings 3.1 factory reset ............................................................................... ................ 21 3.2 associating to an access point ................................................ .................... 27 3.3 making a connection to the rn module ......................................... ............ 38 3.4 connecting the rn module to a remote device ...................... .................... 38 3.5 sending data to a remote host ................................................... .............. 40 3.6 using the html client feature ...................................................... .............. 46 3.7 ftp client features ............................................................ ......................... 51 3.8 putting the rn module to sleep and waking it .................................. .......... 53 3.9 gpio functions ............................................................................ ................ 56 3.10 setting debug print levels ......................................... ................................ 59 3.11 using the real-time clock function ........................................ .................. 61 3.12 time stamping packets ............................................................. ................ 62 3.13 soft access point (soft ap) mode ....................................... ....................... 63 3.14 upgrading firmware ............................................................... .................... 67 3.15 analog sensor capability .......................................... ................................. 74 chapter 4. command reference 4.1 command syntax ............................................... .......................................... 77 4.2 command organization ............................................... ................................ 78 4.3 set commands .......................................... ................................................... 79 4.4 get commands ................................................... ....................................... 132 4.5 status commands ................................................ ...................................... 135 4.6 action commands .......................................... ............................................ 138 4.7 file i/o commands ........................................................................ ............ 144 downloaded from: http:/// wifly command reference manual ds50002230b-page 4 ? 2014-2015 microchip technology inc. notes: downloaded from: http:/// ? 2014-2015 microchip technology inc. ds50002230b-page 5 wifly command reference manual preface introduction this preface contains general information that will be useful to know before using the wifly application to access rn modules. topics discussed in this preface include: document layout conventions used in this guide recommended reading the microchip web site development systems customer change notification service customer support document revision history document layout this users guide provides information for configuring rn modules using the wifly application, including a command reference, advanced features, and applications. the document is organized as follows: chapter 1. ?introduction? C this chapter introduces the rn modules and provides a brief overview of their features. chapter 2. ?getting started? C this chapter provides information that is useful when getting started with an rn module. chapter 3. ?features and settings? C this chapter describes features and settings, including techniques to put the rn module to sleep, wake up, and meth- ods to open a tcp connection when awake. chapter 4. ?command reference? C this chapter provides information on the commands used to configure rn modules and gives examples. notice to customers all documentation becomes dated, and this manual is no exception. microchip tools and documentation are constantly evolving to meet customer needs, so some actual di alogs and/ or tool descriptions may differ from those in this document. please refer to our web site ( www.microchip.com ) to obtain the latest documentation available. documents are identified with a ?ds? number. this number is located on the bott om of each page, in front of the page number. the numbering convention for the ds number is ?dsxxxxxxxxa?, where ?xxxxxxxx? is the document number and ?a? is the revision level of the document. for the most up-to-date information on development tools, see the mplab ? x ide on-line help. select the help menu, and then topics to open a list of available on-line help files. downloaded from: http:/// wifly command reference manual ds50002230b-page 6 ? 2014-2015 microchip technology inc. conventions used in this guide this manual uses the following documentation conventions: documentation conventions description represents examples italic characters referenced books mplab ide user?s guide emphasized text ...is the only compiler... initial caps a window the output window a dialog the settings dialog a menu selection select enable programmer quotes a field name in a window or dialog save project before build underlined, italic text with right angle bracket a menu path file > save bold characters a dialog button click ok a tab click the power tab text in angle brackets < > a key on the keyboard press preface ? 2014-2015 microchip technology inc. ds50002230b-page 7 recommended reading this users guide describes how to use the wifly application to configure an rn module. the rn module-specific data sheets contain current information on the rn module specifications. additional microchip doc uments are available and are recommended as supplemental reference resources. to obtain any of these documents, visi t the microchip web site at www.microchip.com . rn131 module data sheet (ds70005085), rn171 module data sheet (ds70005084), and rn1723 module data sheet (ds70005224) consult these documents for detailed information on the rn131, rn171, and rn1723 modules. reference information found in this data sheet includes: device pinout and packaging details device electrical specifications list of features included on the rn module rn131/rn171/rn1723 evaluation kits user?s guide (ds50002183) this users guide describes the rn evaluation boards that are used for demonstrating the capabilities of the rn131, rn171, and rn1723 modules. these rn evaluation boards have the flexibility to connect directly to a pc or laptops through a standard usb interface or to embedded controllers through the serial uart interface. reference information in this users guide includes: overview of the evaluation kit hardware and evaluation board features and components hardware and module configuration sensor interfaces and push button functions evaluation board schematics picdem? pic18 explorer demonstration board user?s guide (ds51721) this document describes how to use the picdem pic18 explorer demonstration board as a development tool to emulate and debug firmware on a target board. refer- ence information found in this users guide includes: functionality and features hardware features development board schematics explorer 16 development board user?s guide (ds50001589) this document describes how to use the explorer 16 development board as a development tool to emulate and debug firmware on a target board. reference information found in this users guide includes: functionality and features hardware features development board schematics downloaded from: http:/// wifly command reference manual ds50002230b-page 8 ? 2014-2015 microchip technology inc. the microchip web site microchip provides online support via our web site at www.microchip.com. this web site is used as a means to make files and information easily available to customers. accessible by using your favorite internet browser, the web site contains the following information: product support C data sheets and errata, application notes and sample programs, design resources, users guides and hardware support documents, latest software releases and archived software general technical support C frequently asked questions (faqs), technical support requests, online discussion groups, microchip consultant program member listing business of microchip C product selector and ordering guides, latest microchip press releases, listing of seminars and events, listings of microchip sales of fices, distributors and factory representatives development systems custome r change notification service microchips customer notification service helps keep customers current on microchip products. subscribers will receive e-mail notification whenever there are changes, updates, revisions or errata related to a specified product family or development tool of interest. to register, access the microchip web site at www.microchip.com, click on customer change notification and follow the registration instructions. the development systems product group categories are: compilers C the latest information on microchip c compilers and other language tools emulators C the latest information on the microchip in-circuit emulator, mplab ? real ice? in-circuit emulator in-circuit debuggers C the latest information on the microchip in-circuit debugger, mplab icd 3 mplab x ide C the latest information on microchip mplab x ide, the windows ? integrated development environment for development systems tools programmers C the latest information on microchip programmers including the pickit? 3 development programmer customer support users of microchip products can receive assistance through several channels: distributor or representative local sales office field application engineer (fae) technical support customers should contact their distributor, representative or field application engineer (fae) for support. local sales offices are also available to help customers. a listing of sales offices and locations is included in the back of this document. technical support is available through the web site at: http://support.microchip.com downloaded from: http:/// preface ? 2014-2015 microchip technology inc. ds50002230b-page 9 document revision history revision a (january 2014) this is the initial released version of the document. revision b (september 2015) this revision includes the following updates: information specific to the rn1723 module was added throughout the document the content was reorganized, which includes text and formatting updates that were incorporated throughout the document downloaded from: http:/// wifly command reference manual ds50002230b-page 10 ? 2014-2015 microchip technology inc. notes: downloaded from: http:/// ? 2014-2015 microchip technology inc. ds50002230b-page 11 wifly command reference manual chapter 1. introduction this reference manual provides information on the commands and features for microchip products that utilize the wifly radio module command set. the wifly radio module is a complete, stand-alone embedded wireless lan access device. the device has an on-board tcp/ip stack and applications, and in the simplest hardware configuration, requires only four pins: power, tx, rx, and ground. once the initial configuration has been performed, the device automatically accesses a wi-fi ? network and sends/receives serial data. topics covered include: overview features supported access points 1.1 overview this document is applicable to the stand-alone rn131, rn171, and rn1723 modules, as well as microchip products based on these modules. for example, the rn171xv device incorporates the rn171 module; therefore, all rn171 hardware features apply to the rn171xv. although there are some differences, the rn131, rn171, and rn1723 modules support the same ascii command set. ta b l e 1 - 1 compares the rn module features. refer to ?recommended reading? for information on accessing the rn131, rn171, and rn1723 data sheets for information on their hardware differences and for detailed hardware specifications. table 1-1: comparing the rn131, rn171, and rn1723 modules feature rn131 rn171 and rn1723 output power (p max ) 18 dbm (fixed) 12 dbm (programmable) lowest power 18 dbm 0 dbm (< 100 ma tx current) on-board antenna yes no accurate sleep timer yes (32 khz) no (+/- 10% error) gpio pins available 10, gpio4-13 (gpio1-3 are not avail- able for use) 14, gpio1-14 downloaded from: http:/// wifly command reference manual ds50002230b-page 12 ? 2014-2015 microchip technology inc. 1.2 features general: fully qualified and wi-fi certified 2.4 ghz ieee 802.11 b/g transceiver fcc, ce, ic certified, and rohs compliant ultra-low power: intelligent, built-in power management with programmable wake-up accepts 3.3v power supply or 2 to 3v battery when using boost regulators rn131: 4 a sleep, 35 ma rx, 210m tx at 18 dbm (tx power is not configurable) rn171 and rn1723: 4 a sleep, 35 ma rx, 185 ma tx at 12 dbm (tx power is configurable) antenna options: rn131: on-board ceramic chip antenna and u.fl connector for external antenna rn171 and rn1723: rf pad hardware: 8-megabit flash memory and 128 kbyte ram, 2 kbyte rom, 2 kbyte battery- backed memory general purpose digital i/o pins: - rn131: 10 gpio pins - rn171 and rn1723: 14 gpio pins eight analog inputs (14 bits, 1.2v) real-time clock for wake-up and time stamping/data logging; automatic sleep and automatic wake-up modes network support: supports soft ap mode and infrastructure networking modes push button wps mode for easy network configuration on-board tcp/ip stack over the air firmware upgrade (ftp) secure wi-fi authentication via wep, wpa-psk (tkip), and wpa2-psk (aes) configuration over uart or wireless interfaces using simple ascii commands built-in networking applications: dhcp client, dns client, arp, icmp ping, ftp client, telnet, http, udp, and tcp 1.3 supported access points the rn module should work with any standard access point (ap). microchip has tested the rn modules with access points from the following manufacturers: airlink101 ? apple ? asus belkin buffalo networks inc. cisco d-link ? dynex ? linksys netgear smc ? networks tp-link downloaded from: http:/// ? 2014-2015 microchip technology inc. ds50002230b-page 13 wifly command reference manual chapter 2. getting started this chapter provides information for the purpose of getting started with using an rn module. all of the commands discussed in this chapter are described in detail in chapter 4. ?command reference? . topics in this chapter include: prerequisites firmware version check common tasks 2.1 prerequisites prior to using an rn module for the first time, readers should be familiar with the information in the ?rn131/rn171/rn1723 evaluation kits user?s guide? (ds50002183), which is available from the microchip website ( www.microchip.com ). refer to ?recommended reading? for information on additional resources. 2.2 firmware version check the set of available commands and features for a particular rn module depend greatly on the installed file system contents. each rn module is loaded with firmware prior to leaving the factory. consult the microchip website for firmware information by visiting: http://www.microchip.com/wifi . the rn module has a file system for storing firmware, as well as configuration files. to view the firmware version, use the ls command. the file size is displayed in sectors and the active boot image is identified in the final message. the wifly firmware version returned by the ls command is shown in bold type in example 2-1 . example 2-1: determining the firmware version fl# siz flags 2 88328 3 wifly-fzx-100-r1634i 5 74432 3 web_app-fzx-112 8 46836 3 wps_app-fzx-131 10 66677 3 eap_app-fzx-105 12 51053 0 web_config.html 25 512 0 link.html 26 7268 0 logo.png 28 1060 10 config downloaded from: http:/// wifly command reference manual ds50002230b-page 14 ? 2014-2015 microchip technology inc. 2.3 common tasks this section provides information on the common tasks users may perform when using an rn module, which includes the following topics: configuring the rn module performing a factory reset provisioning onto and associating with a wi-fi network sending data creating a soft access point module sleep and wake-up 2.3.1 configuring the rn module the rn module has two modes of operation: data mode and command mode. in data mode, the rn module can accept incoming connections or initiate outgoing connections. to configure parameters and/or view the current configuration, the rn module must be placed into command mode. 2.3.1.1 entering command mode by default, the rn module is in data mode after power-up. sending the escape sequence of three dollar signs, $$$ , causes the rn module to enter command mode. the three dollar sign ( $ ) characters must be sent in succession with no additional characters before or after. a carriage return ( getting started ? 2014-2015 microchip technology inc. ds50002230b-page 15 2.3.1.4 automatic access point association when the rn module powers up, it attempts to automatically associate with the access point stored in its configuration settings if the auto-join feature is enabled. in firmware version 4.0 and later, the auto-join feature is disabled by default. enable it using the ascii command set wlan join 1 . the auto-associate feature can be disabled (default behavior) using the set wlan join 0 command. this command prevents the rn module from attempting to associate with a network that does not exist. 2.3.2 performing a factory reset the factory reset command initializes all of the wifly module parameters to their factory default values. the default parameters only take effect after the rn module has been rebooted. refer to 3.1.1 ?default parameters after factory reset? for more information. to perform a factory reset, first issue the factory reset command and then reboot the rn module, as follows: factory reset // restores default parameter values reboot // restart module; default parameters take effect 2.3.3 provisioning onto and associating with a wi-fi network before being allowed to communicate on a wi-fi network, an rn module must first be provisioned, associated to an access point in the network, and have a valid ip address. there a three common ways to provision and associate an rn module onto a wi-fi network: association using command mode (via a usb-uart connection) this is the most commonly used method, which is described in the next section. association through wps association through a web interface note: for information on associating using wps or a web interface, consult the ?rn131/rn171/rn1723 evaluation kits user?s guide? (ds50002183), which is available from the microchip website ( www.microchip.com ). downloaded from: http:/// wifly command reference manual ds50002230b-page 16 ? 2014-2015 microchip technology inc. 2.3.3.1 association using command mode to associate using command mode, perform the following steps: 1. connect the rn evaluation board to the host (computer) using the usb connection. the green led should begin blinking. 2. open the terminal emulator application on the host. 3. configure the serial port: a) locate the com port that is assigned to the usb cable connected to the rn evaluation kit. b) in the terminal emulator, select the com port and open the serial port setup dialog and make the following selections: baud rate: 9600 data bits: 8 parity: none stop bits: 1 flow control: none 4. enter command mode by sequentially typing $$$ with no other characters before or after (by default, the rn module is in data mode). 5. in the terminal emulator, type scan and press getting started ? 2014-2015 microchip technology inc. ds50002230b-page 17 2.3.4 sending data after the rn module has associated with a network and a valid ip address has been obtained, data can be sent between two rn modules or from an rn module to a server. two methods to transfer data are available: tcp and udp. tcp is the most common method, which is described in this section. refer to the ?rn131/rn171/rn1723 evaluation kits user?s guide? (ds50002183) for information on transferring data through udp. perform the following steps to transfer data using tcp: 1. configure two rn modules to associate with an ap, as described in 2.3.3 ?provisioning onto and associating with a wi-fi network? . 2. obtain the ip address assigned to each rn module using the get ip command, as shown in the below example. in this example, the ip addresses assigned are 192.168.1.108 and 192.168.1.109. 3. on one of the rn modules, open a socket using the following commands: set ip proto 0x2 // sets the ip protocol. the parameter // 0x2 is a bit-mapped register, which // sets the protocol to tcp. set ip host 192.168.1.109 // sets the ip address of the remote host set ip remote 2000 // sets the port number of the remote host open // opens a tcp connection the terminal emulators on the local host and remote host respond with *open**hello* to indicate the connection was opened successfully. typing into one terminal emulator will display the result on the other terminal emulator. 4. use the close command to close the socket and disconnect tcp. remote host local host downloaded from: http:/// wifly command reference manual ds50002230b-page 18 ? 2014-2015 microchip technology inc. 2.3.5 creating a soft access point in soft access point (soft ap) mode, the rn module provides the following capabilities: creates a soft ap network to which client devices, such as smartphones and tablets can join runs a dhcp server and issues ip addresses to a maximum of seven clients supports security supports routing between clients (only when security is not enabled) there are two methods, hardware and software, to enable soft ap mode on an rn module. enabling soft ap mode in hardware is done by holding the gpio9 pin high (at 3.3v), and then resetting the rn module by cycling the power. the rn module will boot-up in soft ap mode. to enable soft ap mode in software, the apmode command is used. once an rn module is in soft ap mode, any client device can associate with the net- work the rn module is broadcasting. 2.3.5.1 customized soft ap mode network settings the following commands illustrate customized network settings that can be used after enabling soft ap mode: set wlan join 7 // creates a soft ap network using // stored configuration values. the ap // is created upon power-up, reboot, or // waking from sleep. set apmode ssid getting started ? 2014-2015 microchip technology inc. ds50002230b-page 19 2.3.6 module sleep and wake-up there are three methods by which an rn module can be placed into sleep mode. the first method is by using the sleep command through the uart interface the second method is to use the sleep timer through the internal rtc interface. in this method, the rn module sleeps for the number of seconds specified in the set sys wake wifly command reference manual ds50002230b-page 20 ? 2014-2015 microchip technology inc. notes: downloaded from: http:/// ? 2014-2015 microchip technology inc. ds50002230b-page 21 wifly command reference manual chapter 3. features and settings this chapter describes the rn modules features and settings, including techniques for placing the rn module into sleep mode and waking up the rn module, as well as methods to open a tcp connection when the rn module is awake. in addition, the uart flow control, alternative gpio functions, and the real-time clock are described. the following topics are discussed: factory reset associating to an access point making a connection to the rn module connecting the rn module to a remote device sending data to a remote host using the html client feature ftp client features putting the rn module to sleep and waking it gpio functions setting debug print levels using the real-time clock function time stamping packets soft access point (soft ap) mode upgrading firmware analog sensor capability 3.1 factory reset performing a factory reset on an rn module initializes all of the rn module parameters to their factory default state. this is accomplished by first issuing the factory reset command, immediately followed by the reboot command. internal to the rn module, the factory reset command loads all of the default param- eter settings into ram, and then writes these settings into a standard configuration file that the rn module maintains. when the rn module is subsequently rebooted, the settings that were saved in the configuration file take effect. microchip recommends that before any major operational modes changes are made to an rn module, that a factory reset and a reboot command be executed. one such example is switching the rn module from operating as a soft ap to that of a hmtl client. in this instance, the procedure would be to first factory reset and reboot the rn module, set it up as a html client, save the configuration, and then reboot the rn module a second time. 3.1.1 ?default parameters after factory reset? lists all of the default wifly settings for an rn module. downloaded from: http:/// wifly command reference manual ds50002230b-page 22 ? 2014-2015 microchip technology inc. 3.1.1 default parameters after factory reset table 3-1: soft ap mode parameters table 3-2: broadcast parameters table 3-3: comm parameters table 3-4: dns parameters table 3-5: ftp parameters parameter default value comment beacon 102 time in milliseconds. for soft ap mode only . probe 5 number of seconds for beacons before declar- ing soft ap is lost. for soft ap mode only . reboot 0 for soft ap mode only . parameter default value comment ip address 255.255.255.255 port 55555 interval 7 time in seconds. backup address 0.0.0.0 backup port 0 parameter default value comment close string *open* open string *clos* remote string *hello* flush size 1420 match character 0 flush timer 10 time in milliseconds. idle timer 0 cmd char $ parameter default value comment ip address 0.0.0.0 name dns1 backup rn.microchip.com lease 8640 for soft ap mode only . parameter default value comment server address 0.0.0.0 file wifly-gsx- features and settings ? 2014-2015 microchip technology inc. ds50002230b-page 23 table 3-6: ip parameters table 3-7: optional parameters table 3-8: system parameters table 3-9: time server parameters parameter default value comment dhcp on 1 equals enabled. ip address 0.0.0.0 net mask 255.255.255.0 local port 2000 gateway 0.0.0.0 host 0.0.0.0 remote port 2000 protocol 2 tcp server and client. mtu 1524 flags 0x7 tcp mode 0x7 backup 0.0.0.0 parameter default value comment device id wifly-gsx join timer/wpa timer 1000 replacement char $ 0x24 format 0x00 password no password enforced. signal 0 average 5 parameter default value comment sleep timer 0 wake timer 0 trigger 0x1 sens0 pin wakes up the device. auto connect 0 iofunc 0x0 no alternate functions. iomask 0x20f0 for rn131 modules. 0x21f0 for rn171 and rn1723 modules. iovalue 0x0 print level 0x1 print enabled debug register 0x0 unused parameter for future development. leave at default value. launchstring web_app parameter default value comment enable 0 disabled. server address 64.90.182.55 fixed to port 123 - sntp protocol. zone 7 pacific time zone (usa). downloaded from: http:/// wifly command reference manual ds50002230b-page 24 ? 2014-2015 microchip technology inc. table 3-10: uart parameters table 3-11: wlan parameters 3.1.2 string variable sizes ta b l e 3 - 1 2 provides the string variable sizes for the following parameters: parameter default value comment baudrate 9600 flow 0 disabled. mode 0 cmd_gpio 0 parameter default value comment ssid roving1 channel 0 automatic scan. external antenna 0 off - use on-board chip antenna. for rn131 modules only . join mode 1 automatically scan and join based on ssid. 0 automatic scan and join is disabled. authentication mode open mask 0x1fff all channels. rate 12 24 megabit. linkmon 0 passphrase rubygirl tx power 0 implies 12 dbm. for rn171 modules only . table 3-12: string variable sizes parameter type parameter value (bytes) ftp file 32 user 16 pass 16 dir 32 wlan ssid 32 phrase 64 dns dns host name 64 dna back-up host name 64 comm open 32 close 32 remote 64 deviceid 32 downloaded from: http:/// features and settings ? 2014-2015 microchip technology inc. ds50002230b-page 25 3.1.3 restoring default configuration settings 3.1.3.1 restoring throug h software and hardware the default factory configuration settings can be restored in software and hardware. software C in command mode, use the factory reset command to restore the default settings. this command automatically loads the default settings and exe- cutes a save command. next, send the reboot command so that the rn module reboots with the default configuration. hardware C set the gpio9 pin high on power-up to enable the factory reset func- tion. then, toggle gpio9 five times, which restores the configuration to the factory reset. the gpio9 pin is sampled at approximately 1 hz; therefore, if a cpu is used to generate the signal, ensure that gpio9 transitions (high-to-low or low-to-high) for a period of at least one second. 3.1.3.2 user configuration file a user configuration file can be specified and then used to restore a custom set of fac- tory reset settings. for example, if the configuration file named user is found on the rn modules file system, the rn module reads it as the factory default in stead of using the factory hardcoded defaults. if no user configuration file is present, the rn module uses the hardcoded factory defaults. the user configuration file is created using the save user command, which saves the current configuration settings into a file named user . even if a user configuration file exists, enabling and toggling the gpio9 pin seven times overrides the user settings and restores the rn module to the factory hardcoded defaults. this bypass mechanism allows the factory defaults to be restored in the event that an invalid parameter was saved in the user-defined configuration file. issuing the factory reset command while in command mode restores the rn module to a factory default state. 3.1.4 boot-up timing values ta b l e 3 - 1 3 shows the boot-up timing values. note: the user configuration file can be specified based on firmware version, as follows: rn131 and rn171 modules with firmware version 2.45 and later rn1723 modules with firmware version 1.0 or later note: the rn module must be rebooted or reset for the new settings to take effect. table 3-13: boot-up timing values function description time (ms) power-up power-up time from reset high or from the time of power-u p to when boot code is loaded from flash to ram. 70 initialization initialize ecos. 50 ready load configuration and initialize application. 30 downloaded from: http:/// wifly command reference manual ds50002230b-page 26 ? 2014-2015 microchip technology inc. join associate using channel = 0 (full channel scan, mask = 0x1fff). 80 associate using channel = 0 (primary channel scan, mask = 0x421) 15 associate using channel = x (fixed channel) 5-20 authentication authenticate using wpa1 or wpa2 (highly dependent on access point response) 50-250 acquire ip dhcp obtain ip address (highly dependent on dhcp server response time) soft ap dependent table 3-13: boot-up timing values function description time (ms) downloaded from: http:/// features and settings ? 2014-2015 microchip technology inc. ds50002230b-page 27 3.2 associating to an access point configuring the rn module to make connections involves associating with an access point and opening a connection. before the rn module can be configured over the wi-fi link, the rn module must be associated with a network and the network settings must be programmed. therefore, the best method is to configure the rn module is by using the uart. this section describes how to configure the rn module over the uart using the rs-232 connector or an evaluation board. for this mode, open a ter- minal emulator on the com port associated with the rn module. the default baud rate is 9,600, 8 bits, and no parity. 3.2.1 associate with an access point from within the terminal window, place the rn module into command mode by typing $$$ . the rn module responds with cmd , indicating that it is in command mode. type show net to display the current network settings, as shown in figure 3-1 . figure 3-1: display current network settings find all available networks with the scan command, as shown in figure 3-2 . figure 3-2: find available networks to connect to an open network, use the join command to associate with the access point. the scan list in figure 3-2 shows that roving1 is an open access point. type join roving1 (or join # 1 ) to associate with the network, as shown in figure 3-3 . cmdshow net ssid=theloft chan=6 assoc=ok dhcp=ok time=fail links=1 <2.03> cmd scan <2.03> scan:found 6 num ssid ch rssi sec mac address suites 1 roving1 01 -64 open 00:1c:df:4f:45:9e 104 4 2 netgear 01 -58 open 00:22:3f:6b:95:42 104 0 3 07fx12018434 06 -73 wep 00:18:3a:7e:71:d7 1104 0 4 theloft 06 -51 wpa2psk 00:0c:41:82:54:19 aesm-aes 1100 0 5 airlink-11 11 -53 wpav1 00:18:02:70:7e:e8 tkipm-tkip 3100 ac 6 sensor 11 -52 open 00:1c:df:cc:aa:d8 100 1 downloaded from: http:/// wifly command reference manual ds50002230b-page 28 ? 2014-2015 microchip technology inc. figure 3-3: join the network if the access point is secure, the passphrase must be set prior to issuing the join command. the rn module attempts to inquire and determine the access points security protocol which means the authentication mode does not need to be set. to set the wpa passphrase use the set wlan passphrase features and settings ? 2014-2015 microchip technology inc. ds50002230b-page 29 depending on the firmware version, the rn module supports the wps feature. figure 3-5: confir ming wps application installation note: use the ls command to confirm whether the rn module supports the application, as shown in figure 3-5 . downloaded from: http:/// wifly command reference manual ds50002230b-page 30 ? 2014-2015 microchip technology inc. 3.2.2.1 launching a wps application there are two ways to run a wps function: using the run wps command in the console using gpio9 to run a wps function using the factory reset (gpio9) mode: 1. enable the wps function on gpio9 using the set sys launch wps_app command. wps on gpio9 is disabled by default to avoid accidentally running the wps function. 2. the wps application is started when gpio9 asserted. when the wps application launches, it negotiates the ssid and passphrase with the soft ap and reboots the rn module to associate with the wps-enabled access point. by default, during the wps process, the rn module prints messages on the uart as it scans channels, detects access points, and tries to complete wps. these messages are disabled using the set sys print 0 command. note: depending on the firmware version, if the gpio9 pin is high, the rn module boots in soft ap mode. care must be taken to drive gpio9 low before the rn module reboots. a good indicator is the red led on the rn171 evaluation board. when this led flashes, indicating the rn module is scanning for a wps-enabled access point, the gpio9 pin should be driven low. downloaded from: http:/// features and settings ? 2014-2015 microchip technology inc. ds50002230b-page 31 3.2.3 configuration web server this section describes how to use the rn modules configuration web server to associate an rn module to an access point. rn modules can operate in one of two modes: infrastructure and soft ap. infrastructure mode in this mode, the rn module can join a network created by an access point. soft ap mode in this mode, the rn module behaves as an access point with limited functionality. a key challenge when using any embedded device in infrastructure mode is to provision it so that it can associate with a soft ap. this process requires storing the sof t aps settings, such as the ssid and passphrase, in the embedded device. embedded wi-fi modules can be configured or provisioned to join an infrastructure network in several ways: sending ascii commands to the rn module over a uart sending ascii commands remotely while the rn module is in soft ap mode using wi-fi protected setup (wps) sending commands to the rn module remotely using a web interface 3.2.3.1 using the configuration web server configuring the embedded rn module to associate with an soft ap in infrastructure mode involves the following process: 1. start the rn modules configuration web server. 2. connect the client device (i.e., pc, smartphone, tablet, etc.) to the rn modules soft ap network. 3. access the rn modules configuration web page from the client devices web browser. 4. save the settings (ssid and passphrase) in the web browser and exit. note: depending on the firmware version, the web server application is available for use in configuring the rn module, as follows: rn131 and rn171 modules with firmware version 4.0 and later rn1723 modules with firmware version 1.0 or later downloaded from: http:/// wifly command reference manual ds50002230b-page 32 ? 2014-2015 microchip technology inc. 3.2.3.1.1 start the configuration web server the web server can be enabled in one of two ways: hardware or software. when the configuration web server is started, it creates a soft ap network with the settings shown in ta b l e 3 - 1 4 . 3.2.3.1.2 starting the configuration web server in hardware the web server can be started through hardware using gpio9. to use gpio9, specify that the web application should launch using the command set sys launch_string web_app (default configuration). with the launch string set, drive the gpio9 pin high any time after power-up to start the web server. the rn module creates a soft ap network with the parameters previously described in table 3-14 . 3.2.3.1.3 starting the configuration web server in software if gpio9 is not accessible using a push button or a jumper, an embedded microcontroller can start the configuration web server mode in software using the command run web_app . this command runs the configuration web server application and creates a soft ap network to which devices can join and configure the rn module from a web browser. table 3-14: soft ap network settings setting soft ap mode default ssid wifly-gsx-xx (rn131 module) wifly-exz-xx (rn171) wifly-fxz-xx (rn1723) where xx ? is the last byte of the rn modules mac address. channel 1 dhcp server enabled ip address 192.168.1.1 netmask 255.255.255.0 gateway 192.168.1.1 note: the soft ap networks ssid uses the rn modules device id parameter. if the device id parameter is changed using the set opt device_id features and settings ? 2014-2015 microchip technology inc. ds50002230b-page 33 3.2.3.2 status leds in configuration web server mode the status leds provide a visual indication of the rn modules state while using the configuration web server feature, as shown in ta b l e 3 - 1 5 . 3.2.3.3 using the web server to configure the rn module this section describes how to use the web server to configure the rn module with the ssid and passphrase of the soft ap. the example uses the internet explorer web browser running on a windows 7 personal computer; however, the same concepts apply to any device with a wi-fi interface, such as an iphone, android smartphone, tablet, or pcs, running a web browser such as chrome, firefox, or safari. to configure the rn module using a web browser, perform the following steps: 1. associate a pc to the rn modules soft ap network, as shown in figure 3-6 . figure 3-6: modul e?s network name 2. launch a web browser. table 3-15: status leds event led action launch soft ap mode red, green blink alternately yellow, blue off client associated with the soft ap network green solid on yellow blinks fast (twice per second) web browser launched on the client blue solid on green solid on yellow blinks fast (twice per second) downloaded from: http:/// wifly command reference manual ds50002230b-page 34 ? 2014-2015 microchip technology inc. 3. type http://config to go to the home page of the web server running on the rn module. the page has two tabs displayed by default, as shown in figure 3-7 : network configuration this tab is used to set the soft aps ssid and passphrase. information this tab displays the following information about the rn module: - rn modules mac address - module type (rn131 or rn171/rn1723) - list of files on the file system - battery strength figure 3-7: network configuration tab downloaded from: http:/// features and settings ? 2014-2015 microchip technology inc. ds50002230b-page 35 4. select the network configuration tab, as shown in figure 3-7 . the rn modules network settings (ssid and passphrase) are configured using this tab. configure these settings as follows: a) enter the networks ssid in the access point ssid field. alternatively, click refresh list . the rn module scans for networks and dis- plays a list of found networks. select your network from the available access points list or enter it in the access point ssid box. clicking an ssid displays a drop-down menu with more information about that network, such as channel, rssi, security mode (wep, wpa, wpa2), capabilities, wap configurations, wps configuration, and the soft aps mac address (also called bssid). if the desired access point is not in the list, click refresh list to scan again. b) enter the soft aps security passphrase in the passphrase field. c) (optional) the rn module uses dhcp by default. to assign the rn module a static ip, turn off the check to enable dhcp option and enter the static ip, subnet mask, and gateway. d) once the network settings have been configured, click save configuration to save the settings to the rn module. 5. exit the web server by clicking exit web configuration app . the rn module reboots in infrastructure mode and joins the wireless network. note: if the wireless network is hidden (i.e., not broadcasting an ssid), it does not display in the scan output. in this case, the ssid must be manually entered. downloaded from: http:/// wifly command reference manual ds50002230b-page 36 ? 2014-2015 microchip technology inc. 3.2.3.4 using the advanced tabs turning on the display advanced tabs option (bottom right corner of the application window) opens the terminal and module configuration tabs. 3.2.3.4.1 terminal tab click the terminal tab (see figure 3-8 ). in this tab, ascii commands can be issued to configure any of the rn modules parameters. the web server includes a help utility that guides the user through the rn module configuration. to use this feature, type help in the terminal. figure 3-8: terminal tab downloaded from: http:/// features and settings ? 2014-2015 microchip technology inc. ds50002230b-page 37 3.2.3.4.2 module configuration tab click the rn module configuration tab (see figure 3-9 ). in this tab, the rn modules frequently used parameters such as device id, uart baud rate, and flow control are configured. other parameters can be configured using ascii commands in the terminal tab. figure 3-9: module configuration tab 3.2.3.5 web server timers the application includes two timers to ensure that the web server runs smoothly: idle timer browser disconnect timer 3.2.3.5.1 idle timer the idle timer ensures that the client associated with the rn modules soft ap network is not lost or unresponsive. if there is no interaction between the configuration web server and the clients web browser for five minutes (default value), the rn module reboots to the boot image. to restart the configuration web server, it must be started in software or hardware as described in 3.2.3.1.1 ?start the configuration web server? . the time-out defaults to five minutes (300 seconds) and is configurable via the following command: set comm idle < seconds > 3.2.3.5.2 browser disconnect timer this timer is used to recover from an unexpected situation in which the configuration web server on the rn module becomes unresponsive to the requests sent out by the web browser. the web browser periodically sends requests to the configuration web server. if the rn module does not receive a request within 60 seconds, it assumes that the configu- ration web server has become unresponsive and it reboots itself into configuration web server mode. then, the device must be reassociated with the rn modules soft ap network and the web page must be refreshed. downloaded from: http:/// wifly command reference manual ds50002230b-page 38 ? 2014-2015 microchip technology inc. 3.3 making a connection to the rn module to connect to the rn module from a remote device, open an ip socket and connect to the rn modules ip address. telnet can be used to test the connection by typing open features and settings ? 2014-2015 microchip technology inc. ds50002230b-page 39 3.4.1 controlling connections using gpio5 and gpio6 the gpio5 pin can be used to control the tcp connection. after configuring the pin with the set sys iofunc command, the rn module attempts to connect to the stored ip address and port when gpio5 goes high and disconnects when gpio5 goes low. similarly, the connection status can be monitored by reading the gpio6 pin. when it goes high, the connection is open, and when it goes low, the connection is closed. use the command set sys iofunc command to enable gpio6. example 3-3: use gpio5 and gp io6 to contro l connections 3.4.2 using dns settings the rn module contains a built-in dns client. if the ip address of the host is not specified (i.e., it is set to 0.0.0.0), the rn module uses the dns protocol. when the host name is set using the set dns name wifly command reference manual ds50002230b-page 40 ? 2014-2015 microchip technology inc. 3.5 sending data to a remote host 3.5.1 controlling connections with gpio pins in embedded applications it is useful to monitor and control the status of the tcp/ip connection. to monitor and control the rn modules connection status, enable the alternate function of gpio4-gpio6. using the alternate function for these gpio pins, the rn module connects to the stored remote host ip address and port when gpio5 is driven high, and disconnects when driven low. the tcp/ip connection status can be monitored by reading gpio6; it is high when connected, and low when not connected. to configure the rn module to connect using gpio5 and gpio6, use the following commands: set ip host // set the ip address of the remote host set ip remote |