Hands-On Training for SPWF01SC and SPWF01SA Wi-Fi modules Data brief Features Hands-On Training to evaluate and learn the SPWF01Sx series of Wi-Fi modules on reference designs such as the X-NUCLEO- IDW01M1 and the STEVAL-IDW001V1 in 17 Lab use cases, each covering several topics. PC tools to create a 512 KByte Flash file system image containing the developer s web content, which is then programmed into the SPWF01Sx.11 module's external Flash. Sample HTML file for Lab 5: Web server mode files in RAM of the Hands-On Training, to be loaded through UART into RAM. Sample web content for "Lab 6: Web server mode files in FLASH of the Hands-On Training, used to create a Flash file system image for external Flash on the SPWF01Sx.11 modules. A simple TCP/IP and UDP/IP PC socket server used in Lab 7: Socket interface in the Hands-On Training to illustrate the IP port 32000 byte-stream socket and display exchanged data on the PC. Description The STSW-IDW002 Hands-On Training is a companion document to user manual UM1695. The user manual documents the rich AT command set, configuration variables, status variables, and asynchronous messages from the Wi-Fi chip. The Hands-On Training is a how-to manual, illustrating dozens of practical use cases, using the components of the user manual but also adding embedded firmware features. For example: programmability; configurability using a remote client device (e.g. cellphone browser) over-the-air or via the host processor over UART, basic client STA, miniap, and IBSS operation; dynamic web server serving pages from the internal RAM, internal Flash, and external Flash that can be accessed heterogeneously by the host processor or over-the-air; low-level socket server and socket client; sample dynamic web pages with SSI/CGI functions; remotely control GPIOs on the ST reference designs; low-power modes; link-layer security (WEP, WPA, WPA2), etc. (For end-to-end security, refer to application note AN4683 of TLS/SSL security through the socket client interface.) The package also includes PC executable tools that developers can use in the Hands-On Training labs and also by the user to add functionality to the module, including a low-socket server that runs on the PC in client STA mode and the module in miniap mode for debugging, and a PC executable that takes multiple web content files on the PC and outputs a Flash file system image that can be programmed into the SPWF01Sx.11 modules' external Flash. Several heterogeneous web content files are provided as examples. The Hands-On Training also provides indications for PC standard tools that can be downloaded by the developer, such as a terminal emulator to evaluate the module and get familiarized with the AT command set without relying on a host processor, and an Apache HTTP server that runs on the PC in client STA mode for over-the-air hosting of web content. June 2016 DocID029325 Rev 1 1/6 For further information contact your local STMicroelectronics sales office. www.st.com
Contents of STSW-IDW002 package STSW-IDW002 1 Contents of STSW-IDW002 package The contents of the STSW-IDW002 zip-formatted package are as follows: Root directory Wifi Training-Hands On-FWx.y.pdf: A description of all the use cases (called Labs ) is provided in the Hands-On Training Labs section. FWx.y is the marketing version number for the accompanying firmware, e.g. FW3.4. filesystem_update subdirectory gen.bat: PC batch file to create the Flash file system image that is illustrated in Lab 6: Web server mode files in Flash. The Flash file system image is then used to program the SPWF01Sx.11 s external Flash. This batch file illustrates the proper syntax for the httpd_gen.exe command. View with a text editor. httpd_gen.exe: PC command line-based tool to create a Flash file system image in Lab 6. The user puts all web content into a clean subdirectory (without httpd_gen.exe in the parent directory). From the subdirectory with the content, the executable is invoked with the first argument being the name of the output Flash file system image file to be created by the tool. (If your development environment is a derivative of UNIX, the source code to the httpd_gen.exe tool is available in the online STSW-WIFI001 package.) cygwin1.dll: A dynamic link library used by httpd_gen.exe that emulates Unix functions on the PC. filesystem_update\pages\subdirectory MKTWiFi.pdf: Sample web content for Lab 6 s clean subdirectory. MKTWiFi.pdf is a PDF file with information on the SPWF01S family of modules. index1.html: Sample web content for Lab 6 s clean subdirectory. index1.html is an HTML home page that loads the image content and performs an HTML5 demo of a slider to change font size and a push-button at the bottom that reads the date and time. st766.gif: Sample web content for Lab 6 s clean subdirectory. st766.gif is a Graphic Interchange Format (GIF) image that is displayed at the top of the index1.html page. module.pgn: Sample web content for Lab 6 s clean subdirectory. module.pgn is a Portable Game Notation (PGN) image that is displayed below st766.gif on the index1.html page. HTML_demo_page subdirectory wifidemo.txt: An HTML file with a PC text file extension. This file is opened in Lab 5: Web server mode files in RAM with the programmer s preferred text editor and then cut-andpasted into the Tera Term terminal emulator screen in order to create an HTML file with the proper extension in the RAM file system of the module. This exemplifies the host processor creating a mailbox file (e.g. status or log) for a remote node to read or write periodically. In this case a browser can read and process the HTML contained within. TCP socket server subdirectory server.exe: A simple TCP/IP and UDP/IP PC socket server used in Lab 7: Socket interface to illustrate the IP port 32000 byte-stream socket and display exchanged data on the PC. 2/6 DocID029325 Rev 1
Contents of STSW-IDW002 package cygwin1.dll: The same dynamic link library used by httpd_gen.exe, that emulates Unix functions on the PC, is used by server.exe. Hands-On Training labs The use cases included in the Wifi Training-Hands On-FWx.y.pdf file are as follows: Lab 1: HW and SW setup. SPWF01S reference platforms. Configure Tera Term terminal emulator. Lab 2: Set the SPWF variables. Run AT commands. Dump configuration variable. Set ip_hostname configuration variable. Set a static IP address, gateway, DNS address and network mask. Save to internal Flash and software reset. Lab 2a: FOTA update. Download the PC Apache web server. Upgrade the SPWF01S firmware using the *.ota file (Recommended for modules with firmware versions earlier than v3.5 with date code 160129, STSW-WIFI001 firmware packages on-line). Lab 3: Access point connection. Scan for available networks. Join as a client STA (open, WPA or WEP). Checking read-only status variables. Pinging the IP gateway. Lab 4: Web client mode HTTP GET & HTTP POST data. Pushing data from a remote node using ouput_demo.html to the module s host MCU (Tera Term) over UART. Lab 5: Web server mode files in RAM list existing files in file systems directory. Dump the contents of a file to the UART. Create a file in RAM. Append to a file in RAM (using wifidemo.txt sample HTML page). Verify with a remote device. Delete an existing file in RAM. Lab 6: Web server mode files in FLASH. Build an external Flash file system image on the PC with the http_gen.exe tool. Access the PC Apache web server to Flash the SPWF01x.11 s external Flash. Verify files with a directory listing. Erase the external Flash. Verify files are gone with a directory listing. Lab 7: Socket interface. Open a TCP/IP or UDP/IP socket, as a socket client, to the PC tool server.exe provided in the package. Write byte-stream data to the socket and observe on the PC. Read data from the socket and display on Tera Term emulating host MCU. Close the socket. Lab 8: MiniAP mode for the first set. Configure the module in miniap mode with AT command set (open or WEP). Verify the beacon on cellphone (or PC). Configure the module in miniap mode remotely with firstset.html file stored in internal Flash and using the module s dynamic web server. Lab 9: Socket interface in miniap mode. Open a socket as a socket client to a remote client STA that is a socket server. Write data to the socket and verify. Read data from the socket and verify. Close socket. Lab 10: Web server in MiniAP mode. Put the module in miniap mode again. Connect remote node in client STA mode. Use remote node s browser to access an HTML file from the module s web server. Lab 11: Remote control of GPIO interfaces. Configure, write and read GPIO signals using remote browser and module s web server. Verify LED on reference board toggles. Repeat in client STA and miniap modes. Lab 12: Input demo. Use module s SSI functions in the web server to send a message from host MCU to an external client STA s browser by accessing the input_demo.sthml file stored in the module s internal file system. Lab 13: Socket Server. Configure the socket server listening port. Open a TCP/IP connection from a remote socket client. Alternate Data/Command mode usage. Close the socket server. Lab 14: Low Power Modes. Configure Power Save mode (Wi-Fi sleep; STM32 MCU running). Configure Sleep mode (both Wi-Fi and STM32 MCU sleep). Configure Standby mode (both Wi-Fi and STM32 MCU in standby. Raise GPIO6 to wake up the module in Standby. DocID029325 Rev 1 3/6
Contents of STSW-IDW002 package STSW-IDW002 Lab 15: HW switch from STA to MiniAP. Use GPIO7 to force the module back into miniap mode for reconfiguration by a remote client STA node using the firstset.html file in the internal Flash, served by the module s web server. Lab 16: IBSS mode. Configure into IBSS mode. Configure an ios or Android cellphone or PC into IBSS mode with the same SSID. Connect the devices into an ad hoc network. Verify by using the remote device s browser to read HTML from the module s web server. 4/6 DocID029325 Rev 1
Revision history 2 Revision history Table 1: Document revision history Date Version Changes 07-Jun-2016 1 Initial release. DocID029325 Rev 1 5/6
IMPORTANT NOTICE PLEASE READ CAREFULLY STMicroelectronics NV and its subsidiaries ( ST ) reserve the right to make changes, corrections, enhancements, modifications, and improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. ST products are sold pursuant to ST s terms and conditions of sale in place at the time of order acknowledgement. Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the design of Purchasers products. No license, express or implied, to any intellectual property right is granted by ST herein. Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product. ST and the ST logo are trademarks of ST. All other product or service names are the property of their respective owners. Information in this document supersedes and replaces information previously supplied in any prior versions of this document. 2015 STMicroelectronics All rights reserved 6/6 DocID029325 Rev 1