SK-FM4-216-ETHERNET Wi-Fi Sample Kit Setup Manual Application Note

The following document contains information on Cypress products.
SK-FM4-216-ETHERNET
Wi-Fi Sample Kit Setup Manual
Application Note
Publication Number SK-FM4-216-ETHERNET_AN709-00006
Revision 1.0
Issue Date February_27_2015
A pp li cat i on
N ot e
Target products
This application is describes the products below.
Series
S6E2CC
Product Number (Not Including Package Suffix)
All products
SK-FM4-216-ETHERNET
2
SK-FM4-216-ETHERNET_AN709-00006_1v0-E, February_27_2015
Applic ation
Note
Table of Contents
1.
Contents of the Wi-Fi Module Sample Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1
Evaluation Boards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2
Contents of the Software Development Kit (SDK) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.
Features of the Wi-Fi Module Sample Kit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.1
Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2
Hardware Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.3
Software Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.
How to Set Up the Wi-Fi Module Sample Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.1
Hardware Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2
Software Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.3
Wi-Fi Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.
Wi-Fi Control and Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.1
wifi_connect Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2
wifi_disconnect Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.3
wifi_info Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.4
wifi_on Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.5
wifi_off Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.6
wifi_ap Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.7
wifi_scan Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.8
wifi_get_rssi Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.9
wifi_promisc Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.10 wifi_simple_config Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.11 wifi_wps Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.12 wifi_sta_ap Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.13 ttcp Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.14 ping Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.15 exit Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.16 help Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.
Sample Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.1
Web Server Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.2
DHCP Server/client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.
Major Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
February_27_2015 SK-FM4-216-ETHERNET_AN709-00006_1v0-E,
7
7
7
8
14
14
14
15
15
15
15
15
15
16
16
16
16
17
17
17
17
3
A pp li cat i on
4
N ot e
SK-FM4-216-ETHERNET_AN709-00006_1v0-E, February_27_2015
Applic ation
Note
1. Contents of the Wi-Fi Module Sample Kit
The sample kit consists of evaluation boards and the software development kit (SDK).
 The evaluation boards are the Spansion SK-FM4-216-ETHERNET and the Realtek Wi-Fi board.
 The SDK is made up of both Spansion IP and Realtek IP. The SDK was created in an EWARM
environment.
1.1
1.1.1
Evaluation Boards
SK-FM4-216-ETHERNET
The SK-FM4-216-ETHERNET supplies an S6E2CCAL0A MCU to represent the S6E2C Series.
Please refer to the URL http://www.spansion.com/Products/microcontrollers/Pages/tool-detail-sk-fm4-216ethernet.aspx#DOCUMENTATION for detailed specification and functionality of the SK-FM4-216ETHERNET SDK.
Also, please refer to the document S6ECC Series data sheet (DS709-00009) for detailed specification and
functionality of the S6E2CCAL0A MCU.
Figure 1.1 SK-FM4-216-ETHERNET
1.1.2
Wi-Fi Board
The Realtek Wi-Fi board using RTL8189EM is equipped with an SDIO/GSPI interface for MCU connectivity.
Please refer to the RTL8189EM data sheet for the detailed specification and functionality of the RTL8189EM.
February_27_2015 SK-FM4-216-ETHERNET_AN709-00006_1v0-E,
5
A pp li cat i on
N ot e
Figure 1.2 Realtek Wi-Fi Board with RTL8189EM
1.2
Contents of the Software Development Kit (SDK)
The SKD contains four projects. The basic project is spansion_s6e2cc_8189em_without_ota.
The other projects are used for using the Over the Air Dual Bank eFlash (OTA-D) function.
Note that this document explains only the setup of spansion_s6e2cc_8189em_without_ota.
If you want to know about the use of projects for OTA-D, please refer to the application note for OTA-D for the
S6E2xC Series of MCUs (AN709-00008).
Figure 1.3 Basic Project Structure
v02.5a
… Package
├─component
│ ├─common
│ │ ├─api
… Application interface
│ │ ├─drivers
… WLAN driver
│ │ ├─file_system
… empty
│ │ ├─network
… Network relation
│ │ ├─ota
… OTA-D Library
│ │ └─utilities
… Utility applications
│ ├─os
… FreeRTOS
│ └─soc
… MCU(FM4F) relation
├─doc
… Documents
├─project
│ ├─spansion_bootloader
… Bootloader project for OTA-D
│ ├─spansion_ota
… Binary project for OTA-D
│ ├─spansion_s6e2cc_8189em_with_ota
… Sample user application project with OTA-D
│ └─spansion_s6e2cc_8189em_without_ota … Sample user application project without OTA-D
└─tools
├─ota_server
… OTA-D Server
├─simple_config
… Wi-Fi connection application for smartphone
└─PCATTCP.exe
… Tool for test TCP
6
SK-FM4-216-ETHERNET_AN709-00006_1v0-E, February_27_2015
Applic ation
Note
2. Features of the Wi-Fi Module Sample Kit
2.1
Features
 Wi-Fi chip — Realtek RTL8189EM 2.4 GHz IEEE 802.11b/g/n SISO
 MCU on the SK-FM4-216-ETHERNET — S6E2CCAL0A Cortex-M4F 200 MHz embedded 256KB RAM,
