AMW106 Evaluation Guide AMW106 Evaluation Guide AMW106-E03 `Moray' ARG-MW106E-101R * AMW106 Evaluation Guide (c)2014-2015 ACKme Networks September 1, 2015 AMW106 Evaluation Guide Contents 1 Introduction ........................................................... 1 2 Feature Identification ............................................ 2 2.1 3 AMW106-E03 `Moray' .................................... 2 Using WiConnect.................................................... 4 3.1 Getting Help.................................................... 4 3.2 System Indicator LEDs .................................... 5 3.3 Scanning for Wi-Fi Networks .......................... 5 3.4 Joining a Wi-Fi Network .................................. 5 Web Setup .............................................. 5 Script Setup............................................. 6 Manual Setup.......................................... 7 Wireless Protected Setup (WPS) ............ 8 3.5 Filesystem ....................................................... 8 3.6 Saving Custom Configurations ........................ 9 3.7 UDP / TCP / TLS Clients ................................... 9 3.8 HTTP / HTTPS Clients ....................................10 3.9 Using GPIOs ..................................................10 3.10 Factory Reset ................................................11 3.11 Save & Reboot ..............................................11 3.12 Command vs. Stream Mode .........................12 Command Mode ...................................12 Stream Mode ........................................13 3.13 4 Want more? ..................................................13 Measuring Power Usage ......................................13 4.1 Measuring Coarse Current Consumption .....13 4.2 Measuring Sleep Current ..............................13 5 Ordering Information ...........................................14 6 Revision History & Glossary .................................15 6.1 Revision History ............................................15 6.2 Glossary ........................................................15 APPENDIX A - Configuring a Terminal Application APPENDIX B - Evaluation Board Schematics ARG-MW106E-101R * AMW106 Evaluation Guide (c)2014-2015 ACKme Networks http://ack.me Page | ii September 1, 2015 AMW106 Evaluation Guide Introduction, Section 1 1 Introduction The family of AMWx06 `Numbat' modules are fully certified small form factor, low power Wi-Fi networking modules perfectly suited to deeply embedded applications requiring medium/high data throughput in medium to high volume. The Sensors.com WiConnect Operating System is pre-installed on all AMWx06 modules. WiConnect provides products with an intuitive, reliable and secure Wi-Fi networking connection featuring an embedded TCP/IP networking stack that includes a webserver with REST & websockets, a fully customizable javascript-based web application and SSL/TLS security. Evaluation of WiConnect and the AMWx06 module is available with the AMW106-E03 `Moray' evaluation board. The evaluation board is shown in Figure 1 and its features are shown in Table 1. This document describes how to use the Moray evaluation board populated with an AMW106 module, usage is however identical whether the board is populated with an AMW006 module or an AMW106 module. Figure 1. AMW106 Moray Evaluation Board AMW106-E03 `Moray' (with AMW106 surface mount module) Table 1. AMW106 Evaluation Board Features Feature AMW106-E03 `Moray' Product Number AMW106-E03 Module style Surface mount Serial Interface USB-UART Power supply from USB User LEDs 2+3 User Buttons 2 Reset Button Yes GPIO Expansion Headers GPIO Isolation Header ARG-MW106E-101R * AMW106 Evaluation Guide (c)2014-2015 ACKme Networks http://ack.me 35-pin 2x15-pin Page | 1 September 1, 2015 AMW106 Evaluation Guide Feature Identification, Section 2 2 2.1 Feature Identification AMW106-E03 `Moray' The Moray evaluation board comes complete with a surface mount AMW106 `Numbat' module. Each pin on the Numbat module is connected to the expansion header. Schematics for the board are provided in Appendix B. Figure 2. AMW106-E03 Features Antenna Connections AMW106 Module Ground Hook Expansion Header H2 Expansion Header H3 UART Header H5 System Indicator LEDs* GPIO Expansion Header H8 H8 Isolation Header GPIO Thermistor H9 USB UART Tx LED USB UART Rx LED User LED 1* User LED 2* Power LED USB Micro Connector Provides power to the board & USB-Serial UART to computer Power measurement Reset Button User Button 2* Used to reset the AMW106 module User Button 1* * User configurable Table 2. AMW106-E03 GPIO Expansion Header Connections AMW106 H3 AMW106 H8 AMW106 H8 AMW106 H2 GND 2 GND 12 UART0_TX 20 GND 27 VDD_DUT 3 GPIO 5 13 GPIO 13 21 GPIO 18 28 GPIO 0 4 GPIO 6 14 GPIO 14 22 GPIO 19 29 GPIO 1 5 GPIO 7 15 GPIO 15 23 GPIO 20 30 GPIO 2 6 GPIO 8 16 GPIO 16 24 GPIO 21 31 GPIO 3 7 UART0_RTS 17 GPIO 17 25 GPIO 22 32 GPIO 4 8 UART0_CTS 18 GND 26 GPIO 23 33 OSC_32K 9 UART0_RX 19 RESET_N 34 VDD_DUT* 10 VDD_DUT* 35 GND 11 GND 36 *Note: You can safely draw up to 100mA from the VDD expansion header pins ARG-MW106E-101R * AMW106 Evaluation Guide (c)2014-2015 ACKme Networks http://ack.me Page | 2 September 1, 2015 AMW106 Evaluation Guide Using WiConnect, Section 3 Table 3. AMW106-E03 GPIO Isolation Header H9 AMW106 H9 H9 AMW106 RESET_N 1 2 RESET_BTN GPIO 23 3 4 LED_G GPIO 22 5 6 BUTTON_2 GPIO 20 7 8 THERM GPIO 18 9 10 LED_Y GPIO 16 11 12 LED_1 GPIO 15 13 14 I2C_SDA GPIO 14 15 16 I2C_SCL GPIO 13 17 18 LED_2 GPIO 12 19 20 UART0_TX GPIO 11 21 22 UART0_RX GPIO 10 23 24 UART0_CTS GPIO 9 25 26 UART0_RTS GPIO 5 27 28 LED_R GPIO 0 29 30 BUTTON_1 By removing all jumpers from the GPIO isolation header, all peripherals may be completely disconnected from module GPIOs. This provides several benefits including the option to connect custom peripherals without interference from on-board peripherals, and simplification of power consumption measurements described in the Measuring Power Usage section. ARG-MW106E-101R * AMW106 Evaluation Guide (c)2014-2015 ACKme Networks http://ack.me Page | 3 September 1, 2015 AMW106 Evaluation Guide Using WiConnect, Section 3 3 Using WiConnect To get started with WiConnect, plug the AMW106 evaluation board into the USB port of the computer and open a terminal emulator as described in Appendix A. The USB cable provides the evaluation board with power and a serial UART connection to the computer. With the board connected to the computer, verify the power LED is illuminated. If the power LED is NOT illuminated, try re-plugging the USB cable, or try a different USB cable. USB Serial Computer with Terminal Emulator Moray Evaluation Board Note! Be sure to use a quality USB cable. Inferior cables may result in reduced or intermittent operation of the evaluation board. 3.1 Getting Help WiConnect provides extensive help for each command and variable. To obtain a list of help options, type the help command. > help The following help options help all -> Print help commands -> Print help variables -> Print help -> Print help -> Print are available ... a list of all Commands and Variables a list of Commands a list of Variables help for a specific Command help for a specific Variable Additional help is available online at http://wiconnect.ack.me To obtain help for a particular command or variable, type help or help . To obtain help for the wlan_scan variable, type help wlan_scan. > help wlan_scan Usage : wlan_scan [-v] [ [ssid]] Shortcut: scan Brief : Initiate a Wi-Fi scan and return results; optionally specify a channel and AP SSID to scan for. For verbose scans, -v must be the first argument ARG-MW106E-101R * AMW106 Evaluation Guide (c)2014-2015 ACKme Networks http://ack.me Page | 4 September 1, 2015 AMW106 Evaluation Guide Using WiConnect, Section 3 3.2 System Indicator LEDs The Moray evaluation board comes with three system indicator LEDs and two user LEDs. The LED functions are configurable, using the WiConnect peripheral commands and variables. See http://wiconnect.ack.me for more details., in particular the variables system.indicator.gpio and system.indicator.state. By default the system indicator LEDs are configured as follows: LED Red Function Soft AP Indicator Yellow Network Indicator Green WLAN indicator Behavior Off Fast blink Medium blink Slow blink Fast blink Medium blink Slow blink Off Fast blink Medium blink Slow blink Soft AP off Soft AP error Soft AP active Client connected No IP address DHCP in progress DHCP successful, IP address obtained Wi-Fi off Error Connecting to AP Joined to AP Blink rates are as follows: Fast blink: 4Hz, Medium blink: 1Hz, Slow blink: 0.5 Hz 3.3 Scanning for Wi-Fi Networks To scan for Wi-Fi networks in range, use the wlan_scan command. Each AP in range is listed on a separate line. > wlan_scan -v !3 networks found ! # Ch RSSI MAC BSSID Rate Security Mode Len Network (SSID) # 0 06 -27 84:1B:5E:29:9D:F7 450.0 WPA2-Mixed Inf 17 YOUR_NETWORK_NAME # 1 11 -73 2C:B0:5D:31:6F:6A 300.0 WPA2-AES Inf 6 button # 2 11 -73 EC:1A:59:36:5B:6C 144.4 WPA2-Mixed Inf 5 ACKme 3.4 Joining a Wi-Fi Network Several methods are available to configure and join the AMW106 module to a Wi-Fi network. Web Setup WiConnect provides the option to use a web browser running on a network client (such as a smartphone, tablet or computer) to select the remote Wi-Fi network the AMW106 module should join, and to enter a password for the remote network. When web setup is used, it is helpful to think of the network client as the keyboard and display for the module as shown in Figure 3. ARG-MW106E-101R * AMW106 Evaluation Guide (c)2014-2015 ACKme Networks http://ack.me Page | 5 September 1, 2015 AMW106 Evaluation Guide Using WiConnect, Section 3 Figure 3. Web setup using a network client Local Network Name: WiConnect-### Password: password Remote Network Name: YOUR_NETWORK_NAME To start web setup mode, enter the command setup web. WiConnect starts the local network and web server as indicated by the final message: In progress. > setup web [Disassociated] IPv4 address: 10.10.10.1 Web setup started with the SSID: WiConnect-F1A In progress Open the Wi-Fi settings on your smartphone, tablet or computer and join the network called WiConnect-### (where ### are the last 3 digits of the Wi-Fi module MAC address). The password for the network is simply: password. The local network name and password, and the web address may be customised to suit your needs, see the online WiConnect Reference Manual for further information. After joining the local network, open a web browser on the network client and go to setup.com. The WiConnect web page appears (see Figure 3), and a scan begins for Wi-Fi access points in range. Select the remote network you wish to join, enter the network password then select Save & Exit and follow the prompts. Once the settings are successfully saved, WiConnect prints Web Setup Mode exited to the terminal. Check that the settings were successfully saved using get wlan.ssid and get wlan.passkey. Web Setup Mode exited > get wlan.ssid YOUR_NETWORK_NAME > get wlan.passkey YOUR_NETWORK_PASSWORD Script Setup If you prefer instead to enter configuration details for the Wi-Fi network, WiConnect provides a default setup script to step you through the process. The setup script is provided as a file called default_setup.script on the WiConnect file system. The setup script may be customised as required. > setup cmd > Enter Wi-Fi network name: set wlan.ssid YOUR_NETWORK_NAME Set OK ARG-MW106E-101R * AMW106 Evaluation Guide (c)2014-2015 ACKme Networks http://ack.me Page | 6 September 1, 2015 AMW106 Evaluation Guide Using WiConnect, Section 3 > Enter Wi-Fi network password: set wlan.passkey YOUR_NETWORK_PASSWORD Set OK > set wlan.auto_join.enabled true Set OK > Saving settings save Saved Success > network_up [2014-05-17 | 11:48:31: Associating to YOUR_NETWORK_NAME] In progress > Security type from probe: WPA2-Mixed Obtaining IPv4 address via DHCP IPv4 address: 192.168.0.31 [2014-05-17 | 11:48:41: Associated] > Exiting Cmd Setup Mode Manual Setup It is straightforward to manually enter the name and password for the network using the wlan.ssid and wlan.passkey variables too. Be sure to save afterwards, or the values will be lost when the module reboots. Any subsequent command requiring network access, such as an ICMP (Internet Control Message Protocol) ping, automatically results in the module attempting to join the network. > set wlan.ssid YOUR_NETWORK_NAME Set OK > set wlan.passkey YOUR_NETWORK_PASSWORD Set OK > save Saved Success > ping -g [Associating to YOUR_NETWORK_NAME] Security type from probe: WPA2-Mixed Obtaining IPv4 address via DHCP IPv4 address: 192.168.0.31 [Associated] Ping reply in 25ms The network up -s command provides a shortcut to the process, by scanning for wireless Access Points, offering a choice of networks to join and automatically saving the ssid and passkey: > network_up Scanning for ! 3 networks ! # Ch RSSI # 0 1 -40 # 1 1 -32 # 2 6 -77 -s networks... found MAC (BSSID) 4C:55:CC:10:2E:50 9C:D6:43:28:50:A0 30:85:A9:E7:9C:B0 Network (SSID) ABC myAP DEF Type the number # that matches your Network: 1 Type the password for your Network : secretpassword ARG-MW106E-101R * AMW106 Evaluation Guide (c)2014-2015 ACKme Networks http://ack.me Page | 7 September 1, 2015 Using WiConnect, Section 3 AMW106 Evaluation Guide [Associating to myAP] > In progress > Security type from probe: WPA2-AES Obtaining IPv4 address via DHCP IPv4 address: 10.5.6.94 [Associated] Wireless Protected Setup (WPS) WPS is a Wi-Fi provisioning method originally intended to simplify the process of connecting Wi-Fi clients to Wi-Fi Access Points. WPS offers both a push-button and PIN entry method for configuration. In reality, WPS push-button (as opposed to PIN) is the only method that has gained some level of adoption in the industry, however WPS naturally only works when the Wi-Fi AP supports WPS. Many AP vendors choose not to test and certify APs with the Wi-Fi Alliance, and the lack of a standard WPS logo next to the WPS button on an AP often means many users are unaware that WPS is available. The potential for equipment incompatibility and added user confusion mean it is unwise to rely on WPS as the primary method of Wi-Fi provisioning in the real world. Incompatibility and confusion aside, WiConnect provides full support for WPS1.0 & WPS2.0 and the underlying WPS engine has passed Wi-Fi certification. To use WPS in push-button mode, simply enter the wps command into WiConnect, then press the WPS button on your router (if the router supports WPS, and it is enabled, and you can find the button), and wait for the magic to happen. 3.5 Filesystem ACKme Wi-Fi modules running WiConnect include a serial flash memory and a filesystem that provides users with the ability to read and write files. A quick example showing how to create, manipulate then delete a file is provided below. > file_create hello.txt 13 my hello data File created Success > ls ! # Size Version Filename # 0 1853 2.0.0 /favicon.ico.gz # 1 18067 2.0.0 /setup/images.png # 2 10525 2.0.0 /setup/index.css.gz # 3 10143 2.0.0 /setup/index.html # 4 39233 2.0.0 /setup/index.js.gz # 5 32297 2.0.0 command_help.csv # 6 135 2.0.0 default_setup.script # 7 1236 2.0.0 geotrust_ca.pem # 8 279 1.0.0 gpio_config_init.csv # 9 13 1.0.0 hello.txt # 10 212736 2.0.0 upgrade_app.exe # 11 176920 2.0.0 wiconnect.exe # 12 203261 5.26.230 wifi_fw.bin > file_open hello.txt [Opened: 0] 0 > stream_read 0 5 my he ARG-MW106E-101R * AMW106 Evaluation Guide (c)2014-2015 ACKme Networks http://ack.me Page | 8 September 1, 2015 Using WiConnect, Section 3 AMW106 Evaluation Guide > stream_read 0 50 llo data [Closed: 0] > file_delete hello.txt File deleted Success Note! When reading the contents of a file using stream_read, the file is automatically closed if the end of file is reached. 3.6 Saving Custom Configurations All available WiConnect variables may be saved to a file as a custom configuration. Saved configuration may then be loaded at a later date. This feature is particularly useful for saving configuration variables prior to an over-the-air (OTA) upgrade, and then restoring the configuration afterwards. > save my_config.csv Success > load my_config.csv Configuration successfully loaded 3.7 UDP / TCP / TLS Clients To open a UDP, TCP or secure TLS connection to a remote server, use the udp_client, tcp_client or tls_client commands. WiConnect responds with a stream handle if the connection is opened successfully. For TLS connections, WiConnect provides a default TLS root certificate signed by GeoTrust (located on the WiConnect file system), however this certificate may not work with some TLS servers. A custom certificate may be provided as an option to the tls_client command if required. > udp_client test.ack.me 50019 [Opening: test.ack.me:50019] Resolving host: test.ack.me Connecting: 107.170.222.80:50019 [2014-05-19 | 11:12:22: Opened: 0] 0 > tcp_client test.ack.me 50019 Resolving host: test.ack.me [2014-05-19 | 11:12:38: Opening: test.ack.me:50019] Connecting (TCP): 107.170.222.80:50019 [2014-05-19 | 11:12:39: Opened: 1] 1 > tls_client google.com 443 Resolving host: google.com [2014-05-19 | 11:12:49: Opening: google.com:443] Connecting (TLS): 74.125.237.174:443 [2014-05-19 | 11:12:50: Opened: 2] 2 Now try writing a character to the UDP or TCP stream that was opened in the examples above. The server at test.ack.me:50019 responds with a character pattern using the Chargen (Character Generator) protocol. ARG-MW106E-101R * AMW106 Evaluation Guide (c)2014-2015 ACKme Networks http://ack.me Page | 9 September 1, 2015 Using WiConnect, Section 3 AMW106 Evaluation Guide > stream_write 0 5 hello Success > stream_read 0 50 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR Note! WiConnect supports TCP, UDP and TLS server modes too! For more information, please refer to the WiConnect Reference Guide. 3.8 HTTP / HTTPS Clients To open an HTTP or secure HTTPS connection to a remote server, read the first 300 bytes of the response then close the connection, use the http_get, stream_read and stream_close commands. WiConnect responds with a stream handle if the connection is opened successfully. > http_get https://www.google.com [2014-05-19 | 11:14:31: Opening: https://www.google.com] Request GET / Connecting (HTTP): www.google.com:443 Starting TLS [2014-05-19 | 11:14:31: Opened: 0] HTTP response: 302 Redirected to https://www.google.com.au/?gfe_rd=cr&ei=l-d5U9m2J6GN8QfexoHYCg Request GET /?gfe_rd=cr&ei=l-d5U9m2J6GN8QfexoHYCg Connecting (HTTP): www.google.com.au:443 Starting TLS HTTP response: 200 Status: 200 0 > stream_read 0 300 Google