Home
WiFly Command Reference, Advanced Features and
Contents
1. Statistic Description Conns The number of TCP connections WRX Number of bytes received by the module over TCP WTX Number of bytes transmitted by the module over TCP RTRY Total number of TCP retries RTRYfail Total number of TCP retries failed URX Total number of bytes received over the UART UTX Total number of bytes transmitted over the UART RXdrop Total number of bytes dropped by the UART RXerror Total number of UART bytes received in error parity framing FlwSet Total number of set software flow controls FlwClr Total number of cleared software flow controls Netbuffs Total number of dropped TCP packets Evt Total number of unknown events Adhoc_lost Total number of ad hoc disconnects Boots Total number of module restarts Wdog Total number of watchdogs TXon Unused Example show stats H Show the statistics 2 5 9 show time This command displays the number of seconds since the module was last powered up or rebooted Example show time JI Show seconds since last power up 2 6 ACTION COMMANDS The action commands allow you to enter and exit command mode join networks etc Except where noted these commands do not have any parameters 2 6 1 You use this command to enter command mode You must type together quickly with no additional characters before or after You must not type a carriage return lt cr gt after the to enter command mode The module
2. This section describes a variety of advanced applications for the WiFly module Sec tions such as sending data using UDP associating with access points using the HTML client feature upgrading the firmware over FTP etc 4 1 SENDING DATA USING UDP UDP is a connectionless protocol there is no initial handshaking between the hosts to set up the UDP connection and the receiver does not send an acknowledgment when it receives UDP packets Therefore UDP is an unreliable protocol because there is no guarantee that the data will be delivered correctly However because it is connection less UDP is suited for applications that cannot tolerate too much latency but can toler ate some errors in the data e g video transmission To use UDP with the module you must enable the UDP protocol using the set ip proto 1 command You must also specify the remote host s IP address and the local and remote port number that you will use for UDP communications The following example shows the commands you use to enable UDP data transfer EXAMPLE 4 1 ASSOCIATE WITH A NETWORK set wlan ssid lt string gt JI Set the network name set wlan phrase lt string gt Set the passphrase for WPA and WPA2 modes EXAMPLE 4 2 SET UP THE PROTOCOL AND PORT NUMBER set ip proto 1 Enable UDP as the protocol set ip host lt address gt JI Set the remote host s IP address set ip remote lt va ue gt Set remote port on which host listens set
3. 2014 Microchip Technology Inc DS50002230A page 107 a WiFly Command Reference Advanced Features amp Applications User s Guide 9 Added a new command to resolve the DNS name during ping e ping d lt domain gt Resolves the domain name and ping e Example ping dgoogle com 10 Added the ability to allow for scanning networks on channel 13 and 14 11 In the scenario of multiple access points having the same SSID and passphrase added the ability to scan and pick the strongest access point during association process F 1 2 Bug Fixes Fixed a bug wherein the show rssi command would occasionally return 0dBm Fixed an issue wherein the scan command would return zero results in the first try Fixed an issue that would occasionally cause the module to watchdog reset during FTP firmware update process Fixed an issue that would occasionally cause ERR Malformed error message during FTP update process Fixed an issue in show connection command output wherein the prefix 8 was incremented in infrastructure mode This has now been fixed and the output is 8XXX Fixed an issue wherein the http request GET and POST parameters were being URL decoded too soon resulting in errors Fixed an issue where the leave command would not respond with the Deauth string over the UART Fixed an issue wherein in the module would occasionally get watchdog errors when configured in HTTP client mode Changed the default IP address of the module from 1 2
4. 3 Set TeraTerm s baud rate to 230400 and enable Hardware flow control as well 4 Enter the following WiFly command to enable xmodem mode xmodem lt option gt lt filename gt where lt option gt is u download firmware and set as boot image lt filename gt is the name of the firm ware img or mif file c clean the file system before performing firmware update over FTP or XMO DEM 1K protocol This will delete all the files on the Flash file system including user defined configuration files except the current boot image and the factory default boot image sector 2 Example xmodem cu wifly7 400 mif Once the command is entered you should see something like the following lt 4 40 gt xmodem cu wifly7 400 mif del 4 wifly EZx 405 del 5 config del 6 reboot del 8 logo png del 13 wps_app EZX 131 2014 Microchip Technology Inc DS50002230A page 85 WiFly Command Reference Advanced Features amp Applications User s Guide del 14 del 15 eap_app EZxX 105 web app EZX 112 del 16 web _config html del 17 link html xmodem ready lt 4 40 gt Note The module deletes all files from the Flash file system except the current boot image and the factory default boot image 5 Once you see xmodem ready on the UART proceed to the XMODEM file transfer option in Tera Term by selecting File gt Transfer gt XMODEM gt Send option FIGURE 4 6 lt L COM24 Tera Term VT Fi
5. Setting this timer to a lower value e g 10 seconds may result in frequent deauthen tications for client devices if they do not send data before the timer expires To disable the fmon timer set lt value gt to zero 0 The default is 3600 Example set wlan fmon 1000 JI Set the fmon timer to 1 000 seconds 3 1 2 5 ROUTE DATA BETWEEN CLIENTS AP mode supports routing between clients Clients can ping each other via the AP mod ule and can also send data to each other over TCP and UDP Note As of firmware version 4 40 routing data between clients is not supported when WPA2 PSK encryption is enabled 3 1 2 6 GPIO4 5 AND 6 ALTERNATIVE FUNCTIONS GPIO4 5 and 6 have alternative functions in soft AP mode as described in the advanced sections later in this document You enable the alternative functions using the following commands set sys iofunc 0x70 H Enables alternative functions DS50002230A page 50 2014 Microchip Technology Inc The link monitor feature must be enabled to turn on the alternative functions in soft AP mode only Table 3 2 shows the GPIO alternative functions TABLE 3 2 GPIO ALTERNATIVE FUNCTIONS GPIO Description GPIO4 High when the first client associates low when all clients leave the network GPIO5 WiFly module can drive it high to open a TCP connection to a stored host When the module drives GPIO5 low it closes the TCP connection GPIO6 WiFly module drives it high when a TC
6. idle Default 0 Example set comm idle 25 H Set the idle timer value to 25s 2 3 17 set comm match lt value gt lt hex gt This command sets the match character where lt value gt is a decimal number from 0 to 127 or a hex number from 0 to 7F When this configuration option is set the module sends an IP packet each time the match character appears in the data You enter lt value gt either as the decimal e g 13 or hex e g Oxd equivalent of the of the ASCII character Setting the match character to 0 disables matching A match character is one of three available methods you can use to control TCP IP packet forwarding The other methods are set comm size and set comm time For more information refer to Section 3 6 1 UART Receiver and RTS CTS Hardware Flow Control Default 0 Example set comm match 1 Set the match character to a carriage return 2 3 18 set comm size lt value gt This command sets the flush size in bytes where lt value gt is a decimal number from 0 to 1 420 at 9600 baud When this configuration option is set the module sends an IP packet each time lt value gt bytes are received Microchip recommends that you set this value as large as possible to maximize TCP IP performance 2014 Microchip Technology Inc DS50002230A page 17 WiFly Command Reference Advanced Features amp Applications User s Guide Flush size is one of three available methods you use to control TCP IP p
7. parameters You can verify the firmware image applications and associated files in the Flash mem ory using the Is command See Example 4 15 DS50002230A page 80 2014 Microchip Technology Inc EXAMPLE 4 15 LS COMMAND EXAMPLE OUTPUT lt 3 07 gt 1s FL SIZ FLAGS 2 83576 3 WiFly EZxX 2 45 23 L 10 config 25 85512 3 wifly EZxX 307 26 46624 3 wps_app EZX 131 27 66248 3 eap_app EZX 101 28 74280 3 web app EZX 105 29 37014 0 web config html 30 512 D link html EN 1609 0 logo png 149 Free Boot 25 Backup 2 lt 3 07 gt 4 5 2 Upgrading Firmware to Version 4 0 To update the firmware from a version lower than 4 0 follow this process 1 Update the firmware img file to version 4 xx using the command e ftp update wifly3 400 img For RN131 module e ftp update wifly7 400 img For RN171 module Reboot the module to boot into the new image NOTICE You MUST reset the module to factory default settings at this point using the factory RESET and reboot commands 2 Download the mif file using the command e ftp update wifly3 400 mif For RN131 module e ftp update wifly7 400 mif For RN171 module After the module downloads the mif file the module automatically reboots into the boot image with all of the associated files installed into the module s Flash memory Refer back to Table 4 3 for a description of these files You can verify the firmware image applications
8. MICROCHIP WiFly Command Reference Advanced Features and Applications User s Guide DS50002230A Note the following details of the code protection feature on Microchip devices Microchip products meet the specification contained 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 in 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 Microchip s 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 can 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 committed to continuously improving the code protection features of our products Attempts to break Microchip s code 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
9. To retrieve a file from the FTP server issue the ftp get lt filename gt command The mod ule prints the open string on the UART and the file begins transferring from the FTP server to the module When the file transfer complete the module prints the close string indicating the file is transferred and the FTP connection is closed EXAMPLE 4 18 RETRIEVE FILE FROM FTP SERVER ftp get demo txt JI Download the file demo txt from the II FTP server 4 7 FIRMWARE UPDATE OVER UART VIA XMODEM 1K PROTOCOL WiFly Firmware 4 40 and higher supports firmware updates via UART Firmware is downloaded to the module via the XMODEM 1K protocol Note The RN ISP is not required to update the firmware Prerequisites 1 Module running firmware version 4 40 or higher 2 Must have local copy of an img or mif firmware file The img always contain a single module firmware application The mif may contain module firmware and other application s such as web_app wps_app and or custom files 3 Software application capable of sending files over Serial Port via XMODEM 1K protocol e g TeraTerm 4 7 1 Example of updating firmware using Tera Term terminal application over XMODEM 1K protocol 1 Connect the module to the PC and open TeraTerm 2 To increase download speeds set the baud rate to 230400 by sending the WiFly commands set uart baud 230400 set baud rate to 230400 set uart flow 1 enable UART flow control save reboot
10. Version String with Date Code 26 Bytes Programmable Device ID Set with set option deviceid lt string gt 32 Bytes Boot Time in ms 2 Bytes Sensor 0 7 Voltage Readings Enabled with set opt format lt mask gt 16 Bytes Note To add sensor data to the UDP broadcast message you must enable the sensors using the sensor mask The set q sensor Oxff command enables all sensors 4 2 JOINING NETWORKS AND MAKING CONNECTIONS Configuring the module to make connections involves associating with an access point and opening a connection Before you can configure the module over the WiFi link you must associate the module with a network and program the network settings There fore the best method is to configure the module using the UART This section describes how to configure the module over the UART using the RS 232 connector or an evaluation board For this mode open a terminal emulator on the COM port asso ciated with the module The default baud rate is 9 600 8 bits and no parity 4 2 1 Associate with an Access Point From within the terminal window put the module into Command mode by typing The module responds with CMD indication that it is in Command mode Type show net to display the current network settings as shown in Figure 4 2 FIGURE 4 2 DISPLAY CURRENT NETWORK SETTINGS ow net SSid TheLoft Find all available networks with th
11. Bold characters A dialog button Click OK A tab Click the Power tab N Rnnnn A number in verilog format 4 b0010 2 hF 1 where N is the total number of digits R is the radix and n is a digit Text in angle brackets lt gt A key on the keyboard Press lt Enter gt lt F1 gt Courier New font Plain Courier New Sample source code define START Filenames autoexec bat File paths c mcc18 h Keywords _asm _endasm static Command line options Opa Opa Bit values 0 1 Constants OxFF A Italic Courier New A variable argument file o where file canbe any valid filename Square brackets Optional arguments mccl8 options file options Curly braces and pipe Choice of mutually exclusive errorlevel 0 1 character arguments an OR selection Ellipses Replaces repeated text var name var_name Represents code supplied by void main void user DS50002230A page 6 2014 Microchip Technology Inc Preface RECOMMENDED READING This user s guide describes how to configure the RN131 and RN171 modules The mod ule specific data sheets contain current information on the module specifications Other useful documents are listed below The following Microchip documents are available and recommended as supplemental reference resources RN131 G and RN131C 802 11 b g Wireless LAN Module Data Sheet This data sheet provides detailed specifications
12. Open WEP WPA PSK WPA2 PSK WPA Enterprise WPA2 Enterprise Code 0 1 2 4 6 8 DS50002230A page 66 2014 Microchip Technology Inc 3 7 2 UART Heartbeat Messages In firmware version 2 22 and higher the module can output UART heartbeat mes sages The bit mapped message is output periodically while the module is in Data mode and not connected to a remote host Messages are not output while in Command mode The heartbeat message encodes the module s state for the embedded micro processor Based on the heartbeat message the microprocessor can choose to change the configuration by going into Command mode To enable the UART heartbeat messages use the set sys printlvl 0x10 command The output of this mode is 8b30 8b30 8b30 Note For Soft AP mode the UART heartbeat message reflects the number of cli ent devices associated with the module In this case the number 8 in the output is incremented according to the number of devices currently associ ated to the soft AP network For example 81xx indicates no associated client devices 91xx indicates one associated client device a1xx indicates two associated client devices etc Table 3 16 shows the output bit format TABLE 3 16 OUTPUT BIT FORMAT Bit 15 14 13 12 11 8 7 6 3 0 RESERVED RESERVED Authentication TCP status 2 Access point Unused 0 13 Unused 1 OK 1 OK Idle mode i Connected 3 Ad hoc m
13. SIGS RE 29 TGP Connection iicr 58 TANSITIONS oo eee e cette eeeneeeeteeeesneeeeeeaeeeeeeaees 58 timer server port Setting 30 timer Server Setting 0 0 eee eeeeeeeceneeeeeeeeeeeteeeenes 30 Wl CN 57 timing values e cc ceeeeeece cee eeeeeeaeeeeeeseeeeeeeeenennaees 95 trigger wakeup Setting ccecceceeeeeeceeeeeeeeeeeeees 29 U UART b d SOTING reirse iiini iuiu 31 connect to Web server 76 display settings 0 0 eee ee eeeeeeeeeeeenteeeeenaes 38 Me lte EE 60 flow control Setting 0 ee eee eeeeeeeeeeeenneeeeees 31 GPIO10 TEE 33 heartbeat MESSAGES i n 66 instant baud change setting eee 32 mode Setting sisii iiics iii 32 posting data to web evample 79 raw setting esses vie eis 32 TX PIM SOUING EE 33 wake on ach 60 UDP auto pairing eee 70 DrOadCASE EE 70 Eia E EEE E E E TE 70 SONCING data aeie aeaee Eaa atat aaie 69 GE EE 58 UDP heartbeat 0 0 cece eeeeeeeeeeeeeeneeeeenaaes 15 16 port setting enzege n a di ana 16 secondary address 15 upgrade firmware pre version A D 81 TOVEMSION RE 81 using configuration web Server sssssessssssssseeeses 51 USING GPIOQ TEE 52 V VOM aiea e aieia a e aeieeiaii 39 view associated devices AP mode 50 voltage Sensor Dins sssnsessseinensssrerneeerrrn rs nrenn ee 25 WwW W kE ina Ra e o eet dE Ee E 56 Wake timen 2 ege eege EEN 57 wake On Sensor Input 59 wake on UART activity 0 ccccceceeeeeeeeeeeeeeeeee
14. Table 3 3 Note 1 Do not drive GPIOQ high upon power up Doing so invokes soft AP mode and does not launch the web server 2 Ifyou are using an evaluation kit GPIO9 is accessible using a jumper or push button 3 2 2 1 2 Invoke Configuration Web Server in Software If GPIOY is not accessible using a pushbutton or jumper an embedded microcontroller can invoke the configuration web server mode in software using the ASCII command run web_app This command runs the configuration web server application and cre ates an AP network to which devices can join and configure the WiFly module from a web browser 3 2 2 2 STATUS LEDs IN CONFIGURATION WEB SERVER MODE The status LEDs provide a visual indication of the WiFly module s state while you use the configuration web server feature See Table 3 4 TABLE 3 4 STATUS LEDS Event LED Action Launch AP mode Red green Blink alternately Yellow blue Off Client associated with the 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 DS50002230A page 52 2014 Microchip Technology Inc 3 2 3 Using the Web Server to Configure the Module This section describes how to use the web server to configure the WiFly module with the AP s SSID and passphrase The example uses the Internet Explorer web browser running on a Windows 7
15. The module scans for networks and displays a list of found networks Select your network from the Available Access Points list or type 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 AP s MAC address also called BSSID If you do not see your desired access point in the list click Refresh List to scan again 2014 Microchip Technology Inc DS50002230A page 53 WiFly Command Reference Advanced Features amp Applications User s Guide FIGURE 3 4 NETWORK CONFIGURATION TAB PY NOUN CTS Network Configuration Information Access Point Configuration Configuration parameters for joining a network Available Access Points l Press Refresh List button to populate Refresh List Access Point SSID roving Passphrase Network Configuration Configuration parameters for the network Note DHCP is recommended Use DHCP a Check to enable DHCP Save Configuration Exit Web Configuration App Display Advanced Tabs Note If your wireless network is hidden i e not broadcasting an SSID it does not display in the scan output In this case you must manually enter the SSID b Type your AP s security passphrase in the Passphrase box c Optional The module uses DHCP by default If you w
16. any data that is sent to the WiFly module over the UART is not processed You can monitor signals that indicate the module is ready to accept data as described in Table 3 7 TABLE 3 7 SIGNALS INDICATING THE MODULE CAN ACCEPT DATA Method Interface Description RTS transition RTS pin When the WiFly module wakes up the RTS pin goes high Once the module is ready the RTS pin is driven low You can monitor this pin with a microcontroller Monitor GPIO4 Alternative Set the alternative functions for GPIO4 GPIO5 and GPIO6 see GPIO functions Section 3 1 2 6 GPIO4 5 and 6 Alternative Functions When the module wakes up and connects to an access point GPIO4 goes high indicating the module is ready to receive data over the UART A microcontroller can moni tor GPIO4 Sensor power Sensor power pin power pin when it wakes from sleep indicating it is ready to accept data You can configure the module to output Vbat or 3 3V or 1 2V on the sensor After the module wakes you can open a TCP connection to a remote host in a number of ways as described in Table 3 8 You set the remote host using the following com mands set ip host lt address gt OR set dns name lt string gt set ip remote lt value gt H Sets the host s IP address OR URL Sets the port number on which the host II is listening save II Save the settings in the configuration II file reboot II Reboot the module so that the sett
17. driving this pin high dis ables it 13 GPIO13 Output Output This pin goes high on power up and goes low when the system is ready If hardware flow control is enabled this pin toggles to high to indicate the RX buffer is full 14 GPIO14 N A Input T 2014 Microchip Technology Inc DS50002230A page 27 WiFly Command Reference Advanced Features amp Applications User s Guide Note On the Wi Fi serial adapter RN 370 and the RN 174 evaluation board the blue LED is connected to GPIO7 The blue LED is NOT connected to GPIO7 on the RN 134 board It is not possible to power off the blue LED on the RN 134 board because it is connected directly to power For more details see Section 3 6 2 Setting GPIO Direction Alternate Functions and Disabling LEDs Note To set the GPIO pins as inputs or outputs instantly use the set sys mask 0xABCD 1 command which does not require a reboot Default 0x20F0 for RN131 0x21F0 for RN171 Example set sys mask 0x0 II Sets all pins as inputs 2 3 55 set sys printlvl lt value gt This command controls the debug print messages printed by the WiFly module on the UART where lt value gt is one of the values shown in Table 2 9 Refer to Section 3 7 Setting Debug Print Levels for more information TABLE 2 9 DEBUG PRINT MESSAGE SETTINGS Value Description 0 Quiet mode Messages are not printed when the module wakes up or powers up 1
18. n n DS50002230A page 74 2014 Microchip Technology Inc 4 4 2 Built In HTML Client Modes You can set up the module to post data to and get data from a web server automatically without an external host CPU You enable these advanced web features using the set opt format lt flag gt command where lt flag gt represents a bit mapped register Refer to Section 2 3 44 set opt format lt flag gt for the bit function descriptions Table 4 1 describes the wake reason values TABLE 4 1 WAKE REASON VALUES Value Wake Reason 0 Undefined 1 Power on or hardware reset battery install or power up 2 Sleep wake when the sleep timer is expired 3 Sensor 4 Undefined 5 Button RN370 serial adapter only 6 Software reboot 7 Watchdog EXAMPLE 4 10 HTML CLIENT MODES set option format 1 JI Automatically send HTML data header set option format 7 JI Append sensor data in ASCII hex II format set option format 11 JI Append all key value pairs to the sensor data 4 4 3 Connect to a Web Server Automatically You can configure the module to post data to a webserver automatically using the set sys auto lt va ue gt command where lt value gt is a decimal number representing sec onds For example you can configure the module to connect to the web server every 10 seconds with the set sys auto 10 command When HTTP mode is set the module automatically appends two linefee
19. ule pulls the time continuously every lt va ue gt minutes For example to configure the module to get time upon power up see the following example lt 2 23 gt set tim nable 1 AOK lt 2 23 gt get time ENA 1 ADDR 129 6 15 28 123 ZONE 7 To view a complete listing of the time variable use the following command lt 2 23 gt show t t Time 09 02 10 UpTime 653 s RTC 1293567548 Restarts 1 Wake 6 RAW 2345ab Note The RAW value is the 64 bit hex RAW value of the RTC which ticks at 32 768 Hz 3 9 TIME STAMPING PACKETS You can use the time stamping feature to append 8 bytes to a TCP or UDP packet auto matically The set ip flags 0x87 command enables the time stamp and keeps other default settings The time stamp bits from MSB to LSB are User s TCP or UDP packet data 63 56 55 48 47 40 39 32 31 24 23 16 15 8 7 0 The 8 bytes represents the 64 bit raw value of the real time clock register The data is appended before calculating the TCP checksum so that the data passes through the TCP stack correctly This register counts at 32 768 Hz If the timeserver function is enabled the RTC should accurately reflect the real time This register also counts when the module is in Sleep mode DS50002230A page 68 2014 Microchip Technology Inc WIFLY COMMAND REFERENCE ADVANCED MICROCHIP FEATURES amp APPLICATIONS USER S GUIDE Chapter 4 Advanced Applications
20. 0x25 II Sets the replacement character to 2014 Microchip Technology Inc DS50002230A page 23 WiFly Command Reference Advanced Features amp Applications User s Guide 2 3 46 set opt deviceid lt string gt This command sets the configurable device ID where lt string gt is up to 32 bytes long You can use lt string gt for serial numbers a product name or to show other device infor mation The module sends the device ID as part of the UDP broadcast hello packet You can view the device ID s current value with the get option or show deviceid com mands Default WiFly GSX Example set opt deviceid my_wifly H Sets the device ID to my_wifly 2 3 47 set opt password lt string gt This command sets the TCP connection password where lt string gt is up to 32 bytes long This setting provides minimal authentication by requiring any remote device that connects to the module to send and match the challenge lt string gt When a connection is opened the module sends the string PASS to the remote host The remote host must reply with the exact characters that match the stored password in one TCP packet otherwise the module closes the connection To disable the password feature use 0 the default Default no password required Example set opt password my_password II Sets the TCP connection password to H my_password 2 3 48 set opt average lt value gt This command sets the number of RSSI samples used
21. 1 command DS50002230A page 60 2014 Microchip Technology Inc It is possible to operate higher baud rates e greater than 115K without flow control if the packets are uniform and you use an application protocol to ensure that the packet data is delivered on the remote side before the next packet is sent However given the uncertainty of packet delays in a TCP IP network and the effects of interference and retries inherent in wireless networks flow control is typically required whenever large contiguous quantities of data are being written to the UART to ensure no data is lost 3 6 2 Setting GPIO Direction Alternate Functions and Disabling LEDs You control the GPIO pin direction and function using two commands e set sys mask e set sys iofunc 3 6 2 1 CONTROL GPIO DIRECTION WITH SET SYS MASK You can control the GPIO pin direction with the GPIO mask using the set sys mask lt value gt command where lt value gt is entered as a hex number The hex number rep resents a bitmask that controls each pin where 1 output and 0 input For example set sys mask 0x0 Sets all pins as inputs set sys mask 0xc0 H Set only GPIO6 and GPIO7 If you only need to set one bit in the mask you need to read mask and set the value Otherwise you will overwrite any previous GPIO settings The default mask for the RN131 module is 0x20f0 which sets GPIO13 GPIO7 GPIO6 GPIO5 and GPIO4 as outputs The default mask for the RN171 modul
22. 33 GRIO4 ee Ee Eeer ee Ree 30 AP MOG sieht cone thesl e aaea EES 50 GPIOS EE 30 73 AP MOG ariin a Geis 50 GPIOG twit da aes ee a i 30 73 AP IMOGG sacessecitcsccseeetgteasgueesteeceresiet ianei 50 GPIOS EE 29 GPIO9 invoking configuration web server 52 H hardware invoke configuration web Server ssec 52 hardware flow Control 60 heartbeat UART o Mieresunreso tepin eomrt enn edseet inisa 66 hello SUING EE 17 home NetWork asri a 87 HTML built in modes 00 cette cent eeeeeeeeeenaeeeeeeeeees 74 Client example sinisiin uirinn 78 79 CONNECH Io SEPVEN pciiini ioien ienei iiiaae 75 post binary data eener 76 post sensor data 77 retrieve data using client a ee ei HTTP client web server setting ceeeeeeeeeeees 23 l I O alternate functions eeeeee een 26 I O port direction setttng 27 ei 56 57 idle timer Setting 17 INDUS Sensor 89 Internet Address uv ene eee 7 IP address setting eee eeeeeeeeeeeeeneeeeeeeeeeeeeees 20 address setting backup ssssessssssesrersssrrreese 20 DHCP Setting vele Eege 20 display settings eee ce eeeeeeeeneeeeeeneeeeeeeees 38 gateway Setting 21 ee e WEE 21 local port Setting 22 netmask setting ne nesenrnnesrrrr nenene 22 Protocol SettiINg asean ena 22 remote port seitinmg ee ee eeneeeeeeteeenneeeees 22 El EE 22 TCP IP fUNCHIONS 0 ee eeeeeeeeeeeeneeeteeaeeeeeeeees 21 USING DACKUP vicsiciced Alabina ni iinkeah 74 J JOIN aea EE PEE Sl ee oe GEO sad
23. 6 3 close This command disconnects a TCP connection Example close H Close the TCP connection 2 6 4 exit This command exits command mode After leaving command mode the module res ponds with EXIT Example exit H Leave command mode 2 6 5 factory RESET This command loads the factory defaults into the module s RAM and writes the settings to the standard configuration file You must type the word RESET in capital letters After you type this command you must reboot the module for the settings to take effect Example factory RESET II Reset the configuration settings to the II factory defaults 2 6 6 join lt string gt This command instructs the WiFly module to join the network indicated by lt string gt If the network has security enabled you must first set the passphrase with the set wlan pass command prior to issuing the join command Note The lt string gt must not contain spaces If the network SSID contains spaces use a instead of the space e g MY NETWORK to represent My Network Default Not applicable Example To join an unsecure network join roving1 JI Join the network roving1 To join a secure network set wlan pass rubygirl JI Set the password to rubygirl join roving1 JI Join the network roving1 DS50002230A page 42 2014 Microchip Technology Inc 2 6 7 join lt value gt Use this command to join a network that is shown in the scan list where lt value gt is the entry number l
24. 86400 for soft AP mode only 0 0 0 0 Firmware only wifly GSX lt version gt img RN131 wifly EZX lt version gt img RN171 Firmware and applications wifly3 lt version gt mif RN131 wifly7 lt version gt mif RN171 roving Pass123 2014 Microchip Technology Inc DS50002230A page 91 WiFly Command Reference Advanced Features amp Applications User s Guide Dir Timeout FTP_mode A 6 IP PARAMETERS DHCP IP address Net mask Local port Gateway Host Remote port Protocol MTU Flags TCP mode Backup A 7 OPTIONAL PARAMETERS Device ID Join timer WPA timer Replacement char Format Password Signal Average A8 SYSTEM PARAMETERS Sleep timer Wake timer Trigger Auto connect lOfunc lIOmask lOvalue Print level Debug Register LaunchString A 9 TIME SERVER PARAMETERS Enable Server address Zone A 10 UART PARAMETERS Baudrate Flow Mode Cmd_GPIO public 200 0x0 ON 1 enabled 0 0 0 0 255 255 255 0 2000 0 0 0 0 0 0 0 0 2000 2 TCP server and client 1524 0x7 0x0 0 0 0 0 WiFly GSX 1000 0x24 0x00 no password enforced 5 0 0 0x1 SENSO pin wakes up the device 0 0x0 No alternate functions 0x20F0 for RN131 0x21F0 for RN171 0x0 0x1 Print enabled 0x0 Unused parameter for future development Leave at default value web_app 0 disabled 64 90 182 55 fixed to port 123 SNTP protocol 7 Pacific time USA 9600
25. AP mode wherein the scan command would not work the first time Added stability to the FTP client mode F 3 VERSION 4 0 3 27 13 F 3 1 Features Added support for Multiple Image Format mif files to download multiple images This new file format contains the firmware image applications such as WPS EAP web server and supporting page files The firmware image supports unpacking the files contained in the mif package Added a secondary UDP broadcast packet to send the UDP discovery message to a secondary server The size of the secondary packet is 120 bytes 110 bytes of primary broadcast 6 byte module s MAC address 4 byte module s IP address Added a new link monitor variable for soft AP mode It is configurable via the set wlan fmon lt seconds gt command Added a new configuration web server application onto the module for provision ing configuring the module to join an infrastructure network Added a new command to launch soft AP mode network apmode lt bssid gt lt channel gt Added a new command to launch different applications when GPIO 9 is driven high set system launch_string lt string gt Examples e set sys launch_string web_app H Launches web server default set sys launch_string wps_app H Launches WPS app set sys launch_string eap_app H Launches EAP app e Added the command run lt string gt to launch individual applications Example run wps Deprecated the wps command 2014 Microchip Tech
26. Airlink 101 Apple Airport express Buffalo networks Belkin F7D3302 v1 0 Asus RT N16 TPLink TL WR741ND SMC SMCWBR14S N4 DYNEX DX WGRTR Ad hoc mode Apple iPhone Microsoft Windows PC with XP Vista Ubuntu Linux Microchip currently does not support WPA2 Enterprise radius server authentication EAP TLS 2014 Microchip Technology Inc DS50002230A page 97 WiFly Command Reference Advanced Features amp Applications User s Guide NOTES DS50002230A page 98 2014 Microchip Technology Inc MICROCHIP WIFLY COMMAND REFERENCE ADVANCED FEATURES amp APPLICATIONS USER S GUIDE Appendix D Command Quick Reference Guide Table D 1 through Table D 5 provide a listing of all available commands and their defaults For more detailed information refer to Chapter 2 Command Reference TABLE D 1 SET COMMAND LIST SHEET 1 OF 4 Command Default Description set apmode beacon lt value gt 102 Sets the apmode beacon interval in milliseconds set apmode link monitor 3600 This command is used in soft AP mode to detect if the individ lt value gt ual client devices are active and in range of the module set apmode passphrase NULL This command sets the soft AP mode passphrase to be used lt string gt for WPA2 AES encryption set apmode probe lt value gt 5 Sets the apmode probe timeout in seconds apmode mode only set apmode reboot lt va
27. By default the module sends 1 packet The optional lt va ue gt sends lt value gt pings at 10 per second TABLE 2 17 PING COMMAND PARAMETER OPTIONS Option Description g This option pings the gateway The gateway IP address is loaded if DHCP is turned on otherwise you must set it using the set ip gateway lt address gt command h This option pings the stored host IP address You can set the host IP address using the set ip host lt address gt command i This option pings a known Internet server www neelum com by first resolving the URL This option is useful to demonstrate that DNS is working and that the device has Internet connectivity 0 This option terminates a previously issued ping command lt address gt Ping a remote host where lt address gt is an IP address in the form lt value gt lt value gt lt value gt lt value gt with lt value gt being a number between 0 and 255 Default 1 packet Example ping 10 20 20 12 10 H Ping 10 20 20 12 10 times 2014 Microchip Technology Inc DS50002230A page 43 WiFly Command Reference Advanced Features amp Applications User s Guide 2 6 12 ping d lt domain gt This command uses Domain Name Service DNS to resolve the domain name during ping Default NULL Example ping dgoogle com I Resolves google com to an IP address and pings 2 6 13 reboot This command forces the module to reboot similar to a power cycle Ex
28. DS50002230A page 119 MICROCHIP AMERICAS Corporate Office 2355 West Chandler Blvd Chandler AZ 85224 6199 Tel 480 792 7200 Fax 480 792 7277 Technical Support http Awww microchip com support Web Address www microchip com Atlanta Duluth GA Tel 678 957 9614 Fax 678 957 1455 Austin TX Tel 512 257 3370 Boston Westborough MA Tel 774 760 0087 Fax 774 760 0088 Chicago Itasca IL Tel 630 285 0071 Fax 630 285 0075 Cleveland Independence OH Tel 216 447 0464 Fax 216 447 0643 Dallas Addison TX Tel 972 818 7423 Fax 972 818 2924 Detroit Novi MI Tel 248 848 4000 Houston TX Tel 281 894 5983 Indianapolis Noblesville IN Tel 317 773 8323 Fax 317 773 5453 Los Angeles Mission Viejo CA Tel 949 462 9523 Fax 949 462 9608 New York NY Tel 631 435 6000 San Jose CA Tel 408 735 9110 Canada Toronto Tel 905 673 0699 Fax 905 673 6509 DS50002230A page 120 Worldwide Sales and Service ASIA PACIFIC Asia Pacific Office Suites 3707 14 37th Floor Tower 6 The Gateway Harbour City Kowloon Hong Kong Tel 852 2401 1200 Fax 852 2401 3431 Australia Sydney Tel 61 2 9868 6733 Fax 61 2 9868 6755 China Beijing Tel 86 10 8569 7000 Fax 86 10 8528 2104 China Chengdu Tel 86 28 8665 5511 Fax 86 28 8665 7889 China Chongqing Tel 86 23 8980 9588 Fax 86 23 8980 9500 China Hangzhou Tel 86 571 2819 3187 Fax 86 571 2819 3189 China Ho
29. Print all status messages 2 Print only critical network access point connection level status e g Associated or Disconnect from lt SS D gt 4 Print the DHCP and IP address status information After you have verified the module s configuration you can turn off this option so that the messages do not interfere with the data 0x4000 Change the scan format output to an MCU friendly format 0x10 Enables the UART heartbeat message See Section 3 7 2 UART Heartbeat Messages for more details Default 0x1 Example set sys printlvl 2 H Sets the debug print messages to only II critical network connection status 2 3 56 set sys output lt mask gt lt mask gt This command sets the output GPIO pins high or low where lt mask gt is a hex number referring to a bit mapped register The optional lt mask gt sets a subset of the pins Default None Example To toggle GPIO8 use the following commands set sys mask 0x21f0 JI Set GPIO8 as output set sys output 0x0100 0x0100 Drives GPIO8 high set sys output 0x0000 0x0100 Drives GPIO8 low DS50002230A page 28 2014 Microchip Technology Inc 2 3 57 set sys sleep lt value gt This command sets the sleep timer where lt va ue gt is a decimal number The sleep timer is the time in seconds after which the module goes to sleep This timer is dis abled during an open TCP connection When the TCP connection is closed the module counts down an
30. Sets the local port to 1025 2 3 39 setip netmask lt address gt This command sets the network mask where lt address gt is an IP address in the form lt value gt lt value gt lt value gt lt value gt with lt value gt being a number between 0 and 255 If DHCP is turned on the netmask is assigned and overwritten when the module associ ates with the access point Default 255 255 255 0 Example set ip netmask 255 255 0 0 H Sets the netmask to 255 255 0 0 2 3 40 set ip protocol lt flag gt This command sets the IP protocol where lt flag gt is a bit mapped register as shown in Figure 2 2 To be able to connect to the WiFly module over TCP IP for example using telnet you must set bit 2 of the IP protocol register for the module to accept both TCP and UDP set bits 1 and 2 value 3 FIGURE 2 2 SET IP PROTOCOL COMMAND BIT MAPPED REGISTER 4 3 2 1 0 L upr TCP server and client default Secure mode only receive packets form an IP address that matches the stored host IP TCP client only HTTP client mode Default 2 Example set ip protocol 18 II Enables TCP and HTTP client mode 2 3 41 setip remote lt va ue gt This command sets the remote host port number where lt va ue gt is a decimal number representing the port Default 2000 Example set ip remote 1025 H Sets the remote host port to 1025 2 3 42 set ip tcp mode lt mask gt This command controls the
31. Technology Incorporated in the U S A Silicon Storage Technology is a registered trademark of Microchip Technology Inc in other countries Analog for the Digital Age Application Maestro BodyCom chipK IT chipKIT logo CodeGuard dsPICDEM dsPICDEM net dsPICworks dsSPEAK ECAN ECONOMONITOR FanSense HI TIDE In Circuit Serial Programming ICSP Mindi MiWi MPASM MPF MPLAB Certified logo MPLIB MPLINK mTouch Omniscient Code Generation PICC PICC 18 PICDEM PICDEM net DICK PICtail REAL ICE rfLAB Select Mode SQI Serial Quad I O Total Endurance TSHARC UniWinDriver WiperLock ZENA and Z Scale 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 GestIC and ULPP are registered trademarks of Microchip Technology Germany II GmbH amp Co KG a subsidiary of Microchip Technology Inc in other countries All other trademarks mentioned herein are property of their respective companies 2014 Microchip Technology Incorporated Printed in the U S A All Rights Reserved A Printed on recycled paper ISBN 9781620778418 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 MCU
32. Using the run wps command in the console e Using GPIO9 To invoke a WPS function using the ad hoc factory reset GPIO9 mode 1 Enable the WPS function on GPIO9 using the set sys launch wps_app com mand WPS on GPIO9 is disabled by default to avoid accidentally invoking the WPS function 2 The WPS application is invoked when GPIO9Y goes from low to high You can enable this mode on the RN134 and RN174 boards by installing and removing the ad hoc factory reset jumper or by pushing the board s FN button When the WPS application launches it negotiates the SSID and passphrase with the AP and reboots the module to associate with the WPS enabled access point Note If GPIO9Q is high the module boots in Ad Hoc or Soft AP mode depending on the firmware version Care must be taken to drive GPIO9 low before the module reboots A good indicator is the red LED on the RN134 and RN174 boards When this LED flashes indicating the module is scanning for a WPS enabled access point you should drive GPIO9 low By default during the WPS process the module prints messages on the UART as it scans channels detects access points and tries to complete WPS You can disable these messages using the set sys print 0 command Eh DS50002230A page 88 2014 Microchip Technology Inc 4 8 2 Status LEDs during WPS Process In WPS mode the LEDs indicate activity The red LED flashes while the module is scanning for WPS enabled access points
33. WPS Mode MAC Address SSID Mode Where Field Value Index 2 character decimal Channel 2 character decimal RSSI 2 character decimal negative number Security mode 2 bytes see Table 3 12 Capabilities Bit mapped 4 hex bytes see Table 3 13 WPA Configuration Bit mapped 2 hex bytes see Table 3 14 WPS Mode Bit mapped 2 hex bytes see Table 3 12 MAC address Address SSID Up to 32 chars Note The string END is added at the end of the scan data Figure 3 10 shows an example of the output format FIGURE 3 10 SCAN OUTPUT FORMAT FIRMWARE VERSION 2 36 AND 2 45 SCAN Found 3 01 01 59 04 1104 28 c0 20 4e 7f 08 df 85 dad rules 02 03 64 02 1104 28 00 00 30 bd 96 49 22 basement 03 10 71 04 3100 28 00 90 27 e4 5d fc a7 URSOMONEY END Table 3 12 shows the security modes TABLE 3 12 SECURITY MODES Number Description OPEN WEP 64 or 128 WPA1 MIXED WPA2 Enterprise WEP Enterprise WPA1 Enterprise WPA mixed Enterprise WPA2 Enterprise NO security CH OlOoirdiOiOl RR Ww hm gt 2014 Microchip Technology Inc DS50002230A page 65 WiFly Command Reference Advanced Features amp Applications User s Guide Table 3 13 describes the capabilities bit mask values TABLE 3 13 CAPABILITIES BIT MASK VALUES Bit Mask Value Description 0004 Short slot
34. associate AP assesses a toe ee ala eats 71 Set sys IAUNCH_SUING En 26 auto pairing UDP 70 USINO EE 51 auto WAKE Omer 30 connect to module in AP Mode ss sees eecteeee teens 49 AUtO CONNECE mer 25 26 connection AUTO CONNECE Dmere o 57 AULOMARIC 00 eeeeceeeeceteeeteeseteeeensesenseeeneeeeneeeenees 73 auto join feature ascosccessesceaciecentacaterecgeacsceaechoenaascnele 47 display status En 39 Automatic CONNECTIONS o 73 MaKNg E 72 OPC EE 72 B TUMOR EE 58 AUC Ne 32 LOST E 84 bit mapped register to WED Server oo cecccccecceceececeeeeeeeeeeeeeseeeeeestaeaeaes 75 IP MAGS EE 21 connections IP PrOtOCOl EE 22 ul NEE 71 Ip tep MOde EE 23 Controlling Connechons eee eeeeteeeeeeeeeeneeeeeeeees 63 2014 Microchip Technology Inc DS50002230A page 113 WiFly Command Reference Advanced Features and Applications User s Guide GUS Pin EE 31 Customer Notification Service ee eeeeesneeeeeees 7 Customer Support 8 D debug messages 28 debug print levels 0 eceececeeececeeeeeeeeeeeeeeeeeeeeaees 64 debug print message re srerr renere 28 GEDUGGING E 64 default AP mode settings ceeceeseeeeeeeeeeeees 48 default Configuration ec eeeeeeeeeeeeeeeeteteeeeeeeees 91 del a tava nee aetna aie 45 device ID settinmg neee eeseeeossren netere nesse 24 DHCP modee iinne 20 display all SettiNGS EE 38 analog pin value 40 battery voltage vacii menenie 39 broadcast settings 2 37 communication set
35. client mode to get and put files to an FTP server Files retrieved from the server are sent over the UART and files created from the UART are stored on the FTP server A new scan output format is implemented in addition to the default output format This new microprocessor friendly format makes string processing of the scan out put very easy A new UART heartbeat feature is implemented to notify the embedded micropro cessor of the state of the WiFly module The heartbeat message is sent over the UART when the WiFly module is in data mode and not connected to any remote host Fixed a bug in the set uart instant lt value gt command wherein the WiFly module would not return an AOK over telnet Now when this command is issued it returns an AOK over telnet and does not exit command mode Enabled scanning for wireless networks remotely when in ad hoc mode When the scan command is issued ad hoc is temporarily disabled and results of the scan are sent over telnet The behavior of the auto connect timer has changed Added the ability to set RTC from console Added a feature wherein the module can be put to sleep using GPIO8 F 8 VERSION 2 21 07 11 2010 e The firmware checksum the image and compare to the stored values in the file now before committing it to flash and updating the boot record after download If the checksum fails firmware prints UPDATE FAILED and deletes the image 2014 Microchip Technology Inc DS50002230A pag
36. comm parameters optimize Wi Fi performance by specifying when the system sends IP packets To min imize latency and TCP IP overhead use the flush size or match character to send data in a single IP packet In most cases you should set the flush timer to a large number to avoid fragmentation For high throughput increase the UART baud rate set the flush size to 1 460 and set the flush timer to a large value so that full IP packets are sent You can control packet forwarding in the following ways e set comm match lt value gt sets the value of the packet terminator Each time the module sees the match character it sends an IP packet For example set comm match Oxd forwards a packet when the module sees a Oxd hex character set comm size lt value gt sets the flush size where lt va ue gt is the number of bytes received before forwarding The maximum is 1 460 bytes which is the size of a single Ethernet frame set comm time lt val ue gt sets the flush timer which is used to flush any partial data sitting in the RX buffer if no additional data is received for lt value gt ms For example the set comm time 1000 command causes the module to wait for 1 second after no data was sent If the module will be sending more than a few hundred thousand bytes in a single trans action you should enable hardware flow control Your hardware must actively monitor the CTS pin Flow control is not enabled by default you set it with the set uart flow
37. command mode Once in command mode you can configure the WiFly device using simple ASCII commands each command ends with a carriage return lt cr gt Most valid commands return AOK invalid ones return an ERR description To exit command mode send exit lt cr gt The module responds with EXIT indicating that it has exited command mode and entered data mode Note There is a 250 ms time buffer before and after the escape sequence If characters are sent before or after the escape sequence within this 250 ms interval the WiFly module treats them as data and passes them over the TCP or UDP socket and the module will not enter command mode You can view various parameters such as the SSID channel IP address serial port and other settings and configure them in command mode You send commands to the module through the UART or remotely via telnet When using the UART interface the communications settings should match the WiFly module s stored settings The default DS50002230A page 10 2014 Microchip Technology Inc is 9 600 baud 8 bits no parity 1 stop bit and hardware flow control disabled You can enter command mode locally over the UART interface at any time irrespective of an active TCP connection Note Microchip suggests using either the TeraTerm Windows OS or CoolTerm Mac OS X terminal emulator program When the WiFly module powers up it attempts to auto associate with the access point stored i
38. files Default NULL Example xmodem cupdate wifly7 440 mif H Clean file system and upload JI wifly7 440 mif firmware over UART DS50002230A page 46 2014 Microchip Technology Inc WIFLY COMMAND REFERENCE ADVANCED MICROCHIP FEATURES amp APPLICATIONS USER S GUIDE Chapter 3 Advanced Features and Settings This chapter describes the WiFly module s advanced features including techniques to put the module to sleep wake up and methods to open a TCP connection when awake It also describes the UART flow control alternative GPIO functions and the real time clock 3 1 ACCESS POINT AP MODE WiFly modules support several methods for accessing Wi Fi networks In addition to Infrastructure mode and Ad Hoc mode in firmware version 2 45 the modules support Access Point AP mode You implement AP mode using special firmware In the future AP mode will be released as part of the standard firmware and will replace Ad Hoc mode AP mode provides several advantages over Ad Hoc mode In AP mode e The module creates a soft AP network to which Android devices smartphones and tablets can join Android devices do not support ad hoc networking The module runs a DHCP server and issues IP addresses to seven clients which is much faster than automatic IP in Ad Hoc mode The WiFly module will support security in future releases unlike ad hoc which is an open mode The module supports routing between clients Note In firmware
39. firmware and configuration files Use the Is command to view files The file size is displayed in sectors and the active boot image is identified in the final message For example FL SIZ FLAGS 11 18 3 WiFly GSX 2 21 29 ik 10 config 190 Free Boot 11 Backup 0 You can store multiple firmware images and configuration files Note The module s Flash file system only is used to store firmware and configu ration files Currently the file system cannot be used to store data files The module contains a built in FTP client for downloading files and updating the firm ware The client uses passive mode FTP which allows operation through firewalls and the Internet To connect to Microchip to obtain the latest released firmware use the set tings shown in Table 4 2 2014 Microchip Technology Inc DS50002230A page 79 WiFly Command Reference Advanced Features amp Applications User s Guide TABLE 4 2 FTP SETTINGS Setting Description FTP server rn microchip com set FTP server using the set dns backup lt string gt com mand FTP username roving FTP password Pass123 FTP filename Refer to the following sections for the filename used in different versions of firmware FTP directory public this parameter cannot be modified Note Before using FTP to upgrade the firmware the module must first be asso ciated with an access point that is connected to the Internet 4 5 1 Upgrading with Mu
40. for the RN131 module RN171 802 11 b g Wireless LAN Module Data Sheet This data sheet provides detailed specifications for the RN171 module Lab Manual for RN 174 Evaluation Board This lab manual provides instruction on configuring WiFly modules The manual uses the RN 174 evaluation board which contains the RN171 module to demonstrate a variety of applications To obtain any of these documents visit the Microchip web site at www microchip com 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 Data sheets and errata application notes and sample programs design resources user s guides and hardware support documents latest software releases and archived software General Technical Support Frequently Asked Questions FAQs technical support requests online discussion groups Microchip consultant program member listing Business of Microchip Product selector and ordering guides latest Microchip press releases listing of seminars and events listings of Microchip sales offices distributors and factory representatives DEVELOPMENT SYSTEMS CUSTOMER CHANGE NOTIFICATION SERVICE Microchip s customer notification service helps keep customers current on Microchip p
41. host IP address and port when GPIO5 is driven high and disconnects when driven low You can monitor the TCP IP connection status by reading GPIO6 it is high when connected and low when not connected To configure the module to connect using GPIO5 and GPIO6 use the following com mands set ip host lt address gt Set the IP address of the remote host set ip remote lt value gt H Set the IP port of the remote host set sys iofunc 0x70 Set alternate function for GPIO4 6 save H Store configuration reboot H Reboot the module After executing these commands run your application or other software on the remote host that opens and listens on the specified port Then connect GPIO5 to your embed ded processor or other control signal When GPIO5 is driven high the module attempts to connect When GPIO05 is driven low the connection is closed Note Donotto drive the GPIO pin with more than 3 3V DC or permanent damage to the module will occur If the connection to the remote host is successful GPIO6 goes high If you have set the COMM OPEN and REMOTE strings the UART displays OPEN and the remote host displays HELLO Figure 3 9 shows the process of controlling connection with the GPIO pins FIGURE 3 9 CONTROLLING CONNECTIONS WITH THE GPIO PINS Embedded WiFly Microprocessor Module This signal instructs the microprocessor that Event The WiFly module is associated with drives GPIOS low it is OK to open a TCP connect
42. ip local lt va ue gt Set port number on which module listens save JI Save settings in the configuration file reboot JI Reboot the module Note If you attempt to send data by typing characters on the keyboard or if your microcontroller is not sending data fast enough the module sends out packets with fewer data bytes To avoid this issue set the flush timer to a higher value By default it is set to 10 ms You can disable forwarding based on the flush timer set comm time 0 or set it to a higher value leg set comm time 2000 Because UDP is a connectionless protocol data begins flowing as soon as you reboot the module Unlike TCP you do not need to send an open command to establish the connection The module acts like a data pipe the UART data is sent over the Wi Fi link via the UDP protocol in this case and the data coming from the Wi Fi link via UDP protocol in this case is sent to the UART 2014 Microchip Technology Inc DS50002230A page 69 WiFly Command Reference Advanced Features amp Applications User s Guide 4 1 1 UDP Auto Pairing With the UDP auto pairing feature the module temporarily stores the host IP address of the first remote device that sends a UDP packet to the module This host IP address is stored in the module s RAM which is cleared when the module sleeps or power cycles This feature allows the module to echo to any client that sends a UDP packet EXAMPLE 4 3 TURN ON AUTO PA
43. lt char gt This command displays the IP address and port number settings where lt char gt is the optional parameter a Using lt char gt returns the current IP address Example getipa H Display the current IP address 2 4 8 get mac This command displays the device s MAC address Example get mac H Show the MAC address 2 4 9 get option This command displays the optional settings such as the device ID Example get option H Show the optional settings 2 4 10 get sys This command displays the system settings sleep and wake timers etc Example get sys H Show the system settings 2 4 11 get time This command displays the time server UDP address and port number Example get time H Show the time server information 2 4 12 get wlan This command displays the SSID channel and other WLAN settings Example get wlan II Show the WLAN settings 2 4 13 get uart This command displays the UART settings Example get uart H Show the UART settings DS50002230A page 38 2014 Microchip Technology Inc 2 4 14 ver The command displays the firmware version Example ver JI Show the firmware version 2 5 STATUS COMMANDS These commands begin with the keyword show and they return the current values of the system variables In some cases e g IP addresses the current values are received from the network and may not match the stored values Except where noted the show commands do not have any parameters 2 5 1 show battery Thi
44. milliseconds where lt value gt is a decimal number from 0 to 65 436 Default 102 Example set apmode beacon 120 II Beacons are sent every 120 ms 2 3 2 set apmode probe lt value gt This command sets the apmode probe timeout in seconds where lt va ue gt is the num ber of seconds The probe timeout is the number of seconds the module waits for probe responses before declaring APMODE is lost and disabling the network interface Default 5 Example set apmode probe 80 H Sets the apmode probe timeout to 80 ms 2 3 3 set apmode reboot lt va ue gt This command sets the reboot timer to reboot the module periodically every lt value gt seconds Note 1 lt va ue gt must be greater than 60 secs To enable the automatic reboot feature the reboot timer must be used in conjunction with the debug reg ister set system debug 0x80 Default 0 Example set apmode reboot 600 H Sets the reboot timer to 600 seconds DS50002230A page 14 2014 Microchip Technology Inc 2 3 4 set apmode link_monitor lt value gt This command is used in soft AP mode to detect if the individual client devices are active and in range of the module This command sets the soft AP mode link monitor timeout threshold for the associated client device where lt value gt is a decimal number representing the number of seconds of client inactivity i e no data received from the client device When this timer expires the module deauthe
45. none no parity Figure 2 6 shows the bit mapped register FIGURE 2 6 SET UART FLOW BIT MAPPED REGISTER 7654 3210 olo ofofo Flow control 0 Disabled L Parity 1 Enabled 00 None 01 Illegal 10 Even 11 Odd Note Once flow control is enabled it is important to drive the CTS pin properly i e active low enabled If CTS is high the module does NOT send data through the UART and further configuration in command mode is problem atic because no response is received Default 0 Example set uart flow 0x21 JI Even parity with flow control set uart flow 0x20 H Even parity without flow set uart flow 0x31 JI Odd parity with flow control set uart flow 0x30 JI Odd parity without flow control 2014 Microchip Technology Inc DS50002230A page 31 WiFly Command Reference Advanced Features amp Applications User s Guide 2 3 67 set uart instant lt value gt This command immediately changes the baud rate where lt value gt is 2400 4800 9600 19200 38400 57600 115200 or 230400 This command is useful when testing baud rate settings or when switching the baud rate on the fly while connected over TCP via telnet Using this command does not affect configuration The module returns the AOK response and then the module exits command mode Note In firmware version 2 22 and lower the module does NOT return an AOK over telnet before exiting com
46. replies with CMD to indicate it is in command mode There is a 250 ms buffer before and after the escape sequence If characters are sent before or after the escape sequence within this 250 ms interval the WiFly module treats them as data and passes them over the TCP or UDP socket and the module will not enter command mode If you want to use different characters to enter command mode not you can set the character to use with the set comm lt char gt command Example H Enter command mode 2014 Microchip Technology Inc DS50002230A page 41 WiFly Command Reference Advanced Features amp Applications User s Guide 2 6 2 apmode lt bssid gt lt channel gt This command creates a custom soft AP network where lt bssid gt is the broadcast SSID and the lt channel gt is the channel on which the soft AP network is created The lt bssid gt and lt channe gt parameters are optional If no parameters are specified the module e Uses the string stored with the set opt device_id lt string gt command and appends xy where xy is the last byte of the module s MAC address as the SSID e Creates the soft AP network on channel 1 Note This command does not survive power cycling After a power cycle the module behaves according to the wireless join policy determined by the set wlan join lt va ue gt command Example apmode MyNetwork 11 H Creates a soft AP network on channel JI 11 with SSID MyNetwork 2
47. tah 42 lut EE 43 JOIN TIMED sere corse cl dats eens een E 23 JOIN NetWork iien pi a eines 71 K known issues Trmmware 105 L last device connected in AP mode sesccceee 49 launch web application 26 WPS application 26 launching WPS application ccceeeeeeeeeeees 88 EE 43 LEDs configuration Web ener 52 Gis8able vite hae a es 61 WPS Status cscssedt eseseh tee esk figed ia 89 l le ION Hossien ireid iiiad iieii 35 link monitor AP mode ccccccceeseeeeeseseeeeeeeeeeees 50 LINKSYS secede ieee hain ieee shee ie eres 97 ee WEE 45 load configuration le 45 Ikea 43 EE 45 M MAC display settngs ne errrr reesen making connections cccceceeeeeeeeeeeeeeeeeteees match character setting Microchip Internet Web Site 0 eeceeeseeeeeeeeeees 7 module accepting data 57 connect to remote host seenen 57 disconnect from AP eeeceeeeeeeeeeeneeeesneeeeenaes 43 factory Tesettur ee oes nseri iE 42 le A4 ELE O E E E E gedet 56 Waka mia ili oo Glee cn 56 Module Configuration ab 55 N Netgear senean iea E a aaan EES 97 Network Configuration ob 53 network status show 39 network EE 42 network JOINING ssri niigantsrsniitiritneiai arenei piaa ineine 71 0 ODEN EE 43 Open CONNECTION 22 ce cece cee eeeeeeeeceeeeeeeeeeeeeeeeeenaeees 72 OPS SUMING EE 17 optional settings display AA 38 P packets time stamping 68 party eee eee ae a i D ssphtraee cece eceecceeeece
48. the FTP server it can create files on the FTP server To create a file you use the ftp put lt filename gt command where lt file name gt is up to 64 bytes This command creates a file on the FTP server with the name lt filename gt and prints the open string on the UART By default the open string is OPEN After you see OPEN on the UART you can begin writing data in to the file There are two options to close the file Send the close string which is CLOS by default e Use the FTP close timer with the command set ftp timer lt va ue gt Once you finish writing to the file this timer begins counting down and closes the file when the timer gets to zero The timer is one eighth of lt va ue gt For example to set a 5 sec ond timer the command is set ftp timer 40 The open and close stings are configurable using the following commands set comm open lt string gt H Set the open string set comm close lt string gt H Set the close string EXAMPLE 4 17 PUT FILE ON FTP SERVER ftp put demo txt JI Upload the file demo txt set ftp timer 40 JI Close the connection 5 seconds after H file uploads 4 6 3 Retrieving Files from the FTP Server The module can retrieve files from the FTP server The retrieved file is not stored in module s Flash memory the module acts as a transporter and passes the file over the UART interface as the file is being transferred DS50002230A page 84 2014 Microchip Technology Inc
49. the GET string DS50002230A page 78 2014 Microchip Technology Inc 4 4 8 HTML Client Example Posting UART Data to a Web server The module can post serial UART data in ASCII or binary format automatically In this example when the serial UART data comes in the module connects and sends data to the web server in the following format GET server php value lt user serial data gt n n Use the following commands to set the parameters set ip proto 18 Turn on HTTP mode 0x10 and TCP H mode 0x2 set dns name www rovingnetworks com Set the web server name set ip host 0 Turn on DNS set ip remote 80 H Set the web server port 80 is standard set com remote GET server3 php value H Set up the server application string set sys auto 10 H Automatically connect every H 10 seconds set option format 1 H Send a HTML header set uart mode 2 H Connect automatically using data trigger mode save H Save the configuration to the H configuration file reboot II Reboot so that the settings take effect With these settings enabled the module connects to the web server every time it receives data on the RX line Serial data is sent to the host web server according to the flush timer and the flush size Note You cannot append the sampled sensor data to the UART data Enabling option format 7 with set uart mode 2 results in erroneous data 4 5 UPGRADING FIRMWARE VIA FTP The module has a file system for storing
50. 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 IDE on line help Select the Help menu and then Topics to open a list of available on line help files INTRODUCTION This preface contains general information that will be useful to know before using the RN131 and RN171 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 user s guide provides information for configuring WiFly modules including a command reference advanced features and applications The document is organized as follows Chapter 1 Introduction This chapter introduces the RN131 and RN171 modules and provides a brief overview of their features Chapter 2 Command Reference This chapter provides information on the commands used to configure WiFly modules and gives examples Chapter 3 Advanced Features and Settings This chapter describes advanced features including techniques to put the WiFly module to sleep wake up and methods to open a TCP connection when awake Chapter 4 Advanced Applications This chapter describes advanced applications for the WiFly module such as sending data using UDP associat
51. time 0100 ESS Infrastructure mode 0200 IBSS Ad Hoc mode 1000 Privacy secure with WEP or WPA 2000 Short preamble Table 3 14 describes the WPA bit mask values TABLE 3 14 WPA BIT MASK VALUES Bit Mask Value Description 04 WPA_UNICAST_TKIP 08 WPA_UNICAST_AES_CCMP 10 WPA_BROADCAST_TKIP 20 WPA_BROADCAST_AES_CCMP Table 3 15 describes the WPS bit mask values TABLE 3 15 WPS BIT MASK VALUES Bit Mask Value Description 02 WPS_PushButton_ACTIVE 40 WPS_SUPPORTED 80 WPS_PushButton_SUPPORTED 3 7 1 2 FIRMWARE VERSION 2 22 THROUGH 2 30 Firmware version 2 22 through 2 30 supports a comma delimited scan output format which a microprocessor can use to parse the RSSI information The scan command output format is Row Count Channel RSSI Value dBm Security Mode Capabilities Access Point MAC Address SSID Figure 3 11 shows example output from the scan command FIGURE 3 11 SCAN OUTPUT FORMAT FIRMWARE VERSION 2 22 2 30 01 01 02 01 03 11 04 11 05 11 SCAN Found 5 L 53 00 020 L 59 04 310 L 72 04 310 L 50 02 310 L 69 04 310 0 la fc 90 e5 a5 37 QTDFW 4 00 15 9 38 bd b0 SensorNet 4 00 16 b6 45 63 98 CoolBox 0 00 18 02 70 7e e8 airlink 11 0 00 14 6c 1f 7 5e ap ssid change me The security mode field for the this scan format is described below Security Mode
52. timer TABLE 2 14 SET WLAN JOIN COMMAND OPTIONS Value Policy 0 Manual Do not try to associate with a network automatically 1 Try to associate with the access point that matches the stored SSID pass key and channel If the channel is set to 0 the module will scan for the access point Default 2 Associate with ANY access point that has security matching the stored authentication mode The module ignores the stored SSID and searches for the access point with the strongest signal You can limit the chan nels that are searched by setting the channel mask 3 Reserved 7 Create a soft AP network using the stored SSID IP address netmask channel etc This mode applies only to firmware versions supporting Soft AP mode Default 0 Example set wlan join 7 JI Create an a soft AP network 2 3 77 set wlan key lt value gt This command sets the WEP 64 or WEP 128 key where lt value gt is EXACTLY 26 ASCII chars 13 bytes in hex without the preceding Ox Hex digits greater than 9 can be either upper or lower case If you are using WPA or WPA2 enter a passphrase with the set wlan passphrase command The WEP key length depends on the WEP security used WEP 64 or WEP 128 e WEP 64 uses a 10 character key e WEP 128 uses a 26 character key Default 00 00 00 00 00 Example set wlan key 112233445566778899AABBCCDD II Sets the WEP key 2 3 78 set wlan linkmon lt va lue gt This parameter is used
53. to HTML client post specifically the ability to append amp id and amp rtc in the HTML message DREES DS50002230A page 112 2014 Microchip Technology Inc WIFLY COMMAND REFERENCE ADVANCED MICROCHIP FEATURES amp APPLICATIONS USER S GUIDE Index Symbols pt FOMA See Be etaan 23 mif upgrading with 80 SNOW CONNECTION E 39 Eeer 10 41 SYS Wlgger EE 29 ESCAPE butter 10 Hatt MODS sh cbeehesesedecantecdsemnstesederetdenseseaseanass 32 boot IMAGE eee E E E 45 A boot up CHIMING 0 0 2 ee cece eee eeeeeetee cece eeneeeeeeetetteaeeeeees 95 access point broadcast packet byte Tomat 71 ecis eTe ilgo Pee e dost cchesdeecdecensbeeeseceesaes 71 broadcast UDP iscccccet ccccefeedeczecehececsestcensedetzezeeedicts 70 SUPPOMEG WEE 97 browser disconnect mer 56 ACCESS point mode cece cece eee eeeeeee cee eeeeeeeeeeeetees 47 Buffalo Networks cccccececceceeeeceeeeeeeeeeeeeeeeeteeeees 97 ACTION Commande 41 c ad POC MOQ EE 33 DEACON DO 14 channel MASK ssisssrsssrssscissrnsnesninsiinanonnsdssrnsnosndnsnsannsa 36 display settings c ccscscesesseessesssesseessesseesseeeseen 37 CISCO WEE 97 probe setting EEN 14 CIOCK realme sssssassssisasisrsrssisninasansnssssshnnninsesasni 67 E EEN 97 GE 42 Airport Express u ne 97 ClOSE S NG EE 17 alternate FUNCTIONS coocooooococcococoececeoeccececeeeccecececcceee 26 CMD a err eercer rereerr yrcrceerrerrcre rrr ere 10 alternate GPIO DEER tege tee 62 COMMANA MOE EE
54. ue gt is a decimal number that is five times the number of seconds required The module uses this timer to close the FTP connection automatically after the specified time Default 200 2014 Microchip Technology Inc DS50002230A page 19 WiFly Command Reference Advanced Features amp Applications User s Guide Example set ftp timer 40 H Sets a 5 second timer set ftp timer 80 II Sets a 10 second timer 2 3 30 set ftp user lt string gt This command sets the user name for accessing the FTP server where lt string gt is up to 16 characters 16 bytes Default roving Example set ftp user my_username H Sets the user name to my_username 2 3 31 set ftp pass lt string gt This command sets the password for accessing the FTP server where lt string gt is up to 16 characters 16 bytes Default Pass123 Example set ftp user my_password H Sets the user name to my_password 2 3 32 set ip address lt address gt This command sets the WiFly module s IP address where lt address gt is an IP address in the form lt value gt lt value gt lt value gt lt value gt with lt value gt being a number between 0 and 255 If DHCP is turned on the IP address is assigned and overwritten when the nm module associates with an access point IP addresses are delimited Default 0 0 0 0 Example set ip a 10 20 20 1 H Sets the WiFly modules IP address to 110 20 20 1 2 3 33 set ip backup lt address gt This command se
55. when discon nected Note Bits 0 3 are mutually exclusive with bits 4 6 i e 0x77 is an illegal value If you disable the LEDs using bits 0 1 and 2 you can then use the show i command to read these GPIO pins For example the show i command might return Port 30 To use the alternate LEDs functions use the following commands set sys iofunc 0x70 H Enable alternate function for GPIO4 6 save H Store configuration reboot H Reboot the module Example 3 2 shows how to control the LEDs on the evaluation boards EXAMPLE 3 2 TOGGLE RED AND GREEN LEDS Green LED set sys iofunc 0x01 I Mask GPIO4 from WiF ly functionality set sys output 0x10 JI Toggle GPIO4 s state Red LED set sys iofunc 0x04 Mask GPIO6 from WiF ly functionality set sys output 0x40 JI Toggle GPIO6 s state GReen and red LEDs set sys iofunc 0x05 Mask GPIO4 and GPIO6 from WiFly JI functionality set sys output 0x50 JI Toggle GPIO 4 and 6 s state 3 6 2 3 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 module s connection status enable the alter nate function of GPIO4 6 Using the alternate function for these GPIO pins the module 2014 Microchip Technology Inc DS50002230A page 63 WiFly Command Reference Advanced Features amp Applications User s Guide connects to the stored remote
56. 0 disabled 0 0 DS50002230A page 92 2014 Microchip Technology Inc A 11 WLAN PARAMETERS SSID Channel External antenna Join mode Authentication mode Mask Rate Linkmon Passphrase TX Power ule only A 12 STRING VARIABLE SIZES roving1 0 Automatic scan O Off use on board chip antenna for RN131 ONLY 1 Automatically scan and join based on SSID for firmware version 2 36 ad hoc mode and lower 0 for firmware version 2 45 soft AP mode and higher OPEN Ox1FFF All channels 12 24 Mbit 0 rubygirl 0 which implies 12 dBm Applicable to RN171 mod Table A 1 provides the string variable sizes for the following parameters TABLE A 1 STRING VARIABLE SIZES Parameter Value Bytes FTP Parameters file 32 user 16 pass 16 dir 32 wlan Parameters ssid 32 phrase 64 DNS Parameters DNS host name 64 DNA backup host name 64 comm Parameters open 32 close 32 remote 64 deviceid 32 A 13 RESTORING DEFAULT CONFIGURATION SETTINGS You can restore the default factory configuration settings in software and hardware e Software In command mode use the factory RESET command to restore the defaults This command automatically loads the default settings and executes a save command Next send the reboot command so that the module reboots with the default configuration Hardware Set GPIOQ high on power up to arm the factory r
57. 10 41 analog interface pin value 0 00 eee 40 command character seng 16 analog interface values show multiple 0 00 40 OXI gees E E deeeetedeedeegsseuadietvaareesceceaneze 42 analog SMSO oo eeecscccecscseseseececetseseseseseecscscseseseeees 89 terminal emulator E 11 analog to digital converter ccccccccceseesesseseeeseeees 77 command quick reference eccrine 99 AP o s eae eee een erent ee eee 47 commands CONNEC tO module oooocoocoococcoeoooeooooeeeeeeececeecceeen 49 OVEIVIGW oo eeeeseceeteeseteeseeeseneesesesensesenseseneeeenees 13 default settinge 48 reboot after 13 enable in harhware o 47 EE 14 Enable Insofbware anaana a 48 Shorthand wisi ceiesecissacsasscacveas cecvsacasasseavsdassecetacsians 13 enabling 0 ceceecscseeseccscececeesscessecsesessseeneatscenseenss 47 SMS eeneg 13 GPIO alternative funchons aell 50 TYPOS eege ege savendndes sevensneeess 13 last device CONNECHEM ooooocoooooococoocoeececoecececcccccne 49 COMMOUPAUON EE 10 link ele EE 50 default sie ee sc lcccecasdeid ceveccececeegseceasadhesctececcecscteas 91 route data between diene 50 using configuration Web Server tees 53 View associated deviees o 50 configuration Web server 51 52 AP ASSOCIATING c cececcecseesesescseseececseseesecsescseseseees 71 configure module EE 53 AP Stan OP sarae rrr EEEE 44 invoke iN herchware E 52 apmode Commande 42 INVOKE N software En 52 APS Supported ioii tarian ee 97 LED Status En 52
58. 13 channels The default is 200 ms channel sleep Puts the module to sleep time Sets the real time clock by synchronizing with the time server specified with the time server set time parameters TABLE D 5 FILE UO COMMANDS Command Description del lt string gt lt value gt Deletes a file load lt string gt Reads in a new configuration file Is Displays the files in the system save lt string gt Saves the your configuration settings to a file boot image lt value gt Makes a file represented by lt value gt the new boot image ftp update lt string gt Deletes the backup image file retrieves a new image file and updates the boot pointer to the new image xmodem cu lt filename gt Updates the boot image using the xmodem 1K protocol over UART 2014 Microchip Technology Inc DS50002230A page 103 WiFly Command Reference Advanced Features amp Applications User s Guide NOTES DS50002230A page 104 2014 Microchip Technology Inc WIFLY COMMAND REFERENCE ADVANCED MICROCHIP FEATURES amp APPLICATIONS USER S GUIDE Appendix E Known Problems in Firmware Version 4 40 1 The set wlan join 2 is not supported 2 Routing traffic between client devices is not supported in soft AP mode when WPS2 PSK encryption is enabled If routing between client devices is required please disable WPA2 PSK encryption in soft AP mode 3 T
59. 1351 Fax 66 2 694 1350 EUROPE Austria Wels Tel 43 7242 2244 39 Fax 43 7242 2244 393 Denmark Copenhagen Tel 45 4450 2828 Fax 45 4485 2829 France Paris Tel 33 1 69 53 63 20 Fax 33 1 69 30 90 79 Germany Dusseldorf Tel 49 2129 3766400 Germany Munich Tel 49 89 627 144 0 Fax 49 89 627 144 44 Germany Pforzheim Tel 49 7231 424750 Italy Milan Tel 39 0331 742611 Fax 39 0331 466781 Italy Venice Tel 39 049 7625286 Netherlands Drunen Tel 31 416 690399 Fax 31 416 690340 Poland Warsaw Tel 48 22 3325737 Spain Madrid Tel 34 91 708 08 90 Fax 34 91 708 08 91 Sweden Stockholm Tel 46 8 5090 4654 UK Wokingham Tel 44 118 921 5800 Fax 44 118 921 5820 10 28 13 2014 Microchip Technology Inc
60. 3 4 to 192 168 1 1 in soft AP mode Fixed an issue wherein the FTP close string would occasionally leave the module in a hung state Fixed an issue wherein the module would send an invalid Deauth frame to the cli ents in soft AP mode Fixed an issue that could cause the boot image to be invalidated under certain improper power up conditions Fixed an issue that could cause the module to be bricked due to corruption in con fig file caused during improper power supply during the process of saving the con fig file to Flash D D D DS50002230A page 108 2014 Microchip Technology Inc F 2 VERSION 4 00 1 4 19 2013 F 2 1 Features e Added a new feature to indicate the number of clients associated with the module in soft AP mode in the UART heartbeat message F 2 2 Bug Fixes and Improvements Fixed an issue in which the GPIO4 5 and 6 alternate mode was not working Fixed an issue in which the link monitor was not working in infrastructure mode when auto join to a wireless network is disabled set wlan join 0 Fixed an issue in which a null device ID was not reset to factory defaults when the factory reset command is issued Fixed an issue in the FTP update process in which the module would watchdog when the module Flash does not have enough free sectors Fixed an issue in which the show rssi command was not working in infrastructure mode when auto join to a wireless network is disabled set wlan join 0 Fixed an issue in soft
61. 71 modules sup port the same ASCII command set Table 1 1 compares the RN131 and RN171 module features TABLE 1 1 COMPARING THE RN131 AND RN171 Feature RN131 RN171 Output power Pmax 18 dBm fixed 12 dBm programmable Lowest power 18 dBm 0 dBm lt 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 available for use 14 GPIO1 14 Refer to the RN131 and the RN171 data sheets on the Microchip website at http www microchip com for more details on their hardware differences and for detailed hardware specifications 1 1 1 Features e Fully qualified and Wi Fi certified 2 4 GHz IEEE 802 11 b g transceiver e FCC CE IC certified and RoHS compliant e 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 uA sleep 35 mA RX 210m TX at 18 dBm TX power not configu rable RN171 4 uA sleep 35 mA RX 185 mA TX at 12 dBm TX power configu rable e Antenna options RN131 On board ceramic chip antenna and U FL connector for external antenna RN171 RF pad 2014 Microchip Technology Inc DS50002230A page 9 WiFly Command Reference Advanced Features amp Applications User s Guide Hardware 8 Mbit Flash memory and 128 Kbyte RAM 2 Kbyte ROM 2 Kbyte
62. Android tablets etc should be able to see the module when they scan for access points Note Microchip recommends setting the WiFly module as the gateway when cre ating a point to point network between devices Wi Fi network only 3 1 1 2 ENABLE IN SOFTWARE Enable AP mode in software using the set wlan join 7 command You can customize network settings such as the SSID channel and IP address in software to create a cus tom AP mode For example the following commands create a custom AP mode in soft ware set wlan join 7 II Enable AP mode set wlan channel lt value gt H Specify the channel to create network set apmode ssid lt string gt H Set up network broadcast SSID JI BSSID set apmode passphrase lt string gt Set sot AP mode passphrase set ip dhcp 4 Enable DHCP server set ip address lt address gt II Specify the IP address set ip net lt address gt II Specify the subnet mask set ip gateway lt address gt II Specify the gateway save H Store settings reboot H Reboot the module in AP mode After rebooting the module is in AP mode with the custom settings shown above SSID channel IP address netmask and gateway A quick method of creating a soft AP network is to use the apmode lt bssid gt lt channel gt command where lt bssid gt is the broadcast SSID and lt channel gt is the channel on which the soft AP network is created The lt bssid gt and lt channe l gt parameters are optional If n
63. CP lease time in seconds set dns address lt address gt 0 0 0 0 Sets the IP address of the DNS sever set dns backup lt string gt rn microchip com Sets the name of the backup host for TCP IP connections to lt string gt set dns name lt string gt server1 Sets the name of the host for TCP IP connections to lt string gt set ftp addr lt address gt 0 0 0 0 Sets the FTP server s IP address of the FTP server set ftp dir lt string gt public Sets the starting directory on the FTP server 2014 Microchip Technology Inc DS50002230A page 99 WiFly Command Reference Advanced Features amp Applications User s Guide TABLE D 1 SET COMMAND LIST SHEET 2 OF 4 Command Default Description set ftp filename lt filename gt See description Sets the name of the file that is transferred when issuing the ftp u command where lt filename gt is the firmware image Firmware version 4 0 default is wifly3 lt version gt img RN131 wifly7 lt version gt img RN171 Firmware prior to 4 0 default is wifly GSX lt version gt img RN131 wifly EZX lt version gt img RN171 set ftp pass lt string gt Pass123 Sets the password for accessing the FTP server set ftp mode lt mask gt 0x0 Sets the ftp mode where lt mask gt indicates active or passive mode Default is passive set ftp remote lt value gt 21 Sets the FTP server s remote p
64. CP mode 0x2 set dns name www webserver com Set the web server name set ip host 0 H Turn on DNS set ip remote 80 H Set the web server port 80 is standard set com remote GET userprog php DATA Sample server application set uart mode 2 H Automatically connect using data trigger mode When the serial UART data comes in the module automatically connects to the web server and sends GET userprog php DATA lt users serial data gt n n 4 4 5 Post Binary Data Web servers expect ASCII data If the user data is binary the module can convert it to ASCII format before sending it to the web server EXAMPLE 4 13 EXAMPLE CONVERT DATA FROM BINARY TO ASCII set ip proto 18 H Turn on HTTP mode 0x10 and TCP mode 0x2 set dns name www webserver com Set the web server name set ip host 0 H Turn on DNS set ip remote 80 H Set the web server port 80 is standard set com remote GET userprog php DATA H Sample server application set option format 1 H Convert binary data to ASCII hex H format For example if the incoming UART data is 6 bytes of binary data with hex values 0x01 OxAB 0x03 OxFF 0x05 and 0x06 the module sends this string GET user prog php DATA 01AB03FF0506 n n to the web server DS50002230A page 76 2014 Microchip Technology Inc 4 4 6 The module can send the value of the GPIO and sensor pins to the web server auto matically The data arrives as 18 bytes of A
65. HE BACKUP DNS NAME set dns backup lt string gt JI Set the backup host name 4 4 USING THE HTML CLIENT FEATURE The module has a built in HTML client When enabled the module can get or post data to a web server For example you can use the HTML client to post serial and or sensor data to the host web server This feature makes possible to provide Wi Fi capabilities to applications such as GPS units remote sensors weather stations etc 4 4 1 Retrieve Web Server Data In this example you want to retrieve data from the web server with the format http www webserver com ob php 0bvar WEATHER To perform this function use the following settings set ip proto 18 H Enable the HTML client set dns name www webserver com Set the web server name set ip address 0 Turn on DNS set ip remote 80 H Set the web server port 80 is standard set com remote 0 JI Turn off the REMOTE string so that it H does not interfere with the post To make the connection use the open command or you can use open www web server com 80 The user s microprocessor writes the following string to the UART GET ob php obvar WEATHER n n Where the n is the linefeed character decimal 10 or hex Oxa Two linefeeds are required for the web server to know the page is complete Note Some web servers require a carriage return and linefeed to indication the page is complete In this case use r n at the end of the string instead of
66. ID and security and set autojoin to 1 When the module wakes up or is powered on the auto connect timer causes the module to attempt a connection to the stored remote IP address and port The sleep timer does not decrement while this connection is open and the idle timer does not decrement while data is flowing When data stops for 5 seconds the connection is closed the sleep timer puts the module in deep sleep The wake timer begins the cycle again one minute later EXAMPLE 4 5 AUTOMATIC CONNECTION set ip host lt address gt Set up remote machine s IP address set ip remote_port lt val ue gt Set up the remote machine s IP port set sys autoconn 1 H Automatically connect when ready set com idle 5 H Disconnect after 5 seconds with no data activity set sys sleep 2 H Sleep 2 seconds after connection is closed set sys wake 60 Wake up after 1 minute of sleep set uart mode 2 1 Use UART data trigger mode which JI causes the module to make a I TCP HTTP connection upon incoming I UART data supported in firmware II version 2 19 and higher 4 3 2 Controlling Connections using GPIO5 and GPIO6 You can use GPIO5 to control the TCP connection After you configure the pin with the set sys iofunc command the module attempts to connect to the stored IP address and port when GPIO5 goes high and disconnects when GPIO5 goes low Similarly you can monitor the connection status by reading GPIO6 When it goes high the co
67. IRING set ip host 0 0 0 0 JI Set the host to 0 0 0 0 set ip flags 0x40 4 1 2 UDP Retry This feature adds a level of reliability to the UDP protocol without adding the complete overhead of TCP protocol When enabled the module waits for a response on every UDP packet that is sent any UDP packet coming back in If the module does not receive the response packet by approximately 250 ms the same UDP packet is sent out This process continues until either e A UDP response is seen e Anew UDP packet is sent from the module and is acknowledged Refer to Section 2 3 35 set ip flags lt mask gt for which bit to set to enable this fea ture 4 1 3 UDP Broadcast You can set up the module to generate UDP broadcast packets automatically which is useful for the following reasons Some access points disconnect devices that are idle UDP broadcast informs the access point that the module is alive and wants to stay associated Applications can use this feature to automatically discover and configure the mod ule If an application is listening for the UDP broadcast a number of useful param eters are present in the package that can be used for auto discovery For example the module s IP address and port number are part of the packet thus an application can connect to the module and remotely configure it The associated access point s MAC address channel and RSSI value are also available in this packet enabling a simpl
68. P connection is open low when TCP con nection is closed 3 2 CONFIGURATION WEB SERVER This section describes how to use the module s configuration web server supported in firmware version 4 0 and higher 3 2 1 Introduction WiFly modules can operate in one of two modes e Infrastructure mode The module can join a network created by an access point AP e Soft AP mode The module behaves as an AP with limited functionality A key challenge when using any embedded device in Infrastructure mode is to provi sion it so that it can associate with an AP This process requires storing the AP s set tings such as the SSID and passphrase in the embedded device You can configure or provision embedded Wi Fi modules to join an infrastructure net work in several ways e Sending ASCII commands to the module over a UART e Sending ASCII commands remotely while the module is in soft AP mode e Using Wi Fi Protected Setup WPS e Sending commands to the module remotely using a web interface 3 2 2 Using the Configuration Web Server Configuring the embedded WiFly module to associate with an AP in Infrastructure mode involves the following process 1 Invoke the module s configuration web server 2 Connect your client device PC smartphone tablet etc to the module s soft AP network 3 Access the module s configuration web page from your client device s web browser 4 Save the settings SSID and p
69. SCII hex data in the format lt 2 bytes GPIO gt lt channel 0 thru 7 sensor data gt Post Sensor Data Automatically Note The analog to digital converter is 14 bits on a 400 mV signal which trans lates to about 24 microvolts 0x61A80 in hex When you use the show q command in Command mode the module displays the raw readings How ever for HTTP web posting and UDP broadcast packets the module shifts the reading by 4 bits which is a divide by 16 resulting in a 16 bit number Therefore if you want the actual voltage sampled you must take the 16 bit number and shift it left by 4 bits to get the number of microvolts If you the value in millivolts and do not need high accuracy right shift by another 6 bits which is the same as dividing by about 1K EXAMPLE 4 14 set ip proto 18 POST SENSOR DATA TO WEB SERVER H Turn on HTTP mode 0x10 and 1 TCP mode 0x2 H Set the web server name H Turn on DNS H Set the web server port 80 is standard set com remote GET userprog php DATA JI Sample server application Module samples all 8 sensor channels H Connect every 30 seconds H Send the header plus the sampled II binary data converted to ASCII format set dns name www webserver com set ip host 0 set ip remote 80 set q sensor Oxff set sys auto 30 set option format 7 The resulting string sent to the server is GET userprog php DATA 0F3000001111222233334444555566667777 n n The data forma
70. TCP connect timers DNS preferences and remote config uration options lt mask gt is a hex number referring to a bit mapped register as shown in Figure 2 3 Note The TCPMODE register is available in firmware version 2 27 and higher DS50002230A page 22 2014 Microchip Technology Inc FIGURE 2 3 SET IP TCP MODE COMMAND BIT MAPPED REGISTER 4 3 2 0 L Shorten the TCP connect timer use with bit 1 Shorten the TCP connect timer use with bit 0 Forces the module to use DNS first to resolve the IP address even if the host IP is set Reserved Disables remote configuration for security purposes Default 0x0 Example set ip tcp mode 0x4 H Forces the module to use DNS set ip tcp mode 0x10 H Disables remote configuration 2 3 43 set opt jointmr lt va ue gt This command sets the join timer which is the length of time in ms the join function waits for the access point to complete the association process lt va ue gt is a decimal number representing the number of ms This timer is also used as the timeout for the WPA handshaking process Default 1000 Example set opt jointmr 1050 H Sets the join timer to 1 050 ms 2 3 44 set opt format lt flag gt The command sets the HTTP client web server information where lt flag gt is a bit mapped register as shown in Figure 2 4 See Section 4 4 Using the HTML Client Feature for more det
71. The yellow LED goes on solid while negotiation is in progress with a WPS enabled access point If the process is successful the WPS application quits and the module reboots If the module is set to use the standard GPIO functions i e not the alternate GP104 functions the green LED blinks once per second If the alternate GPIO4 function is enabled the green LED goes high 4 9 ANALOG SENSOR CAPABILITY The module has 8 analog sensor inputs that can be driven between 0 to 1 2V DC You can sample the analog inputs and read digital value using the show q lt va ue gt com mand where lt value gt is a decimal number representing the channel See Section 2 5 5 show q lt value gt for more details WARNING Driving these inputs above 1 2V can permanently damage the module The channel is the analog sensor input from 0 to 7 The value for the analog sensor input is measured in microvolts and is returned as 8xxxxx where the beginning 8 is a start marker You can also sample multiple channels by using a bit mask using the show q 0x1 lt mask gt command where lt mask gt is a bit mask of the channels See Section 2 5 6 show q 0x1 lt mask gt for more details EXAMPLE 4 19 READ CHANNELS 0 1 AND 7 show q 0x183 Read channels 0 1 and 7 The results are in the format 8 lt channel 0 gt 8 lt channel 1 gt 8 lt channel 7 gt r n The analog input hardware specification is Input voltage
72. To use the auto connect timer you must store the remote host s IP address and port in the WiFly module using the set ip host lt address gt and set ip remote lt value gt commands 2014 Microchip Technology Inc DS50002230A page 25 WiFly Command Reference Advanced Features amp Applications User s Guide TABLE 2 6 GPI TABLE 2 5 AUTO CONNECT TIMER SETTINGS Value Description 0 Disable the auto connect timer default 1 Connect to the stored remote host IMMEDIATELY upon power up or when waking from sleep 2 254 Connect to a stored remote host every lt value gt seconds 255 Connect to a stored host IMMEDIATELY upon power up or when waking from sleep and go back to sleep IMMEDIATELY as soon as the TCP connection closes Default 0 Example set sys autoconn 5 H Module connects to host every 5 sec 2 3 53 set sys iofunc lt mask gt This command sets the I O port alternate functions where lt mask gt is a hex number referring to a bit mapped register The I O function lt mask gt is encoded as shown in Table 2 6 O PIN ALTERNATE FUNCTION BITMASK Bit Signal Name Direction Function 0 GPIO4 Output Disable the LED function so the I O can be used as a GPIO pin 1 GPIO5 Output Disable the LED function so the I O can be used as a GPIO pin 2 GPIO6 Output Disable the LED function so the I O can be used as a GPIO pin 3 Unused 4 GPIO4 Outp
73. a wireless home network This standard was created by the Wi Fi Alliance and officially launched on January 8 2007 The goal of the WPS protocol is to simplify the process of configuring security on wire less networks The protocol is meant to allow home users who know little of wireless security and may be intimidated by the available security options to configure Wi Fi Protected Access which is supported by all newer Wi Fi certified devices but not older Wi Fi devices The most common mode of WPS is the Push Button mode PBC in which the user sim ply pushes a button on both the access point and the wireless client e g the WiFly module See Figure 4 8 FIGURE 4 8 PUSH BUTTON WPS The module supports the WPS feature in firmware version 2 28 and higher Note Modules that ship with firmware version 2 28 or higher already have the WPS application You can confirm whether your module has the application using the Is command See Figure 4 9 2014 Microchip Technology Inc DS50002230A page 87 WiFly Command Reference Advanced Features amp Applications User s Guide FIGURE 4 9 CONFIRMING WPS APPLICATION IS INSTALLED J COMB Tera Term VT z j File Edit Setup Control Window Help SIZ FLAGS A 3 WiFly_EZX 2 23 10 config 3 WiFly_EZk 2 27 3 wps_app 94 Free Boot 31 Backup 11 27 gt 4 8 1 Launching a WPS Application There are two ways to invoke a WPS function e
74. acket forward ing The other methods are set comm match and set comm time For more informa tion refer to Section 3 6 1 UART Receiver and RTS CTS Hardware Flow Control Default 1420 Example set comm size 1420 H Set the flush size to 1 420 bytes 2 3 19 set comm time lt value gt This command sets the flush timer where lt value gt is a decimal number representing milliseconds When this configuration option is set the module sends an IP packet if no additional bytes are received for lt va ue gt ms Setting this value to 0 disables forwarding based on the flush timer The flush timer is one of three available methods you can use to control TCP IP packet forwarding The others are set comm match and set comm size For more informa tion refer to Section 3 6 1 UART Receiver and RTS CTS Hardware Flow Control Default 5 Example set comm time 20 Set the flush timer to 20 ms 2 3 20 set dhcp lease lt va lue gt This command sets the soft AP mode DHCP lease time to lt va ue gt where lt value gt is the number of seconds The module uses this value when offering the DHCP lease to each client associating with the module in soft AP mode Default 86400 Example set dhcp lease 2000 H Sets the DHCP lease to 2 000 seconds 2 3 21 set dns address lt address gt This command sets the IP address of the DNS sever where lt address gt is an IP address in the form lt value gt lt value gt lt value gt lt value gt wi
75. address to 1 192 168 1 50 2 3 8 set broadcast backup lt address gt This command sets the secondary address to which the UDP hello heartbeat message is sent where lt address gt is an IP address in the form lt value gt lt value gt lt value gt lt value gt with lt value gt being a number between 0 and 255 The secondary broadcast is also a UDP packet sent after the primary broadcast and is of 120 bytes The secondary broadcast contains the primary broadcast 110 bytes plus the module s MAC address 6 bytes and IP address 4 bytes for a total of 120 bytes 2014 Microchip Technology Inc DS50002230A page 15 WiFly Command Reference Advanced Features amp Applications User s Guide Default 0 0 0 0 Example set broadcast backup 192 168 1 5 H Sets the broadcast address to 1192 168 1 5 2 3 9 set broadcast interval lt mask gt This command sets the interval at which the hello neartbeat UDP message is sent and is specified in seconds The value is a mask that is ANDed with a free running seconds counter if the result is all Os a packet is sent For example e If the interval is 0x1 the module sends one packet every 2 seconds e If the interval is 0x2 The module sends two packets every 4 seconds e If the interval is 0x3 the module sends one packet every 4 seconds e If the interval is 0x6 the module sends two packets every 8 seconds e If the interval is 0x7 the module sends one packet every 8 second
76. age 94 2014 Microchip Technology Inc WIFLY COMMAND REFERENCE ADVANCED MICROCHIP FEATURES amp APPLICATIONS USER S GUIDE Appendix B Boot Up Timing Values Table B 1 shows the boot up timing values TABLE B 1 BOOT UP TIMING VALUES Function Description Time ms Power up Power up time from reset high or power good to boot code loaded 70 Initialization Initialize ECOS 50 Ready Load configuration and Initialize application 30 Join Associate using channel 0 full channel scan mask Ox1FFF 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 AP dependent 2014 Microchip Technology Inc DS50002230A page 95 WiFly Command Reference Advanced Features amp Applications User s Guide NOTES DS50002230A page 96 2014 Microchip Technology Inc WIFLY COMMAND REFERENCE ADVANCED MICROCHIP FEATURES amp APPLICATIONS USER S GUIDE Appendix C Supported Access Points The module should work with any standard access point Microchip has tested the module with the following access points e Cisco Aeronet series Linksys both standard and open WRT Linux Netgear WGR614 v8 WNDR3700 v3 0 Netgear WGN54 DLINK dir 615
77. ails FIGURE 2 4 SET OPT FORMAT COMMAND BIT MAPPED REGISTER 4 3 2 1 0 Automatically send an HTML header based broadcast interval Send users binary data converted to ASCII hex Sample the GPIO and ADC pins and format to ASCII hex Appends amp id lt value gt where lt value gt is the device ID string that was set using set opt device lt string gt Appends the following key value pairs to the HTTP message amp rtc lt time gt amp mac lt address gt amp bss lt access point address gt amp bat lt battery voltage gt amp io lt GPIO in hex gt amp wake lt wake reason gt amp seq lt sequence value gt where lt time gt is the realtime clock value in the message as a 32 bit hex value in format aabbccddeeff and lt sequence value gt is a rolling counter of how many web posts have been sent Default 0x00 Example set opt format 0x7 H Module sends sensor values 2 3 45 set opt replace lt value gt This command sets the replacement character used to indicate spaces in the SSID and passphrase s string where lt value gt is the ASCII value of the character Each occur rence of the replacement character is changed into a space Only the WiFly command parser uses this replacement character For example to change the replace character to use the set opt replace 0x25 com mand the ASCII value of is 0x25 Default 0x24 Example set opt replace
78. ample reboot H Reboot the module 2 6 14 run lt string gt This command is used to run an application using ASCII commands where lt string gt is web_app or wps_app Example run web_app II Runs the configuration web server run wps_app II Runs the WPS application 2 6 15 scan lt value gt lt char gt This command performs an active probe scan of access points on all 13 channels where lt value gt is an optional parameter representing the time in ms per channel lt char gt represents the optional parameter P which causes the module to perform a passive scan and list all access points it can see in passive mode When you use this command the module returns the MAC address signal strength SSID name and security mode of the access points it finds The default scan time is 200 ms channel or about 3 seconds See Section 3 7 1 Scan Output Format for more information on the format of the scan command output Default 200 ms channel Example scan 30 H Scan for 30 ms channel 2 6 16 sleep This command puts the module to sleep You can wake the module by sending char acters over the UART or by using the wake timer Example sleep Put the module to sleep 2 6 17 time This command sets the real time clock by synchronizing with the time server specified with the time server set time parameters This command sends a UDP time server request packet Example time H Set the real time clock DS50002230A page 44 2014 Mic
79. and associated files in the Flash memory using the Is command see Example 4 15 4 5 3 Upgrading Firmware Pre Version 4 0 To update the firmware to a version lower than 4 0 e g from version 2 45 to 3 07 issue the command ftp update lt ilename gt where lt filename gt is an optional filename use the optional name to bypass the default firmware file name 2014 Microchip Technology Inc DS50002230A page 81 WiFly Command Reference Advanced Features amp Applications User s Guide The module retrieves the file and switches the boot image to the new file resulting in the following messages lt 2 20 gt ftp update lt 2 20 gt FTP connecting to 208 109 78 34 FTP file 30 Note After the module reboots with the new firmware Microchip recommends that you reset the module to the factory default parameters using the fac tory RESET command Failure to do so may result in some variables being initialized with random values The previous firmware becomes the backup image The following example shows the file system after a successful update FL SIZ FLAGS 11 18 3 WiFly GSX 2 20 29 1 10 config 30 18 3 WiFly GSX 2 21 208 Free Boot 30 Backup 11 After downloading the firmware checks the image and compares it to the stored values in the file before committing the image to Flash and updating the boot record If the checksum fails the module displays UPDATE FAILED x and deletes the image Note You must
80. and automat ically selects the authentication mode The firmware supports the following security modes e WEP 64 and WEP 128 open mode only NOT shared mode e WPA2 PSK AES only e WPA1 PSK TKIP only e WPA PSK mixed mode some access points not all are supported REENEN 2014 Microchip Technology Inc DS50002230A page 33 WiFly Command Reference Advanced Features amp Applications User s Guide TABLE 2 13 SET WLAN AUTH COMMAND AUTHENTICATION MODES Value Authentication Mode 0 Open Default 1 WEP 128 2 WPA1 3 Mixed WPA1 and WPA2 PSK 4 WPA2 PSK 5 Not used 8 WPE 64 Default 0 Example set wlan auth 4 H Use WPA2 PSK authentication 2 3 72 set wlan channel lt value gt lt flag gt This command sets the WLAN channel where lt value gt is a decimal number from 1 to 13 representing a fixed channel and lt flag gt is the optional character i meaning imme diate If you set the channel to 0 the module performs a scan using the SSID for all the channels set in the channel mask The i flag allows you to create a temporary AP mode setup without having to reboot or save the settings See Example 2 Default 0 Example 1 set wlan channel 2 H Set the WLAN channel to 2 Example 2 set wlan channel 1 i set wlan join 7 set ip address 1 2 3 4 set ip gateway 1 2 3 4 set ip netmask 255 255 255 0 set ip dhcp 4 Use DHCP server join lt SS D gt H Module goes into AP mode 2 3 73
81. and you must explicitly enable auto join mode using the set wlan join 1 command The firmware now supports parity with the set uart flow command Added the i flag to the set wlan channel command which changes the channel immediately You can use this feature to go into AP mode without having to reboot or save the settings In AP mode de authentication with the link monitor closes the TCP connection flushes the UART buffer and tries to clear stuck RTS flow control In some cases flow control can get stuck e g during a tcp_close or de authen tication in which the UART cannot transmit a TCP packet and is holding it Added a fix to attempt to clear the buffer In previous firmware the associated status is always set even if no clients are joined In version 2 45 the red LED correctly shows the status if there are no devices joined If you use ALTERNATE IO for associated it is high if there are 1 or more clients and low if there are no clients e In AP mode the module supports 7 connections DHCP and AP e Fixed an issue with the ping command D D D F 5 VERSION 2 30 10 26 2011 Added support for incorrect WPA modes namely WAPv1 with AES encryption and WPAv2 with TKIP encryption Added support for WEP shared mode Increased FTP filename size to 64 bytes Added a new reboot register in ad hoc parameters This register is reserved for future development and should not be used Please leave it to default values Added a new de
82. ant to assign the mod ule a static IP turn off the Check to enable DHCP option and enter the static IP subnet mask and gateway d Once you have configured the network settings click Save Configuration to save the settings to the module 5 Exit the web server by clicking Exit Web Configuration App The module reboots in Infrastructure mode and joins your wireless network 3 2 4 Using the Advanced Tabs Turning on the Display Advanced Tabs option bottom right corner of the application window shows the Terminal and Module Configuration tabs 3 2 4 1 TERMINAL TAB Click the Terminal tab see Figure 3 5 In this tab you can issue ASCII commands to configure any of the WiFly module s parameters The web server includes a help utility to guide you through the module configuration To use this feature type help in the ter minal DS50002230A page 54 2014 Microchip Technology Inc FIGURE 3 5 TERMINAL TAB PY ROVIN N Network Configuration Information Terminal Module Configuration WiFly Terminal A terminal to issue commands to the WiFly module Note Type help to display command options ti ay comand options eg factor E boot set app load ing Is list files save de lp ings param R eg factory R sage File Phandie eg boot image 12 help For sore info 1 help for sore info o m help for more info t hel status tom sl aps ot scan help for sore nfo a abl
83. assphrase in your web browser and exit 3 2 2 1 INVOKE THE CONFIGURATION WEB SERVER There are two methods for enabling the web server hardware and software When you invoke the configuration web server it creates a soft AP network with the settings shown in Table 3 3 REN 2014 Microchip Technology Inc DS50002230A page 51 WiFly Command Reference Advanced Features amp Applications User s Guide TABLE 3 3 SOFT AP NETWORK SETTINGS Setting Soft AP Mode Default SSID WiFly GSX XX for RN131G C WiFly EXZ xXX for RN171 where XX is the last byte of the module s 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 network s SSID uses the module s device ID parameter If you change the device ID parameter using the set opt device_id lt string gt com mand the module uses this new device ID as the soft AP network s SSID The device ID parameter is not set to a default if you perform a factory reset 3 2 2 1 1 Invoke Configuration Web Server in Hardware You can invoke the web server in hardware using GPIOY To use GPIOQ specify that the web application should launch using command set sys launch_string web_app default configuration With the launch string set drive GPIOQ high any time after power up to invoke the web server The module creates a soft AP mode network with the parameters described in
84. battery backed memory General purpose digital I O pins RN131 10 GPIO pins RN171 14 GPIO pins 8 analog inputs 14 bits 1 2V Real time clock for wake up and time stamping data logging auto sleep and auto wake up modes Network support Supports Soft Access Point AP ad hoc needs special firmware 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 com mands Built in networking applications DHCP client DNS client ARP ICMP ping FTP client TELNET HTTP UDP and TCP D 1 2 CONFIGURATION The WiFly module has two modes of operation Data mode and Command mode In data mode the module can accept incoming connections or initiate outgoing connec tions To configure parameters and or view the current configuration you must put the module into Command mode also called Configuration mode 1 2 1 Entering Command Mode By default the module is in data mode after power up Sending the escape sequence causes the module to enter command mode You must send together quickly with no additional characters before or after You must not send a carriage return lt cr gt or line feed after the to enter command mode The module replies with CMD to indi cate it is in
85. bles the UART s TX pin GPIO10 where lt value gt is 1 or 0 set wlan auth lt value gt 0 Sets the authentication mode set wlan channel lt value gt 0 Sets the WLAN channel where lt value gt is a decimal number lt flag gt from 1 to 13 representing a fixed channel and lt flag gt is the optional character i meaning immediate set wlan ext_antenna lt value gt 0 Determines which antenna is active where lt value gt is 0 use the chip antenna or 1 use the U FL connector set wlan fmon lt value gt 3600 Sets the soft AP mode link monitor timeout threshold for the associated client device set wlan id lt string gt Reserved for future use set wlan hide lt value gt 0 Hides the WEP key and WPA passphrase where lt value gt is 0 or 1 set wlan join lt value gt 1 0 Sets the policy for automatically associating with network access points set wlan key lt value gt Not applicable Sets the 128 bit WEP key where lt value gt is EXACTLY 26 ASCII chars 13 bytes in hex without the preceding Ox set wlan linkmon lt va ue gt 0 disabled Sets the link monitor timeout threshold where lt value gt is a decimal number representing the number of failed scans before the module declares AP is Lost and de authenticates set wlan mask lt mask gt Ox1FFF all chan nels Sets the WLAN channel mask which is used for scanning channels with auto join policy 1 or 2 s
86. bug register in the system parameters This register is reserved for future development and should not be used Please leave it to default values D D D DS50002230A page 110 2014 Microchip Technology Inc F 6 VERSION 2 27 09 08 11 Added support for Wi Fi Protected Setup WPS push button mode Added support for WEP64 encryption Added support for backup IP address Added a new TCPMODE register to control TCP connect timers force DNS and remote configuration Added new bit in UART mode register bit 5 in which replaces the lt 2 23 gt r n in console with the replace character Fixed the FTP file put mode so it over rides HTTP mode In version 2 23 if HTTP protocol is set and or option format is set extra data would be added to FTP put file data This has been fixed in version 2 28 Fixed a bug where if the TCP_CLIENT mode is set the module would randomly attempt outgoing connections Fixed a bug in FTP data write mode whereby sometimes the OPEN status string came back over the UART before the file transfer was actually ready This fix also improves the speed of FTP open in write mode such that the OPEN will be faster F 7 VERSION 2 23 04 03 2011 Created new set of sensor commands set q sensor lt mask gt and set q sensor lt value gt Also sensor power can now be configured and applied either only when sampling of sensor inputs occur or at power up and removed upon power down and sleep Added a new FTP
87. d puts the module to sleep after lt va ue gt seconds Setting the value to 0 disables the sleep timer and the module will not go to sleep based on this counter Note Be sure to set the wake timer before issuing the sleep timer if you are not using an external wake up signal otherwise the module will never wake up See Section 3 4 System and Auto Connect Timers for more details on using sys tem timers Default 0 Example set sys sleep 5 H Module sleeps 5 s after TCP H connection closes 2 3 58 set sys trigger lt flag gt or lt mask gt With this parameter setting the module wakes from the sleep state using the sensor input 0 1 2 and 3 where lt flag gt is a decimal number referring to a bit mapped register as shown in Table 2 10 and lt mask gt is a hex number You use either lt flag gt or lt mask gt with this parameter setting This command sets the sensor input s to wake on 0 to 3 Setting lt flag gt to 0 disables wake on sensor inputs TABLE 2 10 SET SYS TRIGGER COMMAND BIT MAPPED REGISTER Bit Position Description 0 Trigger sensor input 0 1 Trigger sensor input 1 2 Trigger sensor input 2 3 Trigger sensor input 3 5 Enable sleep on GPIO8 Table 2 11 describes how you can wake the module using sensor input TABLE 2 11 SENSOR INPUT TRIGGER VALUES Wake on Sensor Input Value Command 0 1 set sys trigger 1 1 2 set sys trigger 2 2 4 s
88. described in Section 3 5 Wake on Sensor Input The RN 134 and the RN 174 evaluation boards have a built in resistor divider connect ing SENSEO and SENSE1 to RXD and CTS respectively This setup allows wake on RX and CTS using a 3 3V signal WARNING Do not apply 3 3V directly to SENSEO and SENSE the voltage on any sensor input CANNOT exceed 1 2V DC or the module will be permanently damaged To enable wake on RXD use the set sys trig 1 command The first or possibly multiple byte sent to the module will likely be lost therefore you should take care to send a preamble byte to wake the module before sending valid data bytes Alternatively use the CTS input to wake the module and wait until it is ready to accept data To enable this setting use the set sys trig 2 command Note On the RN 134 evaluation board revision 2 the resistor pack connecting the RX and CTS signals is not correctly connected to the sensors To wake on UART RX place a jumper from pin 3 on the evaluation board header to pin 2 on the sensor header To wake on UART CTS place a jumper from pin 10 on the evaluation board header to pin 3 on the sensor header 3 6 1 UART Receiver and RTS CTS Hardware Flow Control The UART receive buffer is approximately 1 500 bytes At lower baud rates less than 115K the system can send data over TCP IP without flow control Depending on the frequency and quantity of the data being sent the
89. ding data using the UDP broadcast packet or the HTTP auto sample function See Section 2 3 50 set q sensor lt mask gt for more details Note In versions of firmware prior to 2 23 this command is named set option sensor Firmware versions 2 23 and higher support the set q power lt va ue gt command This command sets an 8 bit register with two 4 bit nibbles that automatically turns on the sensor power See Section 2 3 51 set q power lt value gt for more details on using this command DS50002230A page 90 2014 Microchip Technology Inc WIFLY COMMAND REFERENCE ADVANCED MICROCHIP FEATURES amp APPLICATIONS USER S GUIDE Appendix A Default Configuration This section describes the default configuration settings and how to restore them A 1 APMODE PARAMETERS Beacon Probe Reboot A 2 BROADCAST PARAMETERS IP address Port Interval Backup address0 0 0 0 Backup port A 3 COMM PARAMETERS Close string OPEN Open string Remote string Flush size Match character Flush timer Idle timer Cmd char A 4 DNS PARAMETERS IP address Name Backup Lease AA FTP PARAMETERS Server address File User Password 102 milliseconds for apmode mode only 5 seconds to look for beacons before declaring AP is lost for apmode mode only 0 for apmode mode only 255 255 255 255 55555 7 seconds CLOS HELLO 1420 0 10 milliseconds 0 0 0 0 0 dns rn microchip com
90. ds n n to the end of the packet Note Ifthe HTML header contains spaces you must use the character to indi cate spaces in the string A space is the command delimiter When the modules command parser sees the it converts it to a space character EXAMPLE 4 11 CONNECT TO WEB SERVER EVERY 30 SECONDS Use the following commands to configure the module to connect to a web server every 30 seconds set com remote GET ob php obvar WEATHER JI Setup the HTML string set sys auto 30 H Auto connect every 30 seconds set option format 1 H Send header automatically when connection is open setip proto 18 Turn on HTTP mode 0x10 TCP JI mode 0x2 REN 2014 Microchip Technology Inc DS50002230A page 75 WiFly Command Reference Advanced Features amp Applications User s Guide 4 4 4 Connect to a Web Server Automatically when UART Data Is Received The module supports a mode in which it can connect to the web server when it receives UART data Note If you attempt to send data by typing characters on the keyboard or if your microcontroller is not sending data fast enough the module sends out small packets of data it sends out many packets of small MTU size To avoid this issue set the flush timer to a higher value e g set comm time 5000 By default it is set to 10 ms EXAMPLE 4 12 CONNECT TO WEB SERVER WHEN UART DATA IS RECEIVED set ip proto 18 Turn on HTTP mode 0x10 and T
91. e led display w reboot Seel module ep reboot same as reboot reg cit pe set debugging level param Oxlevel eg debug 7E Notice the Disaplay Advanced Tabs box is Command Exit Web Configuration App a Display Advanced Tabs 3 2 4 2 MODULE CONFIGURATION TAB Click the Module Configuration tab see Figure 3 6 In this tab you configure the WiFly module s frequently used parameters such as device ID UART baud rate and flow control You configure other parameters with ASCII commands in the Terminal tab FIGURE 3 6 MODULE CONFIGURATION TAB PY OUI DES Network Configuration Information Terminal Module Configuration WiFly Module Configuration Configurable parameters for the WiFly module Device ID WiF ly E2x UART Configuration Configuration for the module s UART BAUD Rate 9600 x Hardware Flow Control Notice Display No flow control Advanced Tabs box is M e LJ checked Save Configuration Exit Web Configuration App a Display Advanced Tabs 3 2 5 Web Server Timers The application includes two timers to ensure that the web server runs smoothly e Idle timer e Browser disconnect timer 2014 Microchip Technology Inc DS50002230A page 55 WiFly Command Reference Advanced Features amp Applications User s Guide 3 2 5 1 IDLE TIMER The idle timer ensures that the client associated with the WiFly module s AP network is not lost or unresp
92. e 111 WiFly Command Reference Advanced Features amp Applications User s Guide F 9 VERSION 2 20 06 14 2010 F 9 1 Fixes Passphrase is now accepts up to 64 chars A bug introduced in 2 19 causes the wlan passphrase to be truncated to 32 characters making it impossible to enter a 32 byte HEX literal PSK Fixed DHCP status when link to Access Point AP is lost It was still reporting DHCP OK It is now cleared and new DHCP session will start once AP link is reestablished Fixed a bug whereby UDP receive becomes disabled no packets are received if AP LOST and then re established Improved handling of AP disconnect and AP link lost due to linkmon timeout or other disconnect If TCP connection was active connection could be in hung incorrect state and once AP is regained in some cases this would not recover This has been fixed in this version Refer section set ip flags lt va ue gt for more information Added new setting to the UART mode set uart mode 0x10 D F 9 2 Features e Disabled the auto join feature when in command mode Auto join causes the WiFly module to become unresponsive to or commands during the period when auto joining when auto joining is failing due to non existent AP making it hard to process or interpret commands Once command mode is exited auto join will re enable e There are new levels of print out diagnostics that can be enabled disable with the sys print variable e Ability to add prefix
93. e is 0x21f0 which corresponds to the following settings GPIO0 3 are used internally on the module GPIO4 6 are LEDs GPIO 9 is reserved as the factory reset Soft AP mode read at power up and otherwise general purpose input detect pin GPIO10 11 are the UART RX and TX pins TX does not need to be masked as an output GP1012 is CTS input if used GP1013 is RTS output if used Note To set the GPIO pins as inputs or outputs instantly use the set sys mask 0xABCD 1 command which does not require a reboot The RN 134 evaluation board s LEDs are connected to GPIO4 6 To disable the LEDs enable the alternative functions of the LEDs use the set sys iofunc 0x7 commana Note You can turn off the yellow red or green LEDs The RN 134 board s blue LED is the power indicator and cannot be turned off The RN 174 evaluation board s blue LED is connected to GPIO7 which is output by default The board does not drive this because GPIO7 s default power up state is low The get sys command shows the setting of the GPIO mask as shown in Example 3 1 EXAMPLE 3 1 GPIO MASK SETTING lt 2 21 gt get sys SleepTmr ToFunc 0x0 ToMask 0x21f 0 2014 Microchip Technology Inc DS50002230A page 61 WiFly Command Reference Advanced Features amp Applications User s Guide Figure 3 8 shows the bits corresponding to the GPIO pins and Table 3 10 shows the GPIO pin usage their default state and functionalit
94. e location and tracking function By default the module sends out a UDP broadcast to 255 255 255 255 on port 55555 at a programmable interval You set the broadcast address port and interval using the set broadcast commands Note You can send the module s sensor data out via UDP broadcast The ana log to digital converter is 14 bits on a 400 mV signal which translates to about 24 microvolts 0x61A80 in hex When you use the show q com mand in Command mode the module displays the raw readings However for HTTP web posting and UDP broadcast packets the module shifts the reading by 4 bits which is a divide by 16 resulting in a 16 bit number Therefore if you want the actual voltage sampled you must take the 16 bit number and shift it left by 4 bits to get the number of microvolts If you the value in millivolts and do not need high accuracy right shift by another 6 bits which is the same as dividing by about 1K The packet is 110 bytes of data as shown in Figure 4 1 DS50002230A page 70 2014 Microchip Technology Inc FIGURE 4 1 UDP BROADCAST PACKET BYTE FORMAT Position O 5 6 7 8 9 10 13 14 15 16 17 18 31 32 59 60 91 92 93 94 110 Access Point s MAC Address 6 Bytes Channel 1 Byte RSSI 1 Byte Local TCP Port 2 Bytes RTC Value MSB to LSB 4 Bytes Pin 20 s Battery Voltage in mV e g 2755 2 Bytes GPIO Pin Value 2 Bytes ASCII Time 13 Bytes
95. e scan command as shown in Figure 4 3 2014 Microchip Technology Inc DS50002230A page 71 WiFly Command Reference Advanced Features amp Applications User s Guide FIGURE 4 3 FIND AVAILABLE NETWORKS RSSI Sec 64 Open 58 Open 73 EP 51 WPA2PSK 53 WPAv1i 52 Open If you are connecting to an open network use the join command to associate with the access point The scan list in Figure 4 3 shows that roving1 is an open access point Type join roving1 or join 1 to associate with the network as shown in Figure 4 4 FIGURE 4 4 JOIN THE NETWORK GZ 03 join rovingl Auto Assoc rovingl chan 1 mode 0PEN SCAN OK lt 2 93 gt Associated DHCP va Renew 86400 s 10 listen FAIL If the access point is secure you must set the passphrase prior to issuing the join com mand The module attempts to inquire and determine the access point s security pro tocol you do not need to set the authentication mode To set the WPA passphrase use the set wlan phrase lt string gt command For WEP set the key using the set wlan key lt value gt command Once the module has joined the network successfully it stores the access point s SSID You can save the SSID and the passphrase to the configuration file so that the module can associate with the access point each time it boots 4 3 MAKING CONNECTIONS To connect to the module open an IP socket and connect to the module s IP address You ca
96. e to delete the config file using one of the above mentioned methods might result in the module being unresponsive after downloading the new firmware image Restor ing the module to factory defaults using GPIO9 will recover from this state 2014 Microchip Technology Inc DS50002230A page 83 WiFly Command Reference Advanced Features amp Applications User s Guide 4 6 FTP CLIENT In addition to downloading firmware via FTP with firmware version 2 22 and higher the module can get and put files to an FTP server 4 6 1 Connect to an FTP Server By default the module is configured to download the latest firmware from Microchip s FTP server To configure the module to connect to your own FTP server you must adjust the parameters as described in the example below EXAMPLE 4 16 CONNECT TO AN FTP SERVER set ftp address lt address gt II Set FTP server s IP address Default II is 208 109 78 34 set ftp dir lt string gt Set the directory in the FTP server Default is public set ftp user lt string gt Set the user name set ftp pass lt string gt JI Set the password save JI Save the settings reboot Reboot the module Note This example assumes that the FTP server is already set up and configured correctly and that the module is already configured to associate with a wire less network 4 6 2 Creating Files on the FTP Server Once the module is configured to connect to
97. ee cece cece neeese cece eeseeaeeeeeteeneneeees 24 opt format 23 ee de lat EE 23 Opt D seword nest nn ne retnrnnsneeen nnn 24 Opt replace sasiek nanena niaaa 23 opt SINAN ccs0 sc00 ccc caep ees cbee estes sceeee sae dE tenes 24 ef e 25 Q SONSOM sieve ee ee re es 25 SVS SIE seet geg pred ean Seed 25 SYS autosleep eee cece cece cee eeeeeeeeeceeeeeeeaeeeeees 26 SYS OTUNG ege ege Eet eege D 26 SYS IAUNCH_ SUING 0 0 2 eee cece ee ee eeeeee cette eeeeeeeeeeees 26 SVS E eegene Eege dere 27 sys mask OXABCD 1 ou eee eeeceeeeneeeeenteeeeeeeees 28 VEH 28 SYS ul UE 28 E 29 SYS trigger ticket E ets Weta 29 ENT 20 SVS WAKE tee eebe d i EN chews 30 tiMe addlteesg bsisscecsseceecteesete ee secdveedeisseeeeeetenetes 30 time enable ee esate aia 30 tiMe pore ee eee eee 30 He FAW Eege ted EET 31 art Daud si eege cose reese diiri 31 tart TOW 2 2 2 Saves See eege 31 Uart instant irinin iensen inaina a 32 UAE MOUS EEN 32 Uart raw ep erar E a irae 32 Ware e e deg ee 33 Wan atthis seiigis isea an 33 wlan channel isisiisiiiiirnieceeiiieiieiciianeiineenie 34 wlan ext_antenna ccceeeeeceeeeeeeeeeeeeeeeeeeees 34 Wan hide waco ea en Meee 34 WAM JOIN icssscccvecicncteusicresectienseptensvecctessnteeccete athens 34 Wal Kess doe ha ne enari 35 wlan TINKIMON oo eect eee eeeeeneeceeeeeeeeeeeeeeateeeeaaes 35 wani mask ensin niie an eee haaien 36 DS50002230A page 116 2014 Microchip Technology Inc wl n p
98. eeeeeeeeeeeseeeeeeessneaeeeeess passphrase show or hide PB Gece ee ere ee ee EE PING EE pin level status show power SENSON soccsacvssncsheee ss tecsecvieves steccchucscnesceveesudes power up GPIO default setting AN 30 PINE TUNCUONS aieiaiee naana eee taeaieater cats 64 print messages Setting 28 pushbutton mode ssesssesssesnnensneesrnnssrrnn reserse nnn 85 push button WP 87 2014 Microchip Technology Inc DS50002230A page 115 WiFly Command Reference Advanced Features and Applications User s Guide R raw baud rates eee ceeeeeeeee cece eeteeaeeeeeeenaneeess 32 Reading Recommended ss ssssssnsensesssr rr rsssrrrnssee 7 real time ClOCK nssosnneeeeoeseeeneesesereeseeennerereennseee 57 67 real time clock settimng 44 EE EE 44 release noles re tettr te nsrerreeeeeee 107 replacement characher 23 retry UDP inh ee ee 70 RAN MEN 34 RN131 amp RN171 eil le EE 9 configuration err 10 EE E E E E EAT 9 CEET EE 31 RNG 7 EE 37 RSSI set sample number 24 setithreshold naserie ties ecient 24 RSSI SNO es eee eo edly 40 RTC cionu peat iaee Sue 31 57 67 RTS CTS heei aedi ea o eea aa 60 S sample Sensor PINS eeeeeeieerireerrreerrserrnes 90 SAVG E ee E A E E E 45 SCAN EE 44 scan output format firmware 2 22 220 66 firmware 2 36 amp 745 64 Security MOOS iisisti 33 sending data UDP cccceeeeeeeeeeceeeeeeceeeeeeeeeeaees 69 SONSOM tee Een 89 input trigger values 29 pi
99. er lt value gt determines how often to connect to the stored remote host If set to 1 the module makes one attempt to auto connect upon power up If set to 2 or higher auto connect re opens the connection after the connection is closed The default 0 disables the timer Note You must specify the remote host s IP address and port number in the mod ule s configuration file for the auto connect timer to work 3 4 2 2 CLOSING THE TCP CONNECTION The module supports a disconnect timer in both TCP Client and Server mode default mode You can use this timer to close a TCP connection automatically after a specified number of seconds of no transmit or receive data To set the disconnect timer use the set comm idle lt va ue gt command where lt value gt is the number of seconds The default comm idle timer value is 0 which means the module never disconnects when idle For example to close the TCP connection after 5 seconds of inactivity use the set comm idle 5 command 3 5 WAKE ON SENSOR INPUT Four sensor inputs 0 to 3 wake the module from sleep These pins have a small cur rent source that is activated in Sleep mode This source is approximately 100 nA and causes the input to float up to about 1 2V DC If for example SENSE1 is enabled pull ing the SENSE1 pin to ground wakes the device To enable the sensors to wake the module use the command set sys trigger lt mask gt where lt mask gt is a bit mapped setting o
100. es 60 wakeup trigger Setting 29 Warranty Registration n e 7 web application la N EE 26 web server connect automatically 0 000 ee eeeeeeeees 75 76 POSE DIM ANY edd SES tee 76 retrieve datimi arei 74 web server configuration ceeeseeeeeeeeeteeeees 51 WEP C E E E EEE E E T WEPH1 28 EE EEE EEE EAT Wi Fi protected setup Wi Fi transmit power Setting 37 wireless data rate setting c ceeeeeseeeeeeeeeeeeee 36 WLAN authentication Setting 33 channel mask Setting 0 00 cece eeeeeeeeeeeeteeeeees 36 2014 Microchip Technology Inc DS50002230A page 117 WiFly Command Reference Advanced Features and Applications User s Guide channel setting 34 display settings ccceeceeeceeeeeeeeeeteeeeeeeeeees 38 external antenna settng 34 hide WEP key setting nenene 34 JOIN SOWN EE 35 link Monitor Setting 35 passkey Setting cccccccceceeeseeeeeeeeeeeeeeeeees 35 passphrase Setting c cceeeeeeseeeeeeeeeneeeeees 36 SSID Setting eh Eesen a Sei a eee 37 Wi Fi transmit power Setting 37 wireless data rate setting snsnssse ne neeeeeee 36 WPA PEE AE O 33 WARS eege e n N eg e ER WDEK ge eech E Saket edad 33 Oe 87 launch application ccceeceeseeeeeeeeeeee 26 88 Statls LEDS tiv seas rrio ea dee 89 WWW Address 007 ileal ee ee 7 DS50002230A page 118 2014 Microchip Technology Inc Index 2014 Microchip Technology Inc
101. es only to the RN171 module it is not applicable to the RN131 The transmit power on the RN131 is fixed to 18 dBm If you send this parameter to the RN1371 it issues an error message ERR Bad Args Default 0 Example set wlan tx 11 JI Set the TX power to 11 dBm 2 3 85 set wlan user lt string gt This command sets the EAP user name This command is reserved for future develop ment and is unused 2 4 GET COMMANDS These commands begin with the keyword get and they display the module s current values Except where noted the get commands do not have any parameters 2 4 1 get apmode This command displays the apmode settings Example get apmode H Show apmode settings 2 4 2 get broadcast This command displays the broadcast UPD address port and interval Example get broadcast H Show broadcast UDP information 2014 Microchip Technology Inc DS50002230A page 37 WiFly Command Reference Advanced Features amp Applications User s Guide 2 4 3 get com This command displays the communication settings Example get com H Show communication settings 2 4 4 get dns This command displays the DNS settings Example get dns H Show the DNS information 2 4 5 get everything This command displays all of the configuration settings which is useful for debugging Example get everything H Show all configuration settings 2 4 6 get ftp This command displays the FTP settings Example get ftp JI Show the FTP settings 2 4 7 get ip
102. eset function Then toggle GPIO9 five 5 times which restores the configuration to the factory reset GPIO9 is sampled at about 1 Hz therefore if you are using a CPU to generate the signal make sure that GPIO9 transitions high to low or low to high are at least 1 second long 2014 Microchip Technology Inc DS50002230A page 93 WiFly Command Reference Advanced Features amp Applications User s Guide You can specify a user configuration file as the factory reset settings Prior to this firm ware version only the hardcoded factory defaults would be restored If you have stored a configuration file named user the module reads it as the factory default instead of using the factory hardcoded defaults If no user configuration file is present the module uses the hardcoded factory defaults You create the user configuration file using the save user command which saves the current configuration settings into a file named user Even if a user configuration file exists arming and toggling GPIO9 seven times over rides the user settings and restores the module to the factory hardcoded defaults This bypass mechanism allows you to restore the factory defaults in case a bad configura tion is saved into the user file Issuing the factory RESET command while in Command mode restores the module to a factory default state Note You must reboot the module or reset it for the new settings to take effect DS50002230A p
103. et sys trigger 4 3 8 set sys trigger 8 Setting the trigger value to 0x20 i e using lt mask gt puts the module to sleep when GPIO8 is pulled high To enable this feature use the set sys trigger 0x20 command This command makes GPIO8 an interrupt pin and puts the module to sleep as soon as it is pulled high regardless of the module s state the module goes to sleep even if it is associating with a network or has an open active TCP connection This command is useful for when the module is failing to associate with network because it is out of range or for any other reason or if the module must be put to sleep quickly Note GPIO8 must be low on power up and stay low until you want to put the mod ule to sleep 2014 Microchip Technology Inc DS50002230A page 29 WiFly Command Reference Advanced Features amp Applications User s Guide Default 0x41 Example set sys trigger 0x8 H Enable wake on sensor input 3 2 3 59 set sys value lt mask gt This command sets the default value of the GPIO pins outputs upon power up where lt mask gt is a hex number representing a bit mapped register The GPIO pins that are configured as outputs can be driven high or low on power up or when the module wakes from sleep The default power up states can be set ONLY for the GPIO pins that are set as outputs Setting the value to 1 makes the default power up state high setting the value to 0 makes the default power up state l
104. et wlan phrase lt string gt rubygirl Sets the passphrase for WPA and WPA2 security modes set wlan number lt value gt 0 Sets the WEP key number 2014 Microchip Technology Inc DS50002230A page 101 WiFly Command Reference Advanced Features amp Applications User s Guide TABLE D 1 SET COMMAND LIST SHEET 4 OF 4 Command Default Description set wlan rate lt va ue gt 12 Sets the wireless data rate set wlan ssid lt string gt roving1 Sets the SSID with which the module associates set wlan tx lt value gt 0 Sets the Wi Fi transmit power where lt value gt is a decimal number from 1 to 12 that corresponds to 1 to 12 dBm set wlan user lt string gt Reserved for future use TABLE D 2 GET COMMANDS Command Description get apmode Displays the Soft AP mode settings get broadcast Displays the broadcast UPD address port and interval get com Displays the communication settings get dns Displays the DNS settings get everything Displays all of the configuration settings which is useful for debugging get ftp Displays the FTP settings get ip lt char gt Displays the IP address and port number settings where lt char gt is the optional parame ter a Using lt char gt returns the current IP address get mac Displays the device s MAC address get option Displays the optio
105. f each sensor For example to wake the mod ule using sensor pin 2 use set sys trig 4 Setting the trigger value to 0 disables all sen sor pins Table 3 9 describes the values to wake the module using individual sensor inputs TABLE 3 9 SENSOR INPUT VALUES Wake on Sensor Input Value Command 0 1 set sys trigger 1 1 2 set sys trigger 2 2 4 set sys trigger 4 3 8 set sys trigger 8 WARNING The voltage on any sensor input CANNOT exceed 1 2V DC or the module will be permanently damaged The sensor inputs are rated 1 2V DC maximum You must use a resistor divider when driving a sensor pin from the other 3V pins such as RX You should use a resistor divider network with a minimum of 24 K in series and 10 K to ground from the UART RX or CTS pin An open drain FET is an appropriate device to tie to the sensor pin as the threshold is about 500 mV You can use additional pull ups to 1 2V DC if the circuit has an imped ance due to leakage current of less than 5 Mohms 500 mv 100 nA Leave unused sensor pins disconnected 2014 Microchip Technology Inc DS50002230A page 59 WiFly Command Reference Advanced Features amp Applications User s Guide 3 6 WAKE ON UART ACTIVITY When the module is in Sleep mode the UART is disabled However the module can wake on UART activity by connecting the sensor pins to the RX data or CTS pin using the appropriate divider resistors as
106. fault 123 Example set time port 1052 Sets the time server port to 1052 2 3 63 set time enable lt val ue gt This parameter tells the module how often to fetch the time from the specified SNTP time server where lt value gt is a decimal number representing minutes The default 0 disables time fetching If lt va ue gt is 1 the module fetches the time only once on power up If lt value gt is greater than 1 the module fetches the time every lt va ue gt minutes Eh DS50002230A page 30 2014 Microchip Technology Inc Default 0 Example set time enable 5 The module fetches the time every 5 minutes 2 3 64 set time raw lt value gt This parameter setting allows you to set the RTC raw value from the console where lt value gt is a decimal number in seconds The RTC ticks at 32 768 Hz Default None Example set time raw 1 H Set to 1 second 2 3 65 set uart baud lt value gt This command sets the UART baud rate where lt value gt is 2400 4800 9600 19200 38400 57600 115200 230400 Note The RN134 evaluation board s RS 232 interface cannot exceed 230 400 baud Default 9600 Example set uart baud 19200 H Sets the baud rate to 19 200 baud 2 3 66 set uart flow lt value gt This command sets the flow control mode and parity where lt value gt is a hex number The setting is in the upper nibble of the hardware flow control setting The default is flow control disabled with parity set to
107. he scan command is not supported when remote configuring the module in soft AP mode with WPA2 PSK encryption enabled It works as expected when WPA2 PSK security is disabled in soft AP mode 4 The UDP broadcast payload of 110 bytes is corrupted due to the increased string length of the version string 5 The RN131 and RN171 modules shipped from factory boot up in soft AP mode wlan join mode 7 Setting the modules to factory default settings puts them back to the default state of wlan join mode 0 2014 Microchip Technology Inc DS50002230A page 105 WiFly Command Reference Advanced Features amp Applications User s Guide NOTES DS50002230A page 106 2014 Microchip Technology Inc WIFLY COMMAND REFERENCE ADVANCED MICROCHIP FEATURES amp APPLICATIONS USER S GUIDE Appendix F Current Firmware Features and Fixes F 1 VERSION 4 41 11 25 2013 BUILD r1046 F 1 1 Features 1 Firmware update over UART using XMODEM 1K protocol 2 Added new optional parameters in FTP update and XMODEM e ftp lt option gt lt filename gt e xmodem lt option gt lt filename gt where lt option gt is r download the firmware only Do not set as boot image if firmware integrity checks pass u download the firmware and set as boot image if firmware integrity checks pass c clean the file system before performing firmware update over FTP or XMODEM 1K protocol This will delete all the files on the Flash file system
108. hrase siosaia 36 EC 36 WIaN SSI WEED 37 Wan DG TEE 37 Set Commandes 14 settings debug print message ssssseeeneeesse reseso 28 Shortener eebe ase baie ee Gees 13 show Dette ry oie acces hi Euet EL SAS AEN ed 39 CDDen 2edetdeed Nett dedeee eral e edd 39 le 39 EE 39 Bee e Eege 40 COXA EE 40 TER 40 Stats gue gees EE 41 Wl 41 show signal strength A 40 Signal strength show 40 ET E E E E A G t echte cay 44 56 UDP aii a e oe 58 sleep timef smpe eeeeceeeceecetceeeeeseeaeeeeeeseeeeeeeeeeeenaees 29 57 SNT Pak alien ae ee ne Ae eis 30 SINT EE 30 67 soft AP mode apmode Commande 42 software invoke configuration web eener seseee 52 SSID replacement character senere 23 dl Le EE 37 Statistics SHOW eege EE ENEE 41 status Commande 39 supported access points nssssse seee neest nene reerr reesen 97 system settings display 38 System LIMETS 2h nren e R Add 57 T TCP close Connection eereerererreeeeen 42 59 CONNECTION paSSWOrd seein 24 connection timer i is 58 OPEN CONNECTION 0 0 0 eee cence ceeeeeeenneeeeeeeeeeeeeees 58 open connection Commande 43 Terminal tabirin en deed 54 IT 44 time server display settings 38 time since mode was last powered or booted 41 time STAMPING isinin 68 timer Hie WEE 30 AULOCONNECH i hoi ee tice leeds ree eee 25 browser deconperct A 55 configuration web server 55 CONNECTION acesi aitse iieri cena tensiuebet paideia 58 idle ee eee 55
109. ife This setting is used when the channel is set to 0 Default Ox1FFF all channels Example set wlan mask 0x0421 H Scans for channels 1 6 and 11 2 3 80 set wlan number lt value gt This command sets the WEP key number The WEP key number must match the key number on the router or access point You only need to set this parameter when using the WEP 64 or WEP 128 security modes This setting is not required if you are using the WPA security mode Default 0 Example set wlan number 1 H Sets the WEP key number to 1 2 3 81 set wlan phrase lt string gt This command sets the passphrase for WPA and WPA2 security modes where lt string gt is 1 to 64 characters 64 bytes The passphrase is alphanumeric and is used with the SSID to generate a unique 32 byte Pre Shared Key PSK which is then hashed into a 256 bit number When you change either the SSID or the passphrase the module re calculates and stores the PSK If you enter exactly 64 characters the module assumes that the passphrase is an ASCII hex representation of the 32 byte PSK and the value is simply stored For passphrases that contain spaces use the replacement character instead of spaces For example my pass word becomes my pass word You can change the replacement character using the set opt replace command Default rubygirl Example set wlan phrase my_password Sets the phrase to my_password 2 3 82 set wlan rate lt value gt This command sets the w
110. in infrastructure mode to detect whether the module is associ ated and in range of the access point This command sets the infrastructure mode link monitor timeout threshold where lt value gt is a decimal number representing the number of failed scans before the mod ule declares Lost AP and deauthenticates e g when the module goes out of the access point s range If you set this parameter to 1 or more the module scans once per second for the access point with which it is associated If the module de authenticates itself from the access point using the link monitor it re attempts the association based on the join policy setting Microchip recommends setting the threshold to 30 attempts because some access points do not always respond to probes If you do not set this parameter there is no way to detect that an access point is no longer present until it becomes available again if ever 2014 Microchip Technology Inc DS50002230A page 35 WiFly Command Reference Advanced Features amp Applications User s Guide To disable the link monitor set lt va ue gt to zero 0 Default 30 Example set wlan linkmon 5 H Set the number of scan attempts to 5 2 3 79 set wlan mask lt mask gt This command sets the WLAN channel mask which is used for scanning channels with auto join policy 1 or 2 where lt mask gt is a hex number bit 0 channel 1 Reducing the number of channels scanned for association increases battery l
111. in ms the join function waits for the access point to complete the association process set opt replace lt char gt 0x24 Sets the replacement character you use to indicate spaces in the SSID and passphrases where lt char gt is a single character set opt password lt string gt no password Sets the TCP connection password required set opt signal lt value gt 0 Configures the threshold level for the RSSI value in infrastruc ture mode set q power lt value gt 0 Automatically turns on the sensor power set q sensor lt mask gt 0 Specifies which sensor pins to sample when sending data using the UDP broadcast packet or the HTTP auto sample function set sys autoconn lt value gt 0 Sets the auto connect timer in TCP mode set sys autosleep lt value gt 0 Sets the auto sleep timer in UDP mode set sys iofunc lt mask gt 0x0 Sets the I O port alternate functions set sys launch_string lt string gt web_app Sets the application to launch when GPIO9 is high after power up DS50002230A page 100 2014 Microchip Technology Inc TABLE D 1 SET COMMAND LIST SHEET 3 OF 4 Command Default Description set sys mask lt mask gt 0x20F0 RN131 0x21F0 RN171 Sets the I O port direction set sys printlvl lt value gt 0x1 Controls the debug print messages printed by the WiFly mod ule on the UART se
112. including user defined configuration files except the current boot image and the factory default boot image 3 Added WPA2 PSK personal security to soft AP mode The soft AP commands are organized as follows set ap ssid lt string gt e set ap passphrase lt string gt set ap link_monitor lt time in seconds gt 4 Added anew command to invoke a temporary soft AP network does not survive sleep or power cycle apmode lt ssid gt lt channel gt lt passphrase gt where lt channel gt optional parameter Sets the channel to create the soft AP net work Defaults to channel 1 lt passphrase gt optional parameter must be eight characters or more Enables soft AP secure mode Deprecated set wlan fmon lt time in seconds gt command 6 Added updates to configuration web server Added the ability to configure the module for infrastructure and soft AP mode Updated web pages for better display on mobile devices Added a timeout message to indicate the web server has timed out 7 Removed the ability to set the join mode to ad hoc mode illegal combination via the set wlan join 4 command 8 Added the ability to handle special characters such as tab carriage return new line and space on command line in web app ONLY All special characters are delimited with a backslash character followed by a single character The fol lowing special characters are supported n New line e r Carriage return e s Space t Tab
113. ing with access points using the HTML client feature upgrading the firmware over FTP etc Appendix A Default Configuration This chapter provides the default config uration information Appendix B Boot Up Timing Values This chapter provides the boot up tim ing information 2014 Microchip Technology Inc DS50002230A page 5 WiFly Command Reference Advanced Features amp Applications User s Guide e Appendix C Supported Access Points This chapter provides a listing of supported access points e Appendix D Command Quick Reference Guide This chapter provides a quick reference of all configuration commands e Appendix E Known Problems in Firmware Version 4 40 This chapter describes known firmware problems e Appendix F Current Firmware Features and Fixes This chapter provides release notes for the firmware CONVENTIONS USED IN THIS GUIDE This manual uses the following documentation conventions DOCUMENTATION CONVENTIONS Description Represents Examples Arial font 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 Save project before build dialog Underlined italic text with A menu path File gt Save right angle bracket
114. ings take effect TABLE 3 8 METHODS OF CONNECTING TO A REMOTE HOST Method Type Description Auto connect Internal RTC Connect to the host at specific time intervals based upon the set sys autoconn timer lt value gt command setting Open UART In Command mode issue the open command Connect on UART UART mode 2 This mode is designed for the HTML client feature Use the set uart mode 2 data command to connect the to host automatically wnen UART data is received GPIO5 Alternative Set the alternative functions for GPIO4 GPIO5 and GPIO6 see GPIO func Section 3 1 2 6 GP1IO4 5 and 6 Alternative Functions Set GPIO5 tions high to trigger a TCP connection and low to disconnect 3 4 SYSTEM AND AUTO CONNECT TIMERS The WiFly module uses a real time clock RTC to generate timers The RTC is active even when the module is asleep allowing you to put the module to sleep and wake it based on timer intervals The module has the following timers e Sleep timer Used to put the module to sleep It is a 32 bit number which corre sponds to a maximum 1 19 million waking hours The sleep timer is set with the set sys sleep lt va ue gt command where lt value gt is a decimal number represent ing seconds Wake timer Used to wake the module It is a 22 bit number which corresponds to a maximum sleep time of 1 165 hours The wake timer is set with the set sys wake lt va ue gt command where lt va
115. ion Event the microprocessor wants to open a TCP connection to the stored remote host This signal instructs the microprocessor that Event The WiFly module successfully opens the the TCP connection is open and it can begin sending receiving data over the TCP link To close the connection the microprocessor SE le an access point and has a valid IP address The WiFly module is instructed to open a TCP IP EE connection to the stored remote host GPIO6 High by WiFly Module TCP connection to the stored remote host 3 7 SETTING DEBUG PRINT LEVELS You can enable print functions to assist with debugging the operation and status of the module The set sys printlvl lt value gt command controls these additional print func tions where lt value gt is a bit mapped register that controls which printout messages are sent to the UART See Section 2 3 55 set sys printlvl lt value gt for more infor mation 3 7 1 Scan Output Format You enable the scan output using the set sys printlvl 0x4000 command The scan out put format differs depending on the firmware you are running DS50002230A page 64 2014 Microchip Technology Inc 3 7 1 1 FIRMWARE VERSION 2 36 AND HIGHER Firmware version 2 36 and 2 45 support a comma delimited scan output format which a microprocessor can use to parse the RSSI information The scan command output format is Index Channel RSSI Security Capabilities WPA Configuration
116. ireless data rate where lt va ue gt is a value shown in Table 2 15 Lowering the data rate increases the effective range of the module TABLE 2 15 SET WLAN RATE COMMAND OPTIONS Value Wireless Data Rate Mbits second 0 1 1 2 2 5 5 3 11 4 7 Invalid 8 6 9 9 10 12 11 18 DS50002230A page 36 2014 Microchip Technology Inc TABLE 2 15 SET WLAN RATE COMMAND OPTIONS Value Wireless Data Rate Mbits second 12 24 default 13 36 14 48 15 54 Default 12 Example set wlan rate 13 H Set the data rate to 36 Mbits second 2 3 83 set wlan ssid lt string gt This command sets the SSID with which the module associates where lt string gt is 1 to 32 characters 32 bytes Note lt string gt cannot contain spaces If the SSID has spaces use the charac ter to indicate the space For example yellow brick road becomes yel low brick road When you use the get wlan command to view the SSID the module properly displays it as SSID yellow brick road Default roving Example set wlan ssid my_network H Set the SSID to my_network 2 3 84 set wlan tx lt value gt This command sets the Wi Fi transmit power where lt value gt is a decimal number from 1 to 12 that corresponds to 1 to 12 dBm The default 0 corresponds to 12 dB which is the maximum TX power Setting the value to 0 or 12 sets the TX power to 12 dBm Note This command appli
117. is sent to the local UART when the TCP port is closed where lt string gt is one or more characters up to a maximum of 32 32 bytes If you do not wish to use a string use a zero 0 as the lt string gt parameter Default CLOS Example set comm close port closed Set the string to port closed 2 3 14 set comm open lt string gt This command sets the ASCII string that is sent to the local UART when the TCP port is opened where lt string gt is one or more characters up to a maximum of 32 32 bytes If you do not wish to use a string use a zero 0 as the lt string gt parameter Default OPEN Example set comm open port open H Set the string to port open 2 3 15 set comm remote lt string gt This command sets the ASCII string that is sent to the remote TCP client when the TCP port is opened where lt string gt is one or more characters up to a maximum of 32 32 bytes If you do not wish to use a string use a zero 0 as the lt string gt parameter Default HELLO Example set comm remote welcome Set the string to welcome 2 3 16 set comm idle lt value gt This command sets the idle timer value where lt value gt is a decimal number represent ing the number of seconds The idle timer value is the number of seconds during which no data is transmitted or received over TCP before the connection is closed automati cally Setting the timer to 0 the default means the module never disconnects when
118. isted for the network in the scan list If the network is security enabled you must set the passphrase with the set wlan phrase command prior to issuing the join command Example join 1 Join the network indicated by a 1 in the scan list 2 6 8 leave This command disconnects the module from the access point to which it is currently associated Example leave H Disconnect from the access point 2 6 9 lookup lt string gt This command causes the module to perform a DNS query where lt string gt is the host name for which to search Example lookup roving1 JI Search for the host roving1 2 6 10 open lt address gt lt value gt This command opens a TCP connection to lt address gt where lt value gt is the port num ber and lt address gt is an IP address in the form lt value gt lt value gt lt value gt lt value gt with lt value gt being a number between 0 and 255 If you do not use the lt address gt and lt value gt parameters the module attempts to connect to the stored remote host IP address and remote port number lt address gt can also be a DNS host name that the module attempts to resolve Default Stored remote IP address and port Example open 10 20 20 62 2000 H Open a connection to 10 20 20 62 JI port 2000 2 6 11 ping lt string gt lt value gt This command pings a remote host where lt string gt is one of the parameters shown in Table 2 17 and lt value gt is the number of pings to send
119. le Edit Setup Control Window Help New connection Alt N Duplicate session Alt D Cygwin connection Alt G Log Apr 15 2013 15 19 43 o Seidel sia hes 1 44 8a Send file Transfer b Kermit Change directory XMODEM Receive Replay Log ZMODEM Send LogMelT 6 Plus i Quick VAN Print Alt P Disconnect Exit Alt Q nes cee e 6 Check the 1K option enter the img or mif file path and click the Open button DS50002230A page 86 FIGURE 4 7 L Tera Term XMODEM Send m Lookin s KINGSTON E e EE Die Name k Date modifiec Trash 1000 3 5 2013 8 02 J SCAN_00 3 21 2013 5 5 J wifly_mcu_test_server 9 21 2012 2 0 J witly 306 3 1 2013 7 43 RH EPSILON SDK C 0 5 0 L tar gz 12 17 2012 4 d II b File name wifly7 410b mij Files oftype NC z Cancel Help Option Checksum CRE 1K 2014 Microchip Technology Inc 7 The new firmware and or web files will download to the module If everything was successful you should see something like lt 4 40 gt XMOD OK At this point the firmware should be downloaded to the module Run the 1s command to ensure everything worked properly Note There is a default 30 second timeout from when the xmodem command is issued To disable this timeout enter the command set ftp timeout 0 4 8 WI FI PROTECTED SETUP WPS Wi Fi Protected Setup WPS is a standard for easy and secure establishment of
120. ltiple Image Format Files Firmware Versions 4 0 and Higher Firmware version 4 0 and higher introduces support for Multiple Image Format mif files mif files contain the firmware image img and associated applications and files to support all the features of firmware versions 4 0 and higher Firmware versions 4 0 and higher can unpack the mif file and install the applications and files into the mod ule s Flash memory Download the mif file using the command ftp update wifly3 400 mif For RN131 module ftp update wifly7 400 mif For RN171 module After downloading the mif file the module unpacks it and automatically reboots into the new boot image with all of the associated files installed into the module s Flash memory Table 4 3 describes these files TABLE 4 3 FIRMWARE AND ASSOCIATED APPLICATIONS VERSION 4 0 AND HIGHER File Name Description Comments wifly_EZX 2 45 Firmware image Filenames starting in wifly are typically firmware wifly EZX 307 files img images wifly EZX 400 wps_app EZX 131 eap_app EZX 101 web_app EZX 105 Application files These application files are used for specific mod ule features web_config html HTML files These files are used for the configuration web link html server feature logo png Logo file Logo displayed on web pages Used for the con figuration web server feature config Configuration file The config file stores the module s boot up
121. lue LED on the RN 134 board because it is connected directly to power 2 GPIO9 can be used for factory Reset Soft AP mode or Web Config mode DREES DS50002230A page 62 2014 Microchip Technology Inc 3 6 2 2 SETTING THE ALTERNATE GPIO FUNCTIONS WITH SET SYS IOFUNC The GPIO4 5 and 6 default function is to control the LEDs You can override the default to allow user programmable UO or alternate I O functionality by using the set sys iofunc lt mask gt command where lt mask gt is entered as a hex number The hex value represents a bitmask that controls each bit in the lt mask gt and represents a par ticular GPIO pin If a bit is 0 then the corresponding GPIO pin is driven read by the firm ware per the default function The I O function lt mask gt is encoded as shown in Table 3 11 TABLE 3 11 GPIO PIN ALTERNATE FUNCTION BITMASK Bit Signal Name Direction Function 0 GPIO4 Output Disable the LED function so the I O can be used as a GPIO pin 1 GPIO5 Output Disable the LED function so the I O can be used as a GPIO pin 2 GPIO6 Output Disable the LED function so the I O can be used as a GPIO pin 3 Unused 4 GPIO4 Output This pin goes high after the module has associated authenticated and has an IP address 5 GPIO5 Input Set this pin high to trigger a TCP connection and low to disconnect 6 GPIO6 Output This pin goes high when the module is connected over TCP and low
122. lue gt 0 Sets the reboot timer set apmode ssid lt string gt NULL This command sets the soft AP mode network name SSID to be broadcast where lt string gt is the SSID set broadcast address 255 255 255 255 Sets the address to which the UDP hello heartbeat message is lt address gt sent set broadcast backup 0 0 0 0 Sets the secondary broadcast backup address lt address gt set broadcast interval lt mask gt 7 Sets the interval in seconds at which the hello heartbeat UDP message is sent set broadcast port lt value gt 55555 Sets the port to which the UDP hello heartbeat message is sent set broadcast remote lt port gt 0 Sets the secondary broadcast port set comm lt char gt Sets character used to enter command mode to lt char gt set comm close lt string gt CLOS Sets the ASCI string that is sent to the local UART when the TCP port is closed set comm idle lt value gt 0 Sets the idle timer value in seconds set comm match lt value gt 0 Sets the match character in hex or decimal lt hex gt set comm open lt string gt OPEN Sets the ASCI string that is sent to the local UART when the TCP port is opened set comm remote lt string gt HELLO Sets the ASCI string that is sent to the remote TCP client when the TCP port is opened set comm size lt value gt 64 Sets the flush size in bytes set comm time lt va ue gt 5 Sets the flush timer set dhcp lease lt value gt 86400 Sets the soft AP mode DH
123. lue gt is a decimal number representing sec onds Auto connect timer Used to open a TCP connection automatically Idle timer Used to close a TCP connection automatically 2014 Microchip Technology Inc DS50002230A page 57 WiFly Command Reference Advanced Features amp Applications User s Guide The sleep and wake timers are responsible for putting the module to sleep and waking it up If the sleep timer is enabled the module automatically goes into Deep Sleep Low Power mode once the timer counts down to 0 The sleep timer is disabled if the module has an IP connection or is in Command mode For example if you want the module to wake up join a network and be available to accept TCP connections for 30 seconds every 2 minutes you would set the timers as shown in the following example set wlan ssid my_net H Set the host name set wlan passphrase my_pass Set the passphrase set sys sleep 30 H Module sleeps after being awake for 1130s set sys wake 90 H Module wakes after sleeping for 90 s save II Save the settings reboot H Reboot Figure 3 7 shows the transitions between the sleep and awake state based on the sleep and wake timer settings in the previous example FIGURE 3 7 90 SLEEP AND AWAKE STATE TRANSITIONS Awake State Sleep State L_ pm Sleep Timer Wake Timer Sleep Timer 30s 90s 30s 3 4 1 UDP Sleep and Connection Timers In UDP Only Protocol mode se
124. machine however the same concepts apply to any device with a Wi Fi interface e g iPhone Android smartphones tablets or PCs running a web browser e g Chrome Firefox or Safari To configure the module using a web browser perform the following steps 1 Associate your PC to the module s AP network Figure 3 3 shows a screen shot displaying the network name FIGURE 3 3 MODULE S NETWORK NAME P a Currently connected to SS WiFly EZX 51 No Internet access Dial up and VPN a 3G Connection x Wireless Network Connection a iFly EZX 51 Connected s rohot ac all 2WIRE767 will rohot al dantooine al ShyCat d Open Network and Sharing Center 2 Launch your web browser 3 Type http config to go to the home page of web server running on the module The page has two tabs displayed by default Network Configuration Used to set the AP s SSID and passphrase Information Displays information about the WiFly module This tab displays the following information WiFly module s MAC address Module type RN131 or RN171 List of files on the file system Battery strength 4 Click the Network Configuration tab see Figure 3 4 In this tab you configure the module s network settings SSID and passphrase Configure these settings using the following steps a Enter your network s SSID in the Access Point SSID box Alternatively click the Refresh List button
125. mand mode If used in local mode the baud rate changes and the module sends AOK using the new baud rate If the host switches to the new baud rate immediately the host may see the AOK string at the new baud rate Depending on the baud rate it takes at least ten times the bit rate for the module to issue the first character Default Not applicable Example set uart instant 19200 H Sets the baud rate to 19 200 baud 2 3 68 set uart mode lt mask gt This command sets the UART mode register where lt mask gt is a hex number masking a bit mapped value as shown in Figure 2 7 FIGURE 2 7 SET UART MODE COMMAND BIT MAPPED REGISTER 76543210 0 0 0 Command echo 0 Enabled 1 Disabled Data trigger 0 Disabled 1 Make TCP connection upon UART RX data Sleep on RX break signal 0 Disabled 1 Enabled UART RX data buffer 0 When TCP connection closes buffer is flushed 1 When TCP connection closes buffer holds data until If more data is received buffer is flushed If no data is received and a new connection is made buffer is transmitted Command prompt 0 Version string lt x xx gt 1 Replacement character Default 0 Example set uart mode 0x10 H Enable the UART data buffer 2 3 69 set uart raw lt value gt This command sets a raw UART value where lt va ue gt is a decimal number represent ing the baud rate You use this c
126. me Host name address in seconds Figure 3 1 shows example output from the show lease command FIGURE 3 1 SHOW LEASE COMMAND EXAMPLE OUTPUT lt 2 42 gt show lease 3 10 0 cbiali2b 63 59 153 11 00 00 00 00 00 00 0 12 00 00 00 00 00 00 0 13 00 00 00 00 00 00 0 14 00 00 00 00 00 00 0 15 00 00 00 00 00 00 0 1 2 3 16 00 00 00 00 00 00 0 lt 2 42 gt N NM N NB NB NY NY WWW WwW Ww Note In AP mode the module can assign a DHCP lease to 7 clients However not all clients report the host name In this case the module reports the name as an asterisk Once a client is associated to the network it can open a TCP connection to the Microchip module After successfully opening a TCP connection the client receives a HELLO message The module prints OPEN on the UART indicating an open TCP connection 3 1 2 2 CHECK FOR THE LAST CONNECTED DEVICE OVER TCP In some cases it is beneficial to know the IP address of last device that connected to the module over TCP or the last device to which the module connected over TCP To find this address use the show z command This command does not survive a power cycle or reboot Upon power up if no device is connected over TCP the show z command returns 0 0 0 0 2014 Microchip Technology Inc DS50002230A page 49 WiFly Command Reference Advanced Features amp Applications User s Guide 3 1 2 3 VIEW ASSOCIATED DEVICES T
127. module uses the previous IP settings If the lease has expired the module attempts to associate and uses DHCP to obtain the IP settings The DHCP cached IP address does not survive a power cycle or reset Default 1 Example set ip dhcp 0 Turns DHCP off 2 3 35 set ip flags lt mask gt This command sets the TCP IP functions where lt mask gt is a hex number referring to a bit mapped register See Figure 2 1 FIGURE 2 1 SET IP FLAGS COMMAND BIT MAPPED REGISTER 7 6 5 4 3 2 1 0 L TCP connection status See Notes 1 2 Bypass Nagle algorithm and use TCP_NODELAY TCP retry enabled for a total of 96 packet retries UDP RETRY attempts retry if no ACK from UDP DNS host address caching enabled ARP table caching enabled UDP auto pairing enabled Add 8 byte timestamp to UDP or TCP packets Note 1 Ifthe module loses the link to an associated access point while a TCP con nection is active the TCP connection may hang or be in an inconsistent state In some cases the TCP connection will not recover In firmware ver sions 2 20 and higher if the module regains the link to the access point within 60 seconds the TCP connection will survive 2 In firmware prior to version 2 20 bit 0 specified the TCP copy function If bit O is set the default TCP connections are kept open when the connection to the access point is lost If bi
128. module will automatically boot into the new image Step 2 factory RESET reboot During the FTP update procedure you will see the following over the UART console lt 4 40 gt ftp cupdate wifly7 440 mif wifly EZX 405 config Dn Os reboot 8 logo png L 13 wps_app EZX 131 L 14 eap_app EZXx 105 L 15 web_app EZX 112 L 16 web_config html L 17 link html connecting to 198 175 253 161 q q q q q q q q q vooo dE EI El Fi Si mm mmm m RTP files leiere UPDATE OK Reboot wifly EZX Ver 4 40 Build r1018 Oct 31 2013 09 45 31 on RN171 MAC Addr 00 06 66 71 0f d4 READY Note 1 If the module does not have internet access or is unable to contact the FTP server it will still perform the file system clean 2 If you do not want to do the file system cleanup prior to the FTP update do not specify the cleanup in the ftp update command 3 Itis recommended to initialize the module with factory default settings after a successful FTP update in order to avoid the BAD CONFIG mes sage due to a configuration file mismatch between old and new firmware versions AWARNING When updating the module image from version 4 40 to a lower version it is required to use the ftp cu lt filename gt command to delete the existing config file prior to download ing the new image Alternatively you can also use the del config command followed by the ftp u lt filename gt command Failur
129. n its configuration settings if the auto join feature is enabled In firmware version 4 0 and higher the auto join feature is disabled by default Enable it using the ASCII command set wlan join 1 You can disable the auto associate feature default behavior using the set wlan join 0 command This command prevents the WiFly module from attempting to associate with a network that does not exist 2014 Microchip Technology Inc DS50002230A page 11 WiFly Command Reference Advanced Features amp Applications User s Guide NOTES DS50002230A page 12 2014 Microchip Technology Inc WIFLY COMMAND REFERENCE ADVANCED MICROCHIP FEATURES amp APPLICATIONS USER S GUIDE Chapter 2 Command Reference WiFly modules support a variety of commands for configuration This section describes these commands in detail and provides examples 2 1 COMMAND SYNTAX To issue commands to the module you send a keyword followed by optional parame ters Commands are case sensitive and you cannot use spaces in parameters Use a to indicate a space e g MY NETWORK should be written as MY NETWORK Hex input data can be uppercase or lowercase String text data such as the SSID is case sensitive You can use shorthand for the parameters For example the following commands are equivalent e set uart baudrate 115200 e set uart b 115200 e set u b 15200 Note You cannot use shorthand for command keywords For example s uart baud
130. n use telnet to test the connection type open lt address gt lt port gt in a telnet win dow After the connection is open you can type characters into the UART window and see them on the telnet window or vise versa EXAMPLE 4 4 OPEN A CONNECTION open 10 20 20 62 2000 JI Open host shown in Figure 4 4 To make a connection from the module you need your server application s IP address and port number A COM port redirector is a simple program you can use to test this functionality This software opens an IP port and transfers all data it receives to a spec ified COM port on your machine A free COM port redirector program for Windows is available from Pira at http www pira cz eng piracom htm In your COM port redirector program note your computer s IP address e g by typing the ipconfig command in the Microsoft Command Window Go to your terminal emu lator and put the module into Command mode Type the open lt address gt lt port gt com mand The server reports that the connection is open and you can type characters into the UART window and see them on the server window or vice versa DS50002230A page 72 2014 Microchip Technology Inc 4 3 1 Setting Up Automatic Connections Some applications require the module to connect to a remote server send data and then disconnect automatically upon power up or wake up You can configure the mod ule to perform this functionality automatically Set the network SS
131. n voltage settings cccceeeeeteeeeeeeeeereeees 25 post data to web 77 post data to web example ssssessssssseresneerene 78 POW OM etic deck cals eege ENEE SEENEN 25 90 SAMple Pinsin na ae et 90 setting pins to sample 25 wake on Input 59 set adhoc Probe sasse ei e 14 adhoc reboot rrn p ia 14 broadcast address 0 ececeeeeeeeeeeceeeeeeeeeteeeees 15 broadcast backup 15 broadcast Interval 16 broadCastiport e a nein eens 16 broadcast remote nsesssesnseesseren neseser nn neern ne 16 COMM EE 16 COMM COSO nnii a irel 17 COMM IMG EE 17 COMM MACH E 17 COMM OPEM p a a e eea E 17 COMM FEMO1E snn ipi 17 El AE 17 COMI TMG EE 18 dns address cece cece cece eeeeeeeeeeeseaeeeeeeeeeaees 18 CNS backup e a aaa e nean ES 18 el 18 ftp addr ri iiia aiae 19 UK e 19 ftp filenna ME see se 2 cectizee seg devesseectaubeseabitcxesccdhetenee 19 Tip mode iiini e idadi stein 19 TIP PASS eier AAe ege EE ee eee genge 20 UC le 19 MO TIMNG Sa ieee gate een Sah oe as 19 fip USEF eet atc eR ee ae 20 IP ACESS vz hs ee ae 20 IP BACKUP E i iesl E 20 IP ONG E 20 ip flags riese aa 21 ip gateway eceeeecceeeeeceeeceeeeeeeeeeeeeseneeaeeeeeseaes 21 IP NOSTA EG 21 gl ele 22 IP MEMMASK 32 42 5222525 dacs A ses acv iirinn aas 22 ip Proto sei Sie lee eens 22 IP TOMO 5 c2 20ch25 2 cecatesdeces tas chavesstasestengeccbehenne 22 Ip tCP MOde sde Eege Reeg 22 opt averagde re 24 Opt deviceid 20 e
132. nal settings such as the device ID get sys Displays the system settings sleep and wake timers etc get time Displays the time server UDP address and port number get wlan Displays the SSID channel and other WLAN settings get uart Displays the UART settings ver Displays the firmware version TABLE D 3 STATUS COMMANDS Command Description show battery Displays current battery voltage and is only applicable to Microchip s battery powered products such as the RN370 and temperature sensors ISENSOR CB show connection Displays the connection status in the hex format 8 lt XYZ gt show io Displays the GPIO pins level status in the hex format 8 lt ABC gt show net lt char gt Displays the current network status association authentication etc where lt char gt is the optional parameter n Using the n parameter displays only the MAC address of the access point with which the module is currently associated show q lt value gt Displays the value of the analog interface pin where lt value gt is 0 to 7 show q 0x1 lt mask gt Displays multiple analog interface values simultaneously show rssi Displays the last received signal strength show stats Displays the current statistics packet RX TX counters etc show time Displays the number of seconds since the module was last powered up or rebooted TABLE D 4 ACTION COMMANDS Command Description Use this command to enter Comma
133. nd mode apmode lt bssid gt lt chan nel gt Creates a soft AP network close Disconnects a TCP connection exit Exits command mode DS50002230A page 102 2014 Microchip Technology Inc TABLE D 4 ACTION COMMANDS Command Description factory RESET Loads the factory defaults into the module s RAM and writes the settings to the standard configuration file You must type the word RESET in capital letters join lt string gt Instructs the WiFly module to join the network indicated by lt string gt join lt value gt Use this command to join a network that is shown in the scan list where lt value gt is the entry number listed for the network in the scan list leave Disconnects the module from the access point to which it is currently associated lookup lt string gt Causes the module to perform a DNS query for host name lt string gt open lt address gt lt value gt Opens a TCP connection to lt address gt where lt value gt is the port number ping lt string gt lt value gt Pings a remote host where lt string gt is a parameter setting and lt va ue gt is the number of pings The default is 1 packet reboot Forces the module to reboot similar to a power cycle run Runs an application using ASCII commands scan lt value gt lt char gt Performs an active probe scan of access points on all
134. ng Kong SAR Tel 852 2943 5100 Fax 852 2401 3431 China Nanjing Tel 86 25 8473 2460 Fax 86 25 8473 2470 China Qingdao Tel 86 532 8502 7355 Fax 86 532 8502 7205 China Shanghai Tel 86 21 5407 5533 Fax 86 21 5407 5066 China Shenyang Tel 86 24 2334 2829 Fax 86 24 2334 2393 China Shenzhen Tel 86 755 8864 2200 Fax 86 755 8203 1760 China Wuhan Tel 86 27 5980 5300 Fax 86 27 5980 5118 China Xian Tel 86 29 8833 7252 Fax 86 29 8833 7256 China Xiamen Tel 86 592 2388138 Fax 86 592 2388130 China Zhuhai Tel 86 756 3210040 Fax 86 756 3210049 ASIA PACIFIC India Bangalore Tel 91 80 3090 4444 Fax 91 80 3090 4123 India New Delhi Tel 91 11 4160 8631 Fax 91 11 4160 8632 India Pune Tel 91 20 3019 1500 Japan Osaka Tel 81 6 6152 7160 Fax 81 6 6152 9310 Japan Tokyo Tel 81 3 6880 3770 Fax 81 3 6880 3771 Korea Daegu Tel 82 53 744 4301 Fax 82 53 744 4302 Korea Seoul Tel 82 2 554 7200 Fax 82 2 558 5932 or 82 2 558 5934 Malaysia Kuala Lumpur Tel 60 3 6201 9857 Fax 60 3 6201 9859 Malaysia Penang Tel 60 4 227 8870 Fax 60 4 227 4068 Philippines Manila Tel 63 2 634 9065 Fax 63 2 634 9069 Singapore Tel 65 6334 8870 Fax 65 6334 8850 Taiwan Hsin Chu Tel 886 3 5778 366 Fax 886 3 5770 955 Taiwan Kaohsiung Tel 886 7 213 7830 Taiwan Taipei Tel 886 2 2508 8600 Fax 886 2 2508 0102 Thailand Bangkok Tel 66 2 694
135. nnection is open when it goes low the connection is closed Use the command set sys iofunc command to enable GPIO6 EXAMPLE 4 6 USE GPIO5 AND GPIO6 TO CONTROL CONNECTIONS set sys iofunc 0x20 II Enable GPIO5 set sys iofunc 0x40 H Enable GPIO6 4 3 3 Using DNS Settings The module contains a built in DNS client If you do not specify the host s IP address i e it is set to 0 0 0 0 the module uses DNS protocol When you set the host name using the set dns name lt string gt command the module automatically attempts to resolve the host address When the address is resolved the module connects automat ically To manually look up a host s IP address use the lookup lt string gt command where lt string gt is the hostname EXAMPLE 4 7 USE DNS set dns name my_server H Set the DNS host name to my_ server 2014 Microchip Technology Inc DS50002230A page 73 WiFly Command Reference Advanced Features amp Applications User s Guide 4 3 4 Using the Backup IP Address Connect Function The module contains a feature for auto retry and redundancy If the host s first IP address connection fails the module uses the backup IP if set If this fails or is not set the module uses the first DNS name If this fails or is not set the module uses the backup DNS name if set EXAMPLE 4 8 SET THE BACKUP IP ADDRESS set ip backup lt address gt Set the backup IP address EXAMPLE 4 9 SET T
136. nology Inc DS50002230A page 109 WiFly Command Reference Advanced Features amp Applications User s Guide F 3 2 Bug Fixes Fixed a bug wherein the UART would occasionally lock up upon performing the factory RESET command and while telnet session was in progress Fixed a bug in soft AP mode wherein the module would close the TCP connection upon another client being deauthorized Fixed an issue with the link monitor in AP mode to correctly age out stale clients Fixed an issue that would cause the module to crash due to a high speed optimi zation error D D F 4 VERSION 2 36 2 45 9 14 2012 Firmware versions 2 36 and 2 45 are being shipped together Version 2 36 sup ports ad hoc mode while version 2 45 supports soft AP mode All modules shipped with these firmware versions will run version 2 36 by default to maintain backward compatibility with previous firmware versions e You can change the firmware image using the boot image lt va ue gt command After you change the boot image you MUST reset the module back to the factory defaults using the factory RESET and reboot commands Wifly_EZX 236 img Ad hoc mode firmware for RN171 Wifly_GSX 236 img Ad hoc mode firmware for RN131 Wifly_EZX 245 img Soft AP mode for RN171 Wifly_GSX 245 img Soft AP mode for RN131 In firmware version 2 36 ad hoc version the auto join feature is enabled to main tain backwards compatibility In version 2 45 auto join is disabled
137. nticates the inactive client Setting this timer to a low value e g 10 seconds can result in client devices frequently deauthenticating if they do not send data before the timer expires Setting the lt value gt to zero 0 disables the soft AP mode link monitor Default 3600 Example set apmode link_monitor 1000 Sets the soft AP mode link monitor timer to 1 000 seconds 2 3 5 set apmode passphrase lt string gt This command sets the soft AP mode passphrase to be used for WPA2 AES encryp tion When set the module will broadcast a network in soft AP mode with WAP2 AES encryption enabled The allowable length of lt string gt is between 8 and 64 characters Defaults NULL Example set apmode passphrase my_passphrase JI Sets the passphrase to my_ pass phrase 2 3 6 set apmode ssid lt string gt This command sets the soft AP mode network name SSID to be broadcast where lt string gt is the SSID The maximum length of SSID can be up to 32 characters long Defaults NULL Example set apmode ssid my_network Sets the SSID to my_network 2 3 7 set broadcast address lt address gt This command sets the primary address to which the UDP hello heartbeat message is sent where lt address gt is an IP address in the form lt value gt lt value gt lt value gt lt value gt with lt value gt being a number between 0 and 255 Default 255 255 255 255 Example set broadcast address 192 168 1 50 H Sets the broadcast
138. o parameters are specified the module e Uses the string stored with the set opt device_id lt string gt command and appends xy where xy is the last byte of the module s MAC address as the SSID e Creates the soft AP network on channel 1 Note This command does not survive power cycling After a power cycle the module behaves according to the wireless join policy determined by the set wlan join lt va lue gt command apmode MyNetwork 11 H Creates a soft AP network on channel JI 11 with SSID MyNetwork DS50002230A page 48 2014 Microchip Technology Inc 3 1 2 Using AP Mode The following sections describe how to use AP mode including connecting to the mod ule checking for the last device connected over TCP viewing associated devices enabling the link monitor and routing data between clients 3 1 2 1 CONNECT TO THE MODULE Once the module boots up in AP mode any client device can associate with the net work the module is broadcasting Once associated the module s DHCP server assigns an IP address to the client device The default lease time is 1 day i e 86 400 seconds You can configure the lease time using the set dhcp lease lt va ue gt command where lt value gt is the time in seconds To view a list of devices associated with the module use the show lease command The command output is in the following format with commas delimiting the fields IP address assigned Client MAC Remaining lease ti
139. o see a list of devices associated with the module use the show associated com mand The command output is in the following format with commas delimiting the fields Connection Host MAC Received byte Transmitted Seconds since last number address count byte count packet received Figure 3 2 shows example output from the show associated command FIGURE 3 2 SHOW ASSOCIATE COMMAND EXAMPLE OUTPUT lt 2 42 gt show associated 1 0 cb al 2b 63 59 36868 0 7 2 00 24 8c 31 e5 27 76168 0 2 3 98 4b 4a 6b e0 0 1992 0 0 lt 2 42 gt You can use the Seconds since last packet received output to check for stale con nections 3 1 2 4 ENABLE THE LINK MONITOR AP mode supports a link monitor feature to detect if individual client devices are active and in range of the module The link monitor is a timer in seconds that checks to see if any packets are received from an associated device If the timer expires the AP mod ule de authenticates the client s This feature is useful for aging out clients that do not send any traffic over Wi Fi You enable the link monitor using the set wlan fmon lt value gt lt value gt is a decimal number representing the number of seconds of client inactivity e no data received from the client device This command sets the soft AP mode link monitor timeout threshold for each associated client device When this timer expires the module deau thenticates that particular client
140. ode 3 No IP 4 Connecting 5 Challenge for password 3 8 USING THE REAL TIME CLOCK FUNCTION The module s real time clock keeps track of the number of seconds since the module was powered on and the actual time when the module synchronized with the sNTP time server By default the module keeps track of up time but does not synchronize with the time server because this synchronization requires the module to be associated with a network that can access the sNTP server The real time clock reads the time in sec onds since 1970 which corresponds to the UNIX time In firmware version 2 23 and higher you can set the RTC value in seconds using the set time rtc lt va lue gt command The default sNTP server is ADDR 129 6 15 28 123 ZONE 7 GMT 7 Use the show time command to see the current time and uptime as shown below lt 2 23 gt show t Time 08 43 10 UpTime 10 s To set the time use the time command 2014 Microchip Technology Inc DS50002230A page 67 WiFly Command Reference Advanced Features amp Applications User s Guide lt 2 23 gt show t Time NOT SET UpTime 8 s lt 2 23 gt time lt 2 23 gt show t Time 08 51 31 UpTime 15 s Note The module must be associated with a network for the module to contact the sNTP server The module can also be configured to get the time whenever it powers up using the set time enable 1 command If you set the time enable to a value greater than 1 the mod
141. ommand is named set option sensor Default 0 Example set q sensor Oxff H Enables all sensor inputs 2 3 51 set q power lt value gt This register automatically turns on the sensor power where lt va ue gt is shown in Table 2 4 This parameter sets an 8 bit register with two 4 bit nibbles If the top nibble is set power is applied upon power up and removed upon power down or sleep If the bottom nibble is set power is applied when a sampling event occurs such as e UDP broadcast e Automatic web posting of sensor data e Power is removed immediately after sampling is complete TABLE 2 4 SET Q POWER COMMAND SENSOR PIN VOLTAGE SETTINGS Value Sensor Pin Voltage 0 Turn off the sensor power 1 Ground the sensor pin 2 1 2V internal regulated reference 3 VBATT input pin 4 3 3V output of on board regulator Default 0 Example set q power 0x20 H Sets power to 1 2V automatically upon power up set q power 0x02 Sets power to 1 2V when a H sampling event occurs set q power 0x40 H Sets power to 3 3V automatically upon power up set q power 0x04 Sets power to 3 3V when a H sampling event occurs 2 3 52 set sys autoconn lt value gt This command sets the auto connect timer in TCP mode where lt value gt is a decimal number from 0 to 255 as shown in Table 2 5 Setting this parameter causes the module to connect to the stored remote host periodically as specified by lt value gt Note
142. ommand to set non standard baud rates The lowest possible baud rate is 2 400 DS50002230A page 32 2014 Microchip Technology Inc Using non standard raw baud rates with hardware flow control can be more useful at high speeds as the microcontroller interfaced to the module may be able to better match the UART speed and get better results Table 2 12 shows the supported raw baud rates TABLE 2 12 SUPPORTED RAW BAUD RATES Raw Baud Rate Comment 458 333 This is 460 800 500 000 Raw baud rate 550 000 Raw baud rate 611 111 Raw baud rate 687 599 Raw baud rate 785 714 Raw baud rate 916 667 This is 921 600 1 100 000 Raw baud rate Default Not applicable Example set uart raw 7200 H Sets the baud rate to 7 200 baud 2 3 70 set uart tx lt value gt This command disables or enables the UART s TX pin GP1IO10 where lt value gt is 1 or 0 Disabling the pin lt va ue gt 0 sets GPIO10 as an input with a weak pull down Note Firmware version 2 36 2 45 and higher supports parity with the set uart flow command Default Not Applicable Example set uart tx 1 H Enable the UART s TX pin 2 3 71 set wlan auth lt value gt This command sets the authentication mode where lt value gt is shown in Table 2 13 You only need to set this parameter if you are using automatic join mode 2 i e the set wlan join 2 command Note During association the module interrogates the access point
143. onsive If there is no interaction between the configuration web server and the client s web browser for five minutes default value the WiFly module reboots to the boot image To restart the configuration web server you must invoke it in software or hardware as described previously The timeout defaults to five minutes 300 seconds and is configurable via the following command set comm idle lt seconds gt 3 2 5 2 BROWSER DISCONNECT TIMER This timer is used to recover from an unexpected situation in which the configuration web server on the WiFly 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 WiFly module does not receive a request within 60 seconds it assumes that the con figuration web server has become unresponsive and it reboots itself into configuration web server mode Then you must re associate your device with the WiFly module s AP network and refresh the web page 3 3 PUTTING THE MODULE TO SLEEP AND WAKING IT Table 3 5 describes the methods for putting the module to sleep TABLE 3 5 METHODS FOR PUTTING THE MODULE TO SLEEP Method Interface Description sleep command UART Go into Command mode using and issue the sleep command Sleep timer Internal RTC The module sleeps based on the set sys sleep lt va ue gt command setting Drive GPIO8 high GPIO8 The module sleep
144. oring Default Configuration Settings Appendix B Boot Up Timing Values Appendix C Supported Access Points Appendix D Command Quick Reference Guide Appendix E Known Problems in Firmware Version 4 40 Appendix F Current Firmware Features and Fixes F 1 Version 4 41 11 25 2013 Build r1046 F 2 Version 4 00 1 4 19 2013 ccceeecceeeeeeeeeeeeeeees F 3 Version A 02001 F 4 Version 2 36 2 45 9 14 2012 ccccccccceceseeeeeeeees F 5 Version 2 30 10 26 2011 ccccceccesecceeeeeeeeeeeeeees F 6 Version 22 00 1081 F 7 Version 2 23 04 03 2011 ccccecccceeeeceeecesseeeeeeeee F 8 Version 2 21 07 11 2010 oo eecccceeeeceeecenseeeeeeaee F 9 Version 2 20 06 14 2010 oo cceeeccceeeeeeeeeeeeeees DS50002230A page 4 2014 Microchip Technology Inc WIFLY COMMAND REFERENCE ADVANCED MICROCHIP FEATURES amp APPLICATIONS USER S GUIDE Preface O O O R All documentation becomes dated and this manual is no exception Microchip tools and documentation are constantly evolving to meet customer needs so some actual dialogs 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 bottom of each page in front of the page number The numbering convention for the DS number is DSXXXXXA where XXXXX is
145. ort number set ftp time lt value gt 200 Sets the FTP timeout value where lt va ue gt is a decimal num ber that is five times the number of seconds required set ftp user lt string gt roving Sets the user name for accessing the FTP server set ip address lt address gt 0 0 0 0 Sets the WiFly module s IP address set ip backup lt address gt 0 0 0 0 Sets a secondary host IP address set ip dhcp lt value gt 1 Enables disables DHCP mode set ip flags lt mask gt 0x7 Sets the TCP IP functions set ip gateway lt address gt 0 0 0 0 Sets the gateway IP address set ip host lt address gt 0 0 0 0 Sets the remote host s IP address set ip localport lt va ue gt 2000 Sets the local port number set ip netmask lt address gt 255 255 255 0 Sets the network mask set ip protocol lt flag gt 2 Sets the IP protocol set ip remote lt value gt 2000 Sets the remote host port number set ip tcp mode lt mask gt 0x0 Controls the TCP connect timers DNS preferences and remote configuration options set opt average lt value gt 5 Sets the number of RSSI samples used to calculate the running RSSI average set opt deviceid lt string gt WiFly XXX Sets the configurable device ID where XXX is GSX for the RN131 and EZX for the RN171 set opt format lt flag gt 0x00 Sets the HTTP client web server information set opt jointmr lt value gt 1000 Sets the join timer which is the length of time
146. ow To configure GPIO pins as outputs use the set sys mask lt va ue gt command Note GPIO pins 4 5 and 6 are used by the firmware to blink the status LEDs To set the default power up states for these GPIO pins you must first disable their use by the firmware using the set sys iofunc 0x7 command Default 0x0 Example To configure power up states of GPIO8 output by default set sys value 0x0100 H Sets GPIO8 high upon power up set sys value 0x0000 H Sets GPIO8 low upon power up 2 3 60 set sys wake lt value gt This command sets the automatic wake timer where lt va ue gt is a decimal number rep resenting the number of seconds after which the module wakes from sleep Setting lt value gt to 0 disables it See Section 3 4 System and Auto Connect Timers for more details Default 0 Example set sys wake 5 The module wakes after 5 seconds 2 3 61 set time address lt address gt This command sets the time server address where lt address gt is an IP address in the form lt value gt lt value gt lt value gt lt value gt with lt value gt being a number between 0 and 255 This command applies to SNTP servers Default 64 90 182 55 Example set time address 208 109 78 52 Sets the time server address as 208 109 78 52 2 3 62 set time port lt value gt This command sets the time server port number where lt value gt is a decimal number 123 the default is typically the SNTP server port De
147. range 0 1 2V however the analog to digital converter saturates at 400 mV Resolution 14 bits 12 uV Sampling frequency 35 us Accuracy 5 uncalibrated The accuracy of each analog sensor reading can be offset by up to 5 due to variations from chip to chip To improve accuracy Microchip recommends using a precision ref erence voltage on one of the analog inputs to calculate the offset The offset is the same for all analog inputs For example e Drive precision 200 mV reference on analog input 4 e Read analog input 4 and compute the offset If you read 210 mV you know that the offset is 10 mV When you read input 5 subtract 10 mV from the result 2014 Microchip Technology Inc DS50002230A page 89 WiFly Command Reference Advanced Features amp Applications User s Guide 4 9 1 Sampling Sensor Pins Automatically The sensor pins can be sampled automatically and data forwarded in two modes e The UDP broadcast packet can contain the sample values e In HTTP mode the sampled pin data can be forwarded to a remote server To enable these modes use the set q sensor lt mask gt command EXAMPLE 4 20 SAMPLE ALL SENSOR INPUTS set q sensor Oxff H Sample all sensor inputs 4 9 2 Using the Built In Sensor Power The modules contain an on board sensor power pin which is controlled by the set q sensor lt mask gt command lt mask gt is a bit mask value that determines which sensor pins to sample when sen
148. rate 115200 is illegal You can type numbers in decimal e g 115200 or hexadecimal To enter a number in hex use 0x lt value gt For example the hex value FF would be entered as 0xFF 2 2 COMMAND ORGANIZATION There are five general command categories as shown in Table 2 1 TABLE 2 1 COMMAND TYPES Command Type Description Set commands Set commands take effect immediately and are stored to memory when the save command is issued Get commands These commands retrieve the stored information and display it Status commands These commands display the interface status IP status etc Action commands Use these commands to perform actions such as scanning connecting disconnecting etc File I O commands Use these commands to upgrade load and save configuration delete files etc Note You must save any changes you make using the save command or the module will load the previous settings upon reboot or power up When the system boots all configuration data is loaded into RAM variables from the configuration file The set commands only modify the RAM copy of the system vari ables In general the IP WLAN and UART settings require you to save and reboot before they take effect because they operate upon power up For example you only associate set the channel and obtain an IP address once at power up Most of the other commands e g COMM settings and timers take effec
149. reboot or power cycle the module to use the new firmware To boot with different firmware use the command boot image lt value gt which sets the current boot image as lt value gt For example to boot the previous image using the previous example lt 2 20 gt boot image 11 Set Boot Image 11 OK Note After changing the boot pointer to the new image you must reboot the mod ule to boot up with the new image Once the module boots up with the new image perform a factory reset on the module to initialize all the parameters to the factory default settings Then you can reinitialize the parameters as required 4 5 4 New Optional FTP Update Command Parameters WiFly version 4 40 and higher adds new optional parameters to the FTP update com mand to better organize the module s Flash file system The new options are ftp lt option gt update lt filename gt where lt option gt is u download firmware and set as boot image lt ilename gt is the name of the firm ware img or mif file c clean the file system option before performing firmware update over FTP This will delete all the files on the Flash file system including user defined configura tion files except the current boot image and the factory default boot image sec tor 2 DS50002230A page 82 2014 Microchip Technology Inc Example of performing an FTP update procedure Step 1 ftp cupdate wifly7 440 mif After a successful firmware update the
150. relief under that Act 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 buyer s 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 QUALITY MANAGEMENT SYSTEM CERTIFIED BY DNV ISO TS 16949 Trademarks The Microchip name and logo the Microchip logo dsPIC FlashFlex KEELOQ KEELOQ logo MPLAB PIC PlCmicro PICSTART PIC logo rfPIC SST SST Logo SuperFlash and UNI O are registered trademarks of Microchip Technology Incorporated in the U S A and other countries FilterLab Hampshire HI TECH C Linear Active Thermistor MTP SEEVAL and The Embedded Control Solutions Company are registered trademarks of Microchip
151. res amp Applications User s Guide 2 5 5 show q lt value gt This command displays the value of the analog interface pin where lt value gt is 0 to 7 The A D reading is 14 bits with a range of 0 to 400 mV therefore the resolution is 24 uV The output is in uV 1 000 millivolts The module returns a value in the format 8xxxxx where xxxxx is the voltage in microvolts sampled on the channel you requested Note Ifa web post or UDP broadcast samples the data the data is shifted as described in Section 4 1 3 UDP Broadcast Example show q 0 H Show the voltage on channel 0 2 5 6 show q 0x1 lt mask gt This command displays multiple analog interface values simultaneously where lt mask gt is a bit mask representing the channels For example to read channels 0 1 and 7 use the command show q 0x183 The module returns 8 lt chan0 gt 8 lt chan1 gt 8 lt chan7 gt Note Ifa web post or UDP broadcast samples the data the data is shifted as described in Section 4 1 3 UDP Broadcast Example show q 0x183 Show values for channel 0 1 and 7 2 5 7 show rssi This command displays the last received signal strength Example show rssi H Show signal strength DS50002230A page 40 2014 Microchip Technology Inc 2 5 8 show stats This command displays the current statistics packet RX TX counters etc The com mand returns the statistics shown in Table 2 16 TABLE 2 16 DISPLAY STATISTICS
152. rform a factory reset on the module to initialize all the parameters to the factory default settings Then you can reinitialize the parameters as required 2 7 6 ftp update lt string gt This command retrieves a new image file and updates the boot pointer to the new image where lt string gt is the new image file to retrieve Refer to Section 4 5 Upgrading Firmware Via FTP for more information Example ftp update wifly3 400 img II Retrieve version 4 0 firmware II RN131 2014 Microchip Technology Inc DS50002230A page 45 WiFly Command Reference Advanced Features amp Applications User s Guide 2 7 7 xmodem lt option gt update lt string gt This command adds the capability to update the firmware over UART using XMODEM 1K protocol The lt options gt are as follows u download firmware and set as boot image lt filename gt is the name of the firmware img or mif file c clean the file system option before performing a firmware update over FTP This will delete all the files on the Flash file system including user defined configuration files except the current boot image and the factory default boot image sector 2 Prerequisites 1 Module running firmware version 4 40 or higher 2 Must have local copy of an img or mif firmware file The img always contains a single module firmware application The mif may contain module firmware and other application s such as web_app wps_app and or custom
153. rochip Technology Inc 2 7 FILE I O COMMANDS You use the file UO commands to save load delete and update configuration and other files 2 7 1 del lt string gt lt value gt This command deletes a file where lt string gt is the filename and lt va ue gt is an optional number that overrides the name and uses the sector number displayed by the 1s com mand Example del my_old_config H Delete the file my_old_config 2 7 2 load lt string gt This command reads in a new configuration file where lt string gt is the filename Example load my_config H Load the file my_config 2 7 3 Is This command displays the files in the system Example Is Display the files in the system 2 7 4 save lt string gt This command saves the configuration settings to a file where lt string gt is an optional filename If you do not specify a filename the module saves the settings to a file named config default Default config Example save H Saves the configuration settings to the II config file save my_config II Saves the settings to the my_config file 2 7 5 boot image lt value gt This command makes a file represented by lt value gt the new boot image Example boot image 55 H Set the new boot image to a file represented by filename 55 Note After changing the boot pointer to the new image you must reboot the mod ule to boot up with the new image After the module boots up with the new image you must pe
154. roducts 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 Custom er Change Notification and follow the registration instructions The Development Systems product group categories are Compilers The latest information on Microchip C compilers and other language tools These include the MPLAB C compiler MPASM and MPLAB 16 bit assemblers MPLINK and MPLAB 16 bit object linkers and MPLIB and MPLAB 16 bit object librarians Emulators The latest information on the Microchip MPLAB REAL ICE in circuit emulator In Circuit Debuggers The latest information on the Microchip in circuit debugger MPLAB ICD 3 2014 Microchip Technology Inc DS50002230A page 7 WiFly Command Reference Advanced Features amp Applications User s Guide e MPLAB IDE The latest information on Microchip MPLAB IDE the Windows Integrated Development Environment for development systems tools This list is focused on the MPLAB IDE MPLAB SIM simulator MPLAB IDE Project Manager and general editing and debugging features e Programmers The latest information on Microchip programmers These include the MPLAB PM3 device programmer and the PICkit 3 development programmers CUSTOMER SUPPORT Users of Microchip products can receive as
155. ror message by setting the print level to zero using the set sys print 0 command Default web_app Example set sys launch_string wps_app Sets the launch application to WPS 2 3 54 set sys mask lt mask gt This command sets the I O port direction where lt mask gt is a hex number referring to a bit mapped register Figure 2 5 shows the bits corresponding to the GPIO pins and Table 2 8 shows the GPIO pin usage their default state and functionality FIGURE 2 5 GPIO PIN BITMASK 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 GPIO14 GPIOO GPIO13 UART RTS L GPIO1 GPIO12 UART CTS GPIO2 GPIO11 UART RX GPIO3 GPIO10 UART TX GPIO4 GPIO9 GPIO5 GPIO8 GPIO6 GPIO7 TABLE 2 8 GPIO PIN USAGE DEFAULT STATE AND FUNCTIONALITY at Re Dee SC HERE FEON 0 GPIOO N A N A 1 GPIO1 N A Input Unused 2 GPIO2 N A Input Unused 3 GPIO3 N A Input Unused 4 GPIO4 Output Output Green LED 5 GPIO5 Output Output Yellow LED 6 GPIO6 Output Output Red LED 7 GPIO7 Output Output Blue LED 8 GPIO8 Input Output Unused 9 GPIO9 Input Input Soft AP mode and factory reset 10 GPIO10 Output Output UART TX 11 GPIO11 Input Input UART RX 12 GPIO12 Input Input Throttles the transmitter if hardware flow control is enabled Driving this pin low enables transmitter
156. s The minimum interval value is 1 every 2 seconds and the maximum value is Oxff every 256 seconds Setting the interval value to zero disables UDP broadcast mes sages Default 7 Example set broadcast interval 6 H Sets the heartbeat UDP message interval to 6 seconds 2 3 10 set broadcast port lt value gt This command sets the port to which the UDP hello heartbeat message is sent where lt value gt represents the port number Default 55555 Example set broadcast port 55555 H Sets the port to which the UDP heart H beat is sent to 55555 2 3 11 set broadcast remote lt value gt This command sets the port to which the backup UDP hello heartbeat message is sent where lt value gt represents the port number Default 0 Example set broadcast port 4444 H Sets the port to 44444 2 3 12 set comm lt char gt This command sets the character used to enter command mode to lt char gt You typi cally use this setting when the default string used to enter command mode is a possible data string You must carefully note the new character After you save this set ting upon every subsequent reboot the module ignores and looks for lt char gt lt char gt lt char gt to enter command mode Default Example set comm w II Sets the string to enter command mode JI to www DS50002230A page 16 2014 Microchip Technology Inc 2 3 13 set comm close lt string gt This command sets the ASCII string that
157. s 68 Chapter 4 Advanced Applications 4 1 Sending Data using UDP EEN 69 4 2 Joining Networks and Making Connections cccceeeeeeeeeeeeeeeeeeeeeteeeenenaes 71 4 3 Making GONE e CN 72 4 4 Using the HTML Client Feature cccceeeeeeeesseeeeeeeeeeeeeeeeeneeeeeeeeeeteseeeeee 74 4 5 Upgrading Firmware Via E 79 4 6 FEP CHENU EE 84 4 7 Firmware Update over UART via XMODEM 1K Protocol 85 4 8 Wi Fi Protected Setup WPS eenegen 87 4 9 Analog Sensor Capability eeeeeeeeeeeeeeieiieiettteeeirintttesestrinrnssssrinennnnnnsrrena 89 2014 Microchip Technology Inc DS50002230A page 3 WiFly Command Reference Advanced Features and Applications User s Guide Appendix A Default Configuration A 1 Apmode Parameters 00 eeeeeeeeeeeeeeteeeeee A 2 Broadcast Parameters ccccceseeeceeeeeeeeeeeeeees A 3 COMM Parameters cccccesececcceceeseeeeesaeeeeeneaes AA DNS Parameters ccccccccesseeceeeceeseeeeceaeeeeeneaes A 5 FTP Parameter Sa iinn aa A 6 IP Parameters ccccccseccecceseeseeeeceeseeeeceaaeeeeeeans A 7 Optional Parameters 0 eeeseeseeeeeeeeeeeees A 8 System Parameters AA A 9 Time Server Parameters cccccececceeeeseeeeeeeaes A 10 UART Parameters ccccsecscccecessceeeeeneeeeeeeaes A 11 WLAN Parameters c cccccceceeeeseeeeeeeeeeeeneaee A 12 String Variable Sizes cccccceeeeseeeeceteeeeeeeeeees A 13 Rest
158. s and dsPIC DSCs KEELOQ code hopping devices Serial EEPROMs microperipherals nonvolatile memory and analog products In addition Microchip s quality system for the design and manufacture of development systems is ISO 9001 2000 certified DS50002230A page 2 2014 Microchip Technology Inc WIFLY COMMAND REFERENCE ADVANCED MICROCHIP FEATURES AND APPLICATIONS USER S GUIDE Table of Contents Chapter 1 Introduction aka 9 1 2 I TT LEE 10 Chapter 2 Command Reference 2 1 Command Syntax ee 13 2 2 Command Organization EE 13 2 3 Set COMMANAS css sactcesariircarseessterantenbataviondedeaesdcangquast decent Eai KATAD EErEE ioa ia 14 2 4 G t COMINGS ege geheegt geg 37 25 Status Commands EE 39 2 6 Action Commands eegene 41 2 7 File O E E 45 Chapter 3 Advanced Features and Settings 3 1 Access Point AP Mode EE 47 Kegel ten WEE 51 3 3 Putting the Module to Sleep and Waking It cceeeeeeeeeeeeeeeeeeeeeeenntaeaeees 56 3 4 System and Auto Connect Timers ccccccceeesseeeeneeceeeeeeeeessaneeeeeeseeeseneneeees 57 3 5 Wake On Sensor Input 00 0 cee eeeesecceseceaeeeeeeeeeeeeceeaeecaeeaeccaeccaeceeeeeeeeeeeeeeeeeess 59 3 6 Wake on UART Activity scatecccccieracceransiatentazanrevnad seccettdnenstetecetadtaranttacamteentana 60 3 7 Setting Debug Print EE 64 3 8 Using the Real Time Clock Function 200 00 cece eceeeeeeeeeeeeeeeeteeeeeeeeeeeeneneeeeeeeers 67 3 9 Time Stamping Packets 2 20 nach tae ieee Occ ee
159. s as soon as GPIO8 is held high 4 us latency To enable this feature use the set sys trigger 0x20 command setting Table 3 6 describes the methods for waking the module TABLE 3 6 METHODS FOR WAKING THE MODULE Method Interface Description Sensor input 1 2V DC only Sensor pins You can wake the module using sensor pins 0 3 1 2V DC ONLY Use the set sys trigger lt va lue gt command to enable the sensors RX pin 3 3V DC only RX pin via The RX pin on the RN 134 and the RN 174 evaluation boards is tied to sensor sensor 0 pin 0 via a resistor divider network Use the set sys trigger 1 command to wake the module when it receives RX data NOTE With this method the module may drop the first UART data byte A better method is to wake the module using the CTS pin CTS pin 3 3V DC only CTS pin via The CTS pin on the RN 134 and the RN 174 evaluation boards is tied to sensor sensor 1 pin 1 via a resistor divider network Use the set sys trigger 2 command to wake the module using the CTS pin Wake timer Internal RTC The wake timer wakes the module based on the set sys wake lt value gt com mand setting FORCE AWAKE FORCE An input pulse of at least 31 s 3 3V wakes the module AWAKE pin DS50002230A page 56 2014 Microchip Technology Inc When the module wakes up from sleep it takes time in milliseconds to initialize the internal hardware During this time
160. s command displays current battery voltage and is only applicable to Microchip s battery powered products such as the RN370 and temperature sensors ISENSOR CB Example show battery H Show the current battery voltage 2 5 2 show connection This command displays the connection status in the hex format 8 lt xXYZ gt where 8 lt XYZ gt is a bit mapped register providing the information shown in Figure 2 8 FIGURE 2 8 SHOW CONNECTION COMMAND BIT MAPPED REGISTER 16 13 12 9 7 6 5 4 3 0 TCP status 0 idle 1 connected 3 No IP 4 connecting Association 1 OK Authentication 1 OK DNS server 1 server is contacted DNS found 1 DNS is resolved Channel Value 1 13 Fixed Value 8 2 5 3 show io This command displays the GPIO pins level status in the hex format 8 lt ABC gt For example 8103 indicates GPIO 0 1 and 8 are high Example show io H Show the GPIO level status 2 5 4 show net lt char gt The command displays the current network status association authentication etc where lt char gt is the optional parameter n Using the n parameter displays only the MAC address of the access point with which the module is currently associated Example show net n H Show the access point s MAC address 2014 Microchip Technology Inc DS50002230A page 39 WiFly Command Reference Advanced Featu
161. set wlan ext_antenna lt value gt This command determines which antenna is active where lt value gt is 0 use the chip antenna or 1 use the U FL connector Only one antenna is active at a time and the module must be power cycled after changing the antenna setting Note This command applies only to the RN131 module it is not applicable to the RN171 If you send this parameter to the RN171 it issues an error mes sage ERR Bad Args Default 0 Example set wlan ext_antenna 1 Use the U FL antenna 2 3 74 set wlan hide lt value gt This command hides the WEP key and WPA passphrase where lt value gt is 0 or 1 If this parameter is set to 0 the passphrase or pass key is displayed If you set this parameter to 1 the module shows for these fields when displaying the WLAN set tings To show the passphrase or pass key re enter the key or passphrase using the set wlan key or set wlan passphrase command Default 0 Example set wlan hide 1 Hide the passphrase or pass key DS50002230A page 34 2014 Microchip Technology Inc 2 3 75 set wlan id lt string gt This command sets the EAP ID This command is reserved for future development and is unused 2 3 76 set wlan join lt value gt This command sets the policy for automatically associating with network access points where lt value gt is one of the options shown in Table 2 14 The module uses this policy on power up including waking up from the sleep
162. settimng ee cece cee cece cece ceeeneeeeeeeeeeeeees 17 flush timer setting ev ccceessste ceeeeee hereon ces 18 FTP Lee 84 connect Le EE 84 create files ON server 84 display settmgs eee eeeeeceeeeeeeeeneeeeeeeees 38 filename Setting cccseceecedeneeeeectereseeeeeteee 19 get files form eener 84 mode Setting 19 PASSWOM ae eaa ao ene dees 20 remote port number Setting 19 Server Setting EE 19 starting directory ereere 19 timeout Setting osoeeeeeeeneee eeen nene rereeneeerere ne 19 tele EC 45 Upgrading firmware eee eee cette eeeeteeeeeeeeeeees 79 Username Setting 20 Tip Dt EE 45 G get AdNOG EE 37 DroadcaSt sec 4s bs ieceeeteen etann 37 COM tinea in AEE 38 o AEAEE E E Agen dh Made cheek ie 38 OVELYINING DEE 38 K 38 IP EE 38 IIe 38 OPON Eed eege 38 SVS 0 2 Reale zo ee 38 UME eege eEEEe get 38 UU GE 38 WAM EE 38 get commands dE ee eee Sheets 37 GPIO alternate functions eee tenet teen eeees 26 61 AP mode alternative functions 00 0 50 controlling connections wi 63 default power up value setting e 30 disable LEDS viarie ieaiai 61 outp tSettihg ein a a 28 pin DITMASK eeeeerereireerireerneernns 27 62 PIN USAQC EEN 27 62 set as inputs or outputs instantly 000 0 28 setting alternate functions 00 eee eeeeees 62 DS50002230A page 114 2014 Microchip Technology Inc setting direction 61 show pin level status 39 GPIO1 EE
163. sistance through several channels e Distributor or Representative e Local Sales Office e Field Application Engineer FAE e 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 DOCUMENT REVISION HISTORY Revision A January 2014 This is the initial released version of the document Kl DS50002230A page 8 2014 Microchip Technology Inc WIFLY COMMAND REFERENCE ADVANCED MICROCHIP FEATURES amp APPLICATIONS USER S GUIDE Chapter 1 Introduction 1 1 OVERVIEW The WiFly radio module is a complete standalone 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 you have performed the initial configuration the device automatically accesses a Wi Fi net work and sends receives serial data This user manual is applicable to standalone RN131 and RN171 modules as well as Microchip products based on these modules For example the RN171XV device incor porates the RN171 module therefore all RN171 hardware features apply to the RN171XV Although there are some differences the RN131 and RN1
164. t O is cleared eg by sending set ip flags 0x6 if the module loses the access point connection while TCP is connected the connection is closed Default 0x7 Example set ip flags 0x6 Clear bit 0 2 3 36 set ip gateway lt address gt This command sets the gateway IP address where lt address gt is an IP address in the form lt value gt lt value gt lt value gt lt value gt with lt value gt being a number between 0 and 255 If DHCP is turned on the gateway IP address is assigned and overwritten when the module associates with the access point Default 0 0 0 0 Example set ip gateway 169 254 1 1 H Sets the IP gateway to 169 254 1 1 2 3 37 set ip host lt address gt This command sets the remote host s IP address where lt address gt is an IP address in the form lt value gt lt value gt lt value gt lt value gt with lt value gt being a number between 0 and 255 You use this command to make connections from the WiFly module to a TCP IP server with the IP address lt address gt 2014 Microchip Technology Inc DS50002230A page 21 WiFly Command Reference Advanced Features amp Applications User s Guide Default 0 0 0 0 Example set ip host 137 57 1 1 II Sets the remote host s IP address to Il 137 57 1 1 2 3 38 set ip localport lt value gt This command sets the local port number where lt value gt is a decimal number repre senting the port Default 2000 Example set ip localport 1025
165. t for this example is 2 Bytes Channel O Channel 1 Channel 2 Channel 3 Channel 4 Channel 5 Channel 6 Channel 7 GPIO OF30 0000 1111 2222 3333 4444 5555 6666 7777 2014 Microchip Technology Inc DS50002230A page 77 WiFly Command Reference Advanced Features amp Applications User s Guide 4 4 7 HTML Client Example Posting Sensor Data Automatically In this example the module connects to the web server at www rovingnet works com server php value and posts the sensor data to the web server every 60 seconds You set the network connections as described previously and set additional parameters set ip proto 18 Turn on HTTP mode 0x10 and TCP H mode 0x2 set dns name www rovingnetworks com Set the web server name set ip host 0 Turn on DNS set ip remote 80 H Set the web server port 80 is standard set com remote GET server3 php value H Set up the server application string set sys auto 10 H Automatically connect every 10 JI seconds set option format 7 H Send the header and sampled binary data converted to ASCII set q sensor 0xFF H Set the sensor mask to sample all channels save H Save the configuration to the config file reboot Reboot so that the settings take effect After issuing these commands the web server returns a 200 OK message as shown in Figure 4 5 FIGURE 4 5 SERVER RESPONSE 200 OK response form server Sensor Data Data in
166. t immediately allowing you to change parameters on the fly minimizing power usage and saving Flash re write cycles 2014 Microchip Technology Inc DS50002230A page 13 WiFly Command Reference Advanced Features amp Applications User s Guide Once configuration is complete you must save the settings to store the configuration data otherwise it will not take effect upon reboot or reset You can store multiple con figurations using the save lt filename gt command and you can load them using the load lt filename gt command 2 3 SET COMMANDS These commands begin with the set keyword and include the categories shown in Table 2 2 TABLE 2 2 SET COMMANDS Parameter Description apmode Controls the apmode parameters broadcast Controls the broadcast hello heartbeat UDP message comm Sets the communication and data transfer timers and matching charac ters dns Sets the DNS host and domain ftp Sets the FTP host address and login information ip Specifies the IP settings option Supports optional and infrequently used parameters sys Sets system settings such as sleep and wake timers time Sets the timer server settings uart Specifies the serial port settings such as baud rate and parity wlan Sets the wireless interface settings such as SSID channel and security options 2 3 1 set apmode beacon lt value gt This command sets the apmode beacon interval in
167. t sys output lt mask gt lt mask gt None sets the output GPIO pins high or low The optional lt mask gt sets a subset of the pins set sys sleep lt value gt 0 Sets the sleep timer set sys trigger lt flag gt or 0x1 With this parameter setting the module wakes from sleep state lt mask gt using the sensor input 0 1 2 and 3 set sys value lt mask gt 0x0 Sets the default value of the GPIO pins outputs upon power up set sys wake lt value gt 0 Sets the automatic wake timer in seconds set time address lt address gt 64 90 182 55 Sets the time server address set time enable lt value gt 0 Tells the module how often to fetch the time from the specified SNTP time server in minutes set time port lt va ue gt 123 Sets the time server port number set time raw lt value gt None Allows you to set the RTC raw value from the console in sec onds set uart baud lt value gt 9600 Sets the UART baud rate where lt value gt is 2400 4800 9600 19200 38400 57600 115200 or 230400 set uart flow lt value gt 0 Sets the flow control mode and parity set uart instant lt value gt Not applicable Immediately changes the baud rate where lt value gt is 2400 4800 9600 19200 38400 57600 115200 or 230400 set uart mode lt mask gt 0 Sets the UART mode register set uart raw lt value gt Not applicable Sets a raw UART value set uart tx lt va ue gt Not applicable Disables or ena
168. t with the set ip proto 1 command the autoconn timer is used as an auto sleep timer When the module begins to transmit the first UDP data packet this timer begins counting down When it reaches 0 the module sleeps You set the UDP auto sleep timer using two commands set sys autosleep and set comm timer The timer interval is a product of the auto sleep value and the comm flush timer in ms The timer is decremented every product milliseconds For example if you want a UDP sleep timer of 40 ms use the following commands set sys autosleep 4 H Set autosleep value to 4 set comm timer 10 JI Set comm timer to 10 ms default value The resulting UDP sleep timer is 4 x 10 ms or 40 ms You could also set autosleep 2 and comm timer 20 ms to achieve the same effect Microchip recommends using a minimum value of 2 when the default flush time is 10 ms to ensure that the UDP packet is transmitted For larger packets you should increase the value 3 4 2 TCP Connection Timers The TCP connection timers control when the module opens or closes a socket 3 4 2 1 OPENING A TCP CONNECTION In TCP Client mode the auto conn timer controls the establishment of a socket con nection When set the device periodically attempts to establish a connection when the timer expires DS50002230A page 58 2014 Microchip Technology Inc The set sys autoconn lt va ue gt command causes the module to connect to the host periodically The tim
169. th lt value gt being a number between 0 and 255 This address is automatically set when using DHCP you must set the DNS IP address for static IP or automatic IP modes Default 0 0 0 0 Example set dns address 169 64 1 1 H Set the DNS server address to H 169 64 1 1 2 3 22 set dns name lt string gt This command sets the name of the host for TCP IP connections to lt string gt where lt string gt is up to 32 characters 32 bytes Default server Example set dns name roving1 H Set the DNS host name to roving1 2 3 23 set dns backup lt string gt This command sets the name of the backup host for TCP IP connections to lt string gt where lt string gt is up to 32 characters 32 bytes The FTP client uses the backup string to download the firmware via the ftp update command Default rn microchip com Example set dns backup roving2 H Set the DNS host name to roving2 Eh DS50002230A page 18 2014 Microchip Technology Inc 2 3 24 set ftp addr lt address gt This command sets the FTP server s IP address of the FTP server where lt address gt is an IP address in the form lt value gt lt value gt lt value gt lt value gt with lt value gt being a number between 0 and 255 Default 0 0 0 0 Example set ftp addr 66 35 227 3 Set the FTP server to 66 35 227 3 2 3 25 set ftp dir lt string gt This command sets the starting directory on the FTP server where lt string gt is up to 32 characters To read
170. tings cceeeeeeeee 38 connection Status ee cece ee eee eeeeneeeenneeeeeaes 39 firmware version 39 multiple analog interface values 40 network Status 0 0 eee eeeeeeeeteeeseeeeeeneeeeeeeees 39 Optional settings eee eeeeeeeeeeeeeetneeeeeees 38 Signal strengt 40 Ee 41 system Settings cceceeeeseeeseeeesoutertenceessentensee 38 time server seftinge 38 Ell 97 DNS display settings 2 0 ee eeeceeeeneeeeeneeeeneeeeeees 38 Name Setting sarsi n Een 18 name setting backup sssssssssensnressssrrnsnssrrns 18 Query Commande 43 Server Setting EE 18 USING E eine EE 73 Documentation CONVENTIONS TE tiia 6 LayOUt geriet 5 E enable AP mode in hardware A 47 enable AP mode in software AA 48 enabling AP mode 47 OX Ith h ipai cape tea ese aerate 42 F factory reset cceeccececeeeeeeeeeeceeeeeeaeeeeeeseaeeeeeeeeened 42 file DOOL IMAGE EE 45 TEE 45 Tip Dee EE 45 le WEE 45 EE 45 GE 45 file UO COMMAMNAS 1 0 0 0 eeeeeeeeeeeeeeenneeteeeeteeneeeeeeaees 45 files create ON FTP Server iniinis 84 get from FTP server 84 firmware display version seeen 39 TIXOS ee iA ore E ee nie 107 KNOWN ISSUES ii asrine eano iniaiaiai inaia 105 release NOLES ineei oiadi aian 107 SCAN OUIDUE cinia diei eiieeii 64 66 tele Unie EE 79 firmware upgrade Pre Version 4 0 iioii oid rieri 81 upgrading to version A 0 81 USING E UE 80 version 4 0 and higher 80 flow Control eege ege AER eco 31 60 flush size
171. to calculate the running RSSI average for the set opt signal command Default 5 Example set opt average 10 II Sets the average to 10 RSSI readings 2 3 49 set opt signal lt value gt This command allows you to configure the threshold level for the RSSI value in infra structure mode If the signal strength RSSI falls below lt va ue gt dB the module declares AP is lost and deauthenticates itself from the network Thereafter the module associates with the network based on the join policy This command is useful for applications in which the Wi Fi module is in a mobile envi ronment and frequently enters and leaves the AP s range The recommended range for lt value gt is between 50 and 80 As lt value gt is lowered the module more frequently deauthenticates itself from the AP Note This command applies in infrastructure mode only Itis not applicable in soft AP mode You must enable the link monitor for this feature to work Default 0 Example set opt signal 70 JI Sets the RSSI threshold to 70 dBm If the RSSI average falls below 70 dBm the module deauthenticates itself REENERT DS50002230A page 24 2014 Microchip Technology Inc 2 3 50 set q sensor lt mask gt This command specifies which sensor pins to sample when sending data using the UDP broadcast packet or the HTTP auto sample function where lt mask gt is a bit mapped register Note In versions of firmware prior to 2 23 this c
172. ts a secondary host IP address where lt address gt is an IP address in the form lt value gt lt value gt lt value gt lt value gt with lt value gt being a number between 0 and 255 If the primary host IP is unreachable the module attempts to reach the sec ondary IP address if set Default 0 0 0 0 Example set ip a 10 20 20 2 II Sets the WiFly modules secondary IP H address to 10 20 20 2 2 3 34 set ip dhcp lt value gt This command enables disables DHCP mode where lt va ue gt is a decimal number shown in Table 2 3 If you set this parameter the module requests and sets the IP address gateway netmask and DNS server upon association with an access point Any previously set IP information is overwritten TABLE 2 3 DHCP MODES Mode Protocol 0 Turns DHCP off The module uses its stored static IP address 1 Turns DHCP on The module attempts to obtain an IP address and gateway from the access point 2 Enables automatic IP which is generally used on networks that do not have a DHCP server 3 Turns on DHCP cache mode The module uses a previously set IP address if the lease is not expired or the lease survives reboot 4 Enables DHCP server in soft AP mode DS50002230A page 20 2014 Microchip Technology Inc Using DHCP cache mode can reduce the time the module requires to wake from deep sleep which saves power The module checks the lease time if it is not expired the
173. ut This pin goes high after the module has associated authenticated and has an IP address 5 GPIO5 Input Set this pin high to trigger a TCP connection and low to disconnect 6 GPIO6 Output This pin goes high when the module is connected over TCP and low when discon nected Note Bits 0 3 are mutually exclusive with bits 4 6 i e 0x77 is an illegal value For more details see Section 3 6 2 2 Setting the Alternate GPIO Functions with set sys iofunc Default 0x0 Example set sys iofunc 0x7 H Disables the WiFly board LEDs set sys launch_string lt string gt This command sets the name of the application indicated by lt string gt that is launched when GPIO9 toggles from high to low after power up e g by pressing the FN button on evaluation kits You use this mechanism to invoke valid applications as shown in Table 2 7 TABLE 2 7 VALID APPLICATION STRINGS lt string gt Description web_app Launches the configuration web server wps_app Launches the WPS application Note Do not set lt string gt to the configuration filename or the boot firmware image Otherwise the module configuration may become corrupted and the module will reboot DS50002230A page 26 2014 Microchip Technology Inc Setting the lt string gt to an invalid string such as test results in the following error mes sage when GPIO9 is toggled test not Found Note Disable this er
174. version 2 36 Ad Hoc mode the auto join feature is enabled to maintain backwards compatibility In version 2 45 and higher AP mode auto join is disabled and you must explicitly enable auto join mode using the set wlan join 1 command for the module to associate with the pre stored AP settings automatically The following sections describe how to use AP mode with WiFly products including configuring the module to act as an AP enabling AP mode in hardware and software and sending data to the module from a remote host 3 1 1 Enabling AP mode There are two methods for enabling AP mode hardware and software as described in the following sections 3 1 1 1 ENABLE IN HARDWARE To enable AP mode in hardware hold GPIO9 high at 3 3V and then Reset or power cycle the module The module will then boot up in AP mode with the DHCP server enabled 2014 Microchip Technology Inc DS50002230A page 47 WiFly Command Reference Advanced Features amp Applications User s Guide Table 3 1 shows the default AP mode settings TABLE 3 1 DEFAULT AP MODE SETTINGS Setting AP Mode Default SSID WiFly xxx yy where e XXX is GSX for the RN131 and EZX for the RN171 e yy is the LSB byte of the modules MAC address Channel 1 DHCP server Enabled IP address 192 168 1 1 Netmask 255 255 255 0 Gateway 192 168 1 1 When the module boots up in soft AP mode other Wi Fi enabled devices PCs iPhones iPads
175. write to subfolders use the character To indicate the root direc tory use a period Default public Example set ftp dir demo Set FTP server starting directory to H demo set ftp dir demo test II Set FTP server starting directory to H demo test set ftp dir II Set FTP server starting directory to the II root directory 2 3 26 set ftp filename lt filename gt This command sets the name of the file that is transferred when issuing the ftp u com mand where lt filename gt is the firmware image If you specify any file other than the firmware image the WiFly module downloads the file and issues the UPDATE FAIL 3 error Default Firmware version 4 0 and higher wifly3 lt version gt img RN131 wifly7 lt version gt img RN171 Firmware lower than version 4 0 wifly GSX lt version gt img RN131 wifly EZX lt version gt img RN171 Example set ftp filename my_data II Sets the firmware image to be retrieved via FTP as my_data 2 3 27 set ftp mode lt mask gt This command sets the FTP mode where lt mask gt indicates active or passive mode Default 0x0 Example set ftp mode 0x1 Enables active FTP mode 2 3 28 set ftp remote lt va ue gt This command sets the FTP server s remote port number where lt value gt is the port number Default 21 Example set ftp remote 25 II Sets the FTP server s remote port to 25 2 3 29 set ftp time lt value gt This command sets the FTP timeout value where lt va
176. y FIGURE 3 8 GPIO PIN BITMASK 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 GPIO14 L open GPIO13 UART RTS GPIO1 GPIO12 UART CTS GPIO2 GPIO11 UART RX GPIO3 GPIO10 UART TX GPIO4 GPIO9 GPIOS GPIO8 L GPIO6 GPIO7 TABLE 3 10 GPIO PIN USAGE DEFAULT STATE AND FUNCTIONALITY Blt ieee Deg etdik ste perau FuncHdon 0 GPIOO N A N A 1 GPIO1 N A Input Unused 2 GPIO2 N A Input Unused 3 GPIO3 N A Input Unused 4 GPIO4 Output Output Green LED 5 GPIO5 Output Output Yellow LED 6 GPIO6 Output Output Red LED 7 GPIO7 Output Output Blue LED 8 GPIO8 Input Output Unused 9 GPIO9 Input Input Soft AP Multipurpose GPIO 10 GPIO10 Output Output UART TX 11 GPIO11 Input Input UART RX 12 GPIO12 Input Input Throttles the transmitter if hardware flow control is enabled Driving this pin low enables transmitter driving this pin high dis ables it 13 GPIO13 Output Output This pin goes high on power up and goes low when the system is ready If hardware flow control is enabled this pin toggles to high to indicate the RX buffer is full 14 GPIO14 N A Input Note 1 On the Wi Fi serial adapter RN 370 and the RN 174 evaluation board the blue LED is connected to GPIO7 The blue LED is NOT connected to GPIO7 on the RN 134 board It is not possible to power off the b
Download Pdf Manuals
Related Search
Related Contents
MODE D`EMPLOI - White and Brown Samsung З нижньою морозильною камерою RL62ZBPN Керівництво користувача Shure Microphone SM80 User's Manual UBK Fatso Operators Manual Bombas Sigma con cabezal sanitario Copyright © All rights reserved.
Failed to retrieve file