TWR-WIFI-G1011MI Lab Guide Rev. 0 Freescale Semiconductor Inc. TWRWIFIG1011MILAB
Contents 1 Purpose... 3 2 Configure Hardware... 3 3 Configure Software... 4 4 Running the Demos... 4 4.1 Troubleshooting... 9 5 Wireless Provisioning... 9 5.1 Embedded Webserver... 10 5.2 Wi-Fi Protected Setup (WPS)... 13 TWR-WIFI-G1011MI Lab Guide Page 2 of 15
1 Purpose This lab document describes how to run the MQX web-enabled demonstration applications using the TWR-WIFI-G1011MI Tower peripheral module. The TWR-MCF5225X Tower MCU module is used in these examples, but the basic instructions are the same for other MCU modules the can communicate with the TWR-WIFI-G1011MI. This document also covers how to configure your Tower System and wireless access point to run the demos 2 Configure Hardware To run the demos with the TWR-MCF5225X hardware and software projects, ensure that the jumpers and switches on the TWR-WIFI-G1011MI are in their default locations as shown below. Figure 1. TWR-WIFI-G1011MI Default Jumper Settings Table 1. TWR-WIFI-G1011MI Default Jumper and Switch Settings Jumper Option Setting Description SW1 Power Supply Input TWR PWR (Down) Power from Tower System 3.3V SW2 Mode Selection RUN (Down) GS1011MI in standard "run" mode J3 UART Routing Selection 2-3 Connect GS1011MI UART0 to Tower System J6 Serial Interface Selection 1-2 Enable SPI interface from Tower to GS1011MI J7 Master SPI Port CS Selection N/A No Connection J9 Slave SPI Port CS Selection 1-2 Connect Tower SPI0_CS0 to slave SPI CS on GS1011MI J10 Interrupt Selection 7-8 Connect GS1011MI interrupt to Tower IRQ_A (B62) J11 GS1011MI Reset Selection 2-3 No connection J12 GS1011MI Reset Selection 1-2 Connect GS1011MI Reset to Tower RSTOUT (A63) TWR-WIFI-G1011MI Lab Guide Page 3 of 15
The TWR-MCF5225X and TWR-SER should be set to their default settings as described in their respective Quick Start Guides and User s Manuals. Assemble your Tower system consisting of the TWR-MCF5225X, TWR-SER, and TWR-WIFI-G1011MI. Be careful to match the Primary edge of each module to the Primary (or Functional on older systems) TWR-ELEV module. Connect a USB cable between your development PC and the TWR-MCF5225X PWR/OSBDM USB connector. Connect a serial cable from the PC to the DB9 on the TWR-SER. A wireless access point will be required. Setup the wireless access point as desired and take note of the SSID and any security setting (if enabled). Ensure that your development PC can connect to the wireless access point. 3 Configure Software This lab walk-through guide uses the software listed below. Visit the links provided below to download and install the software if you do not already have it installed. 1. CodeWarrior for Microcontrollers v10.0 http://www.freescale.com/codewarrior NOTE: Projects for CodeWarrior for ColdFire v7.2 projects are also available for the GainSpan WiFi module. 2. MQX RTOS v3.6.2 http://www.freescale.com/mqx NOTE: If you are using a Windows Vista or Windows 7 computer, it is recommended that you install both CW10 and MQX outside of the default C:\Program Files\ directory. Windows UAC prevents writes to that directory if you are not running as administrator. You can also try running CW10 as the administrator if you have problems compiling projects or using the MQX New Project Wizard. 3. MQX GainSpan WiFi Patch http://www.freescale.com/towerwifi NOTE: The GainSpan WiFi Patch will patch against MQX 3.6.2 or later and will overwrite the TWRMCF52259 BSP files if installed directly to the existing MQX installation. You may wish to backup the existing BSP if you have other projects using it. You can also install the GainSpan WiFi patch to another directory and manually patch MQX. Refer to the release notes of the MQX GainSpan WiFi patch for more information. You will also need a terminal program (e.g. Hyperterminal, PuTTY, TeraTerm). 4 Running the Demos There are several web enabled demonstrations that come with the MQX RTOS installation. These demos use the Real-Time Communication Suite (RTCS) comprised of a full TCP/IP suite and several applications including an embedded webserver. By default these demos are configured to run using TWR-WIFI-G1011MI Lab Guide Page 4 of 15
the Ethernet interface on the selected MCU. However, after installing the MQX GainSpan WiFi Patch, these demos can be run utilizing the TWR-WIFI-G1011MI hardware. This lab guide walks you through the GainSpan webserver demo. This demo can be found in the \rtcs\examples\gstwr_httpsrv folder in the MQX installation directory. Other demos are available such as the standard RTCS httpsrv and rtcs_shell examples that have been modified to support the GainSpan WiFi drivers. These demos can be run using similar instructions to those provided below. This lab also assumes the use of the TWR-MCF5225X and TWR-SER (sold together in the TWR- MCF5225X-KIT) with the TWR-WIFI-G1011MI. However, the labs can be run on other MQX and GainSpan enabled hardware using similar steps. Check the TWR-WIFI-G1011MI tools support page on http://www.freescale.com/towerwifi for the latest demonstration lab guides. Also, refer to Section 5 Integration instructions in the WiFi patch for Freescale MQX RTOS Release Notes for information on how to add GainSpan WiFi support to other MQX BSPs. Follow these steps to run the gstwr_httpsrv demo on the TWR-MCF5225X-KIT with the TWR-WIFI- G1011MI: 1. Review the GainSpan WiFi patch for Freescale MQX RTOS Release Notes. These are available in the GainSpan WiFi patch. A shortcut in the Windows Start menu should be available after installation. 2. Launch CodeWarrior for MCUs. At the welcome screen, set the workspace to the desired directory. The default is C:\CW10\workspace. 3. Close any open projects in the CodeWarrior Projects panel by right-clicking on them and selecting Close Project. 4. Click on File->Import in the menu bar (or right-click in the CodeWarrior Projects panel and select Import ). 5. A dialog box will pop up. Select Existing Projects into Workspace in the General folder. Click Next. 6. Click the radio button to Select root directory: and browse to the mqx\build\cw10\bsp_twrmcf52259 directory in your MQX installation folder. Click Ok. TWR-WIFI-G1011MI Lab Guide Page 5 of 15
7. Select the bsp_twrmcf52259 project, and click Finish. Leave the Copy projects into workspace box unchecked. 8. Repeat this step to import the psp_twrmcf52259 project from mqx\build\cw10\psp_twrmcf52259 and the rtcs_twrmcf52259 project from rtcs\build\cw10\rtcs_twrmcf52259. 9. Build all the projects by clicking the Project->Build All option from the menu bar (or Ctrl+B) 10. Close all the open projects in the CodeWarrior Projects panel by right-clicking on them and selecting Close Project. 11. Follow the previous steps to import the httpsrv_twrmcf52259 project from rtcs\examples\gstwr_httpsrv. 12. Ensure that the Int Flash Debug target is selected. If not, hover the pointer over the target (to the right of httpsrv_twrmcf52259 in the CodeWarrior Projects panel), left-click and select the Int Flash Debug target. 13. Expand the project and the Source folder as shown below: TWR-WIFI-G1011MI Lab Guide Page 6 of 15
14. Open config.h and modify the settings as needed to match the settings of the wireless access point. Ensure the proper settings of ENET_IPADDR, ENET_IPMASK, DEMOCFG_SSID, DEMOCFG_NW_MODE, DEMOCFG_SECURITY, DEMOCFG_PASSPHRASE, and DEMOCFG_WEP_KEY. NOTE: The DEMOCFG_WEBPARAM_XXXX defines are used by the GS1011MIP embedded webserver and not the MQX RTCS webserver. These settings are used for web provisioning of the GS1011MIP as described in section 5.1. NOTE: By default, this demo uses a static IP address. Ensure that the ENET_IPADDR is set to a valid IP on the subnet of the wireless access point. NOTE: Instead of manually configuring the network settings in config.h, you can follow the steps in Section 5 Wireless Provisioning to automatically set the wireless settings in the GS1011MIP module. 15. Build the project by clicking on the Hammer icon in the toolbar 16. Double click on the httpsrv_twrmcf52259_mcf52259_int_flash.ttf file in the project panel. In the dialog box that comes up, click OK. The file will then open. You can then close it. You only need to do this step once after initially opening the project. TWR-WIFI-G1011MI Lab Guide Page 7 of 15
17. Click Run->Debug Configurations in the menu bar, and select the httpsrv_twrmcf52259_int_flash_debug_osbdm configuration. Then hit the debug button in the bottom of the window. 18. The code will then be flashed to the board and the debugger will start it. 19. Launch a terminal program (e.g. Hyperterminal, PuTTY, TeraTerm) 20. Hit the run icon to continue the program execution. 21. You should now see messages similar to the following in the terminal window: 22. Launch the web browser of your choice and type in the IP address assigned to the Tower System (ENET_IPADDR setting) in the address bar. 23. You should now see the web page served by the Tower System TWR-WIFI-G1011MI Lab Guide Page 8 of 15
4.1 Troubleshooting If you are unable to communicate wirelessly from a PC to the Tower System through an access point, try the following: 1. Ensure the Tower system is assembled correctly. Each tower module has a primary and secondary card edge connector. The primary side must be connected to the Primary (or Functional in older systems) Elevator. 2. Ensure that the PC is properly configured and able to connect to the wireless access point. In a command window, try ipconfig and ping to test the communication. 3. Ensure any proxy settings in your browser are turned off. 4. Turn off any other network connections (real and virtual). 5. With the target application running, try pinging the target Tower system. If you can t ping the target, then it is unlikely you will be able to connect. 6. Follow the steps below for Wireless Provisioning to automatically set the wireless settings in the GS1011MIP module. 5 Wireless Provisioning The IP-to-Wi-Fi software embedded on the TWR-WIFI-G1011MI module provides support for provisioning the module using multiple methods: 1. Embedded webserver 2. Wi-Fi Protected Setup (WPS) Push Button Either of these methods can be used to connect the Tower System to an access point. Alternatively, the information for the wireless access point can be hard-coded into the MQX demo software (as shown in section 4). WPS Button (SW1) Web Server (SW3) Reset (SW4) Figure 2. TWR-MCF5225X WPS Switch Functions TWR-WIFI-G1011MI Lab Guide Page 9 of 15
5.1 Embedded Webserver To enable provisioning using embedded web server: 1. Assemble your Tower system consisting of the TWR-MCF5225X, TWR-SER, and TWR- WIFI-G1011MI 2. Connect a serial cable from a PC running a terminal program (settings: 115200, 8N1) to the DB9 connector on the TWR-SER module 3. Program the TWR-MCF5225X with the gstwr_httpsrv example as shown in Section 4 Running the Demos or any other software that implements the required communication between the MCU and the GS1011MIP module. 4. Reset or cycle power on the Tower. The terminal window should display the startup messages similar to the figure below. 5. Press the SW3 button on the TWR-MCF5225X. The GS1011MIP will enter ad-hoc mode and create an ad-hoc network (GSWebProv) and allow an external wireless device (e.g. PC, smart phone, or tablet) to join. The default settings of the ad-hoc network are as follows: SSID: GSWebProv Channel: 11 Username: admin Password: admin Webserver IP: 192.168.37.100 6. You should now see messages similar to the following on the terminal window: TWR-WIFI-G1011MI Lab Guide Page 10 of 15
7. Configure the connecting external wireless device using a static IP. The IP address should be in the same subnet as the provisioning WebServer (i.e.192.168.37.xxx). Scan and connect wirelessly to the ad-hoc network. The figure below shows the successful connection of a PC using Intel PROSet/Wireless WiFi Connection Utility. 8. Once a connection is established, open a browser and type in the webserver IP address (192.168.37.100). This will prompt request for user ID and password. TWR-WIFI-G1011MI Lab Guide Page 11 of 15
9. Type the default username and password (admin, admin) and press Enter. This will launch the embedded web provisioning page. 10. From here, you may navigate to different pages: a. Wireless Settings (Wi-Fi): On this page you may configure the Wi-Fi related setting. For example, SSID, Channel, Infrastructure type, Security etc. Also you may select Find Available Wireless Network and select the desired network to configure. Click on Save button to save the configuration temporarily. Once saved, click Logout button, and the changes will be sent to the MCU. At this point, you should see messages similar to those in the window below. TWR-WIFI-G1011MI Lab Guide Page 12 of 15
NOTE: Once you Logout, you will come out of web provisioning mode and go into infrastructure mode and will try to join the network that was specified. This new network will then become the default network that the Tower system will join every time it powers up, until it is provisioned again to join a different network by pushing the SW3 switch on the MCU board. b. Administration Settings: Here you can change the login ID and password to the node. Click on Save to save the configuration temporarily. Once you press the Logout button, it will send the configuration to the Host processor. Please note that once you logout, you will exit web provisioning mode. c. Logout: Once all changes have been made, select Logout. Once you press the logout button, all configuration parameters with updated values are sent to Host processor and the node is rebooted. 5.2 Wi-Fi Protected Setup (WPS) In order to simplify the process of establishing a secure network, the Wi-Fi Alliance has defined a simplified Wi-Fi Protected Setup protocol allowing credentials to be exchanged between a client and AP without the need for manual creation, entry of the SSID or PSK. Two modes of operation are provided: Personal Information Number (PIN) and Push Button Configuration (PBC). The procedure to use the PBC method is described below. This procedure requires a wireless access point (AP), that supports WPS and the PBC method (e.g. a Linksys WRT160N). To invoke WPS using the PBC method: 1. Assemble your Tower system consisting of the TWR-MCF5225X, TWR-SER, and TWR- WIFI-G1011MI TWR-WIFI-G1011MI Lab Guide Page 13 of 15
2. Connect a serial cable from a PC running a terminal program (settings: 115200, 8N1) to the DB9 connector on the TWR-SER module 3. Program the TWR-MCF5225X with the gstwr_httpsrv example as shown in Section 4 Running the Demos or any other software that implements the required communication between the MCU and the GS1011MIP module. 4. Reset or cycle power on the Tower. The terminal window should display the startup messages similar to the figure below. 5. Press the SW1 button on the TWR-MCF5225X. The GS1011MIP module (client) will now enter the WPS PBS mode. Messages similar to those below should now appear in the terminal window. 6. A button on the AP (either a physical button on a clickable button icon in the embedded AP webserver) must be pressed within two minutes of the client entering WPS PBS mode. An exchange will then take place between the client and AP providing the SSID and randomly-generated passphrase that can thereafter be used for secure communications. TWR-WIFI-G1011MI Lab Guide Page 14 of 15
TWR-WIFI-G1011MI Lab Guide Page 15 of 15