2MB flash
 Interface — Serial (UART, IC, SPI) , GPIOs, JTAGs
 Software
– RTOS: FreeRTOS ver.7.4.0 as OSS
– (AP)/(Station) dual mode
– Built in Wi-Fi security support for WPA, WPA2
– LwIP for TCP/IP stack for IPv4 ver.1.3.1 as OSS
– Built-in DHCP server/client
– PolarSSL for SSL client ver.1.3.3 as OSS
– Enabled to build in application utilities
test TCP, Ping, Web server, Over The Air Dual Bank eFlash (OTA-D)
2.2
Hardware Block Diagram
Figure 2.1 Block Diagram of Sample Kit
February_27_2015 SK-FM4-216-ETHERNET_AN709-00006_1v0-E,
7
A pp li cat i on
2.3
N ot e
Software Block Diagram
Figure 2.2 Software Stack
Serial
command
application
Web server
application
DHCP
server/client
TTCP
Ping
etc.
SSL
(PolarSSL)
Peripheral
drivers
FreeRTOS
OTA-D
application
TCP/IP (LWIP)
Wi-Fi driver
Key:
Spansion property software
Realtek property software
Open source software
OTA-D Application
This is an optional function for S6E2xC series product.
(Not the S6E2 family.) Please refer to the application note
for OTA (for S6E2xC series).
3. How to Set Up the Wi-Fi Module Sample Kit
This section contains two parts:
 Hardware setup: Connecting the SK-FM4-216-ETHERNET and the Wi-Fi board.
 Software setup: Installing the firmware without OTA-D to the flash of a microcontroller.
3.1
3.1.1
Hardware Setup
Operating Environment (for Reference)
IDE: EWARM ver 6.70
ICE: I-Jet, J-Link, and J-Link-Lite
Laptop:
– Windows 7
– 2.5 GHz of CPU clock
– 4.0 GB RAM
8
SK-FM4-216-ETHERNET_AN709-00006_1v0-E, February_27_2015
Applic ation
3.1.2
Note
Hardware Connection
In this section, we explain how to connect the SK-FM4-216-ETHERNET to the Wi-Fi board.
Step 1: Set the jumpers of the SK-FM4-216-ETHERNET to the default setting.
Please refer to the users guide for SK-FM4-216 Ethernet for details of the default settings.
Step 2: Connect the SK-FM4-216-ETHERNET board to the Wi-Fi board through DuPont cables.
K-FM4-216-ETHERNET Pin
Pin Name
SPI Wi-Fi Module Pin
J5-127
SIRQ
1
—
NC
2
J4-97
MOSI
3
J4-108
GND
4
J5-109
VD33
5
J4-98
CLK
6
J5-136
GND
7
J4-96
MISO
8
J4-100
CS
9
Step 3: Connect the USB port (X-2 of Figure 3.1) for virtual com port of the SK-FM4-216-ETHERNET to your laptop.
Step 4: Configure the serial connection terminal emulator (Tera Term or Hyper-terminal) on your laptop with the
following parameter.
Port: COMx
Bits: 115200
– Data bits: 8
– Parity Check: none
– Stop: 1
– Data flow control: none
Figure 3.1 Connectors of the SK-FM4-S16-ETHERNET
February_27_2015 SK-FM4-216-ETHERNET_AN709-00006_1v0-E,
9
A pp li cat i on
N ot e
Figure 3.2 Connectors of the Wi-Fi Module
3.1.3
How to Turn on the Board
To turn on the Wi-Fi Module:
 SK-FM4-216-ETHERNET: power supplied by AC adapter, USB or JTAG.
Notes:
– There is the setting of jumpers at each kind of power supply.
– Please refer to the users guide for the SD-FM4-216-ETHERNET for jumper settings.
– Using the AC adapter
Supply voltage is 9–24 V.
Power switch is S2.
– Using USB
Connecting a USB cable to the X12 port. (Because the operation will become unstable, don’t supply
the power using the X2 port.)
Note:
– Jumper settings are different at each connected port.
– JTAG
Ensure that the adapter is able to provide enough current for your application.
 Wi-Fi board: power supplied from the SK-FM4-216-ETHERNET via a DuPont cable.
3.2
Software Setup
In this section, we explain how to build and download the built code.
Step 1: Open IAR Workbench.
Step 2: To open project, [File] → [Open] → [Workspace].
10
SK-FM4-216-ETHERNET_AN709-00006_1v0-E, February_27_2015
Applic ation
Note
Figure 3.3 Step 2 of Software Setup
Step 3: Select Project.eww in
project\spansion_s6e2cc_8189em_without_OTA-D\EWARM-RELEASE
Step 4: To build the project, [Project] → [Rebuild All]
Note:
– Make sure the sample project built successfully without errors.
February_27_2015 SK-FM4-216-ETHERNET_AN709-00006_1v0-E,
11
A pp li cat i on
N ot e
Figure 3.4 Step 4 of Software Setup
Step 5: To download the built code, [Project] → [Download] → [Download active application]
Note:
– You can verify that the code successfully downloaded into the SK-FM4-216-ETHERNET board by checking the screen below.
Figure 3.5 Step 5 of Software Setup
12
SK-FM4-216-ETHERNET_AN709-00006_1v0-E, February_27_2015
Applic ation
3.3
Note
Wi-Fi Connection
Step 1: Reset the SK-FM4-216-ETHERNET.
Push the reset button
Step 2: Confirm serial output from the K-FM4-216-ETHERNET.
Serial output is as follows if operating correctly.
Figure 3.6 Serial Output of Startup
Step 3: Connect to the Wi-Fi module sample kit from your laptop.
Default SSID of Wi-Fi module sample kit is wlan_ap_ssid.
Figure 3.7 Operation of Laptop
February_27_2015 SK-FM4-216-ETHERNET_AN709-00006_1v0-E,
13
A pp li cat i on
N ot e
4. Wi-Fi Control and Commands
The kit provides commands to control Wi-Fi from your laptop with serial communication.
The following is the description of built-in commands.
Note:
– Please refer to 4.2 section of the document UM0005 Realtek wlan init and configuration for the detailed description of commands.
Table 4.1 Commands
Command
4.1
Note
wifi_connect
Connects to the access point.
wifi_disconnect
Disconnects from the access point.
wifi_info
Displays information about the Wi-Fi module.
wifi_on
Initializes the Wi-Fi driver.
wifi_off
Disables the Wi-Fi driver.
wifi_ap
Switches the Wi-Fi module from Station mode to AP mode.
wifi_scan
Displays the Wi-Fi (Network) scan results
wifi_get_rssi
Displays the received signal strength indicator value.
wifi_promisc
Displays result returned on the Promiscuous mode of the Wi-Fi driver.
wifi_simple_config
Connects with the Android or iOS device that is installed with the dedicated application.
wifi_wps
Shifts the Wi-Fi module to WPS Connecting mode.
wifi_sta_ap
Switches Wi-Fi module to Station mode and AP mode concurrently.
ttcp
Measures throughput.
Ping
Sends ping packets.
Exit
Closes the interface of serial commands.
Help
Displays usable commands.
wifi_connect Command
This command connects to the Wi-Fi network.
 Syntax — wifi_connect[SSID][WPA2/WEP -password][WEP-key-ID]
 Parameters
– [SSID]:
Connection target.
– [WPA2/WEP-password]: Password of WPA2 or WEP.
– [WEP-key-ID]:
key ID for WEP.
If the WEP-key-ID parameter is omitted, the Wi-Fi module works in WPA2 security mode.
Also, if both the WEP-key-ID and WPA2/WEP-password are omitted, the Wi-Fi module works in open
security mode.
4.2
wifi_disconnect Command
This command disconnects from the Wi-Fi network.
 Syntax — wifi_disconnect
 Parameters — Not required
14
SK-FM4-216-ETHERNET_AN709-00006_1v0-E, February_27_2015
Applic ation
4.3
Note
wifi_info Command
This command displays the following status of the Wi-Fi driver.
 Wi-Fi setting status — Wi-Fi mode, SSID, Security mode, password, MAC, IP, GW address
 Wi-Fi running status — Free space of heap size, usage of the socket buffer, number of the using timer
 Syntax — wifi_info
 Parameters — Not required
4.4
wifi_on Command
This command initializes the Wi-Fi driver.
After the Wi-Fi driver is initialized, the Wi-Fi module will work in Station mode.
 Syntax — wifi_on
 Parameters — Not required
4.5
wifi_off Command
This command disables the Wi-Fi driver.
Also, this command triggers disconnection from a Wi-Fi network.
 Syntax — wifi_off
 Parameters — Not required
4.6
wifi_ap Command
This command switches the Wi-Fi module from Station mode to AP mode.
 Syntax — wifi_ap [SSID] [Channel] [WPA2-password]
 Parameters
– [SSID]:
SSID of AP mode.
– [Channel]:
Channel number is 1 to 13.
– [WPA2-password]:
Password for WPA2.
If the WPA2-password is set, the Wi-Fi module works in WPA2 security mode.
If the WPA2-password is omitted, Wi-Fi module works in open security mode.
4.7
wifi_scan Command
This command scans the AP list.
 Syntax — wifi_scan [Buffer_length]
 Parameters
– [Buffer_length]: Buffer length for AP list.
Note:
– Default recommended value is 500.
4.8
wifi_get_rssi Command
This command gets the RSSI value from the Wi-Fi driver.
 Syntax — wifi_get_rssi
 Parameters — Not required
February_27_2015 SK-FM4-216-ETHERNET_AN709-00006_1v0-E,
15
A pp li cat i on
4.9
N ot e
wifi_promisc Command
This command makes the Wi-Fi driver run in Promiscuous mode and gets the result of Promiscuous mode.
Promiscuous mode moves all channels (1 to 13) and gets promiscuous packets.
 Syntax — wifi_promisc [Duration]
Parameters
– [Duration]:
4.10
Time stayed in each channel. [second]
wifi_simple_config Command
This command connects the android base dedicated application that is placed SimpleConfigApp.apk in tools/
simple_config/Android.
Please refer to the document AN0011 Realtek WLAN Simple Configuration in /doc for using this application.
 Syntax — wifi_simple_config [PIN-code]
 Parameters
– [PIN-code]:
The dedicated application for android requires PIN-code.
PIN-code is set on the Android application.
4.11
wifi_wps Command
This command initiates the connection for WPS.
 Syntax — wifi_wps [Config_method]
 Parameters
– [Config_method]:
Configurable method is pin or pbc.
pin: The connection by PIN-code.
pbc: The connection by push button.
4.12
wifi_sta_ap Command
This command switches the Wi-Fi module to Coexistent mode of Station and AP.
 Syntax — wifi_sta_ap [SSID] [Channel] [WPA2-password]
 Parameters
– [SSID]:
SSID of AP mode.
– [Channel]:
This channel number is used on AP mode of the Wi-Fi module.
– [WPA2-password]:
Password for WPA2.
If the WPA2-password is set, the Wi-Fi module works WPA2 security mode.
If the WPA2-password is omitted, the Wi-Fi module works open security mode.
16
SK-FM4-216-ETHERNET_AN709-00006_1v0-E, February_27_2015
Applic ation
4.13
Note
ttcp Command
This command runs the throughput test for Rx/Tx.
 Syntax — ttcp [Mode] [Size] [Count] [Dest_addr]
 Parameters
– [Mode]:
ttcp running mode is r, t, rt, or tr
r: Reception mode.
t: Transmission mode.
rt and tr: Reception and Transmission mode at the same time.
– [Size]:
Sending packet size
– [Count]:
Count of sending packet
– [Dest_addr]:
Destination IP address for IPv4
Note:
– If mode is r, Count and Dest_addr parameters must be omitted.
4.14
ping Command
This command sends ping packets.
 Syntax — ping [Dest_addr] [Count]
 Parameters
– [Dest_addr]:
Destination IP address for IPv4
– [Count]:
Count of sending ping packet
Note:
– If the Count parameter is omitted, ping packet is sent five times.
4.15
exit Command
This closes the interface of serial commands.
 Syntax — exit
 Parameters — Not required
4.16
help Command
This command gets the usable command list.
 Syntax — help
 Parameters — Not required
5. Sample Application
5.1
Web Server Application
Please refer to the document UM0014 Realtek web server user guide for detailed description of commands.
5.2
DHCP Server/client
DHCP server and client are enabled at default setting of the sample kit.
If you want to disable the DHCP server and client, please refer to the document UM0005 Realtek wlan init
and configuration.
February_27_2015 SK-FM4-216-ETHERNET_AN709-00006_1v0-E,
17
A pp li cat i on
N ot e
6. Major Changes
18
Page No.
Section
—
N/A
Description
Initial release
SK-FM4-216-ETHERNET_AN709-00006_1v0-E, February_27_2015
Applic ation
Note
Colophon
The products described in this document are designed, developed and manufactured as contemplated for general use, including without
limitation, ordinary industrial use, general office use, personal use, and household use, but are not designed, developed and manufactured as
contemplated (1) for any use that includes fatal risks or dangers that, unless extremely high safety is secured, could have a serious effect to the
public, and could lead directly to death, personal injury, severe physical damage or other loss (i.e., nuclear reaction control in nuclear facility,
aircraft flight control, air traffic control, mass transport control, medical life support system, missile launch control in weapon system), or (2) for
any use where chance of failure is intolerable (i.e., submersible repeater and artificial satellite). Please note that Spansion will not be liable to
you and/or any third party for any claims or damages arising in connection with above-mentioned uses of the products. Any semiconductor
devices have an inherent chance of failure. You must protect against injury, damage or loss from such failures by incorporating safety design
measures into your facility and equipment such as redundancy, fire protection, and prevention of over-current levels and other abnormal
operating conditions. If any products described in this document represent goods or technologies subject to certain restrictions on export under
the Foreign Exchange and Foreign Trade Law of Japan, the US Export Administration Regulations or the applicable laws of any other country,
the prior authorization by the respective government entity will be required for export of those products.
Trademarks and Notice
The contents of this document are subject to change without notice. This document may contain information on a Spansion product under
development by Spansion. Spansion reserves the right to change or discontinue work on any product without notice. The information in this
document is provided as is without warranty or guarantee of any kind as to its accuracy, completeness, operability, fitness for particular purpose,
merchantability, non-infringement of third-party rights, or any other warranty, express, implied, or statutory. Spansion assumes no liability for any
damages of any kind arising out of the use of the information in this document.
Copyright © 2015 Spansion. All rights reserved. Spansion®, the Spansion Logo, MirrorBit®, MirrorBit® Eclipse™, ORNAND™, ORNAND2™, HDSIM™ and combinations thereof, are trademarks of Spansion LLC in the US and other countries. Microsoft® Windows is a registered trademark
of Microsoft Corporation in the U.S. and other countries. Other names used are for informational purposes only and may be trademarks of their
respective owners.
February_27_2015 SK-FM4-216-ETHERNET_AN709-00006_1v0-E,
19