Você está na página 1de 59

TM

22 June 2011
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, t he Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Introduction Session Objectives Network Concepts Freescale RTCS


Initialization

and Configuration Interface Initialization Socket API Application Layer Protocols HTTP Web Server

Gainspan Wi-Fi
Freescale on Facebook
Tag yourself in photos and upload your own!

Tweeting?
Please use hashtag #FTF2011

TM

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

This course covers TCP/IP connectivity concepts using the Freescale MQX RTOS (Real-Time Operating System) Most embedded products use some level of connectivity for a variety of reasons:

Communication with other embedded devices or computers Providing a user interface Downloading diagnostic information Updating application images

With the concepts presented in this session, you will be able to add Ethernet connectivity to your products to increase their value to your customers, increase their maintainability, and to make development easier Presenters:

Anthony Huereca, Applications Engineer, Freescale Semiconductor Inc. Ravi Subramanian, Gainspan Corporation

Session duration is 2 hours


Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

TM

After completing this session you will be able to:


Configure and initialize RTCS Use the socket API to create TCP and UDP connections Use the HTTP Web Server to serve dynamic data in a web page Configure Wi-Fi

RTCS Real-Time TCP/IP Communications Suite API Application Programming Interface TCP Transmission Control Protocol UDP User Datagram Protocol

TM

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

TM

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, t he Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

TCP/IP stack designed for embedded processors Uses standard socket interface Extensive list of application layer protocols Scalable at compile time and/or runtime:
Only

used protocols are included Data requirements are tunable Protocol behavior is controllable

Integrated with CodeWarrior to provide TCP/IP-aware debugging Standard release across all processors Integrated with a number of third-party optional packages

TM

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

RPC XDR

SSH* Telnet

XML*

SMTP* POP3*
HTTP

SNMP SNTP

FTP SSL*

TFTP

DNS

Sockets

BootP

DHCP

RIP

ICMP

TCP IP IPCP PPP

UDP

IGMP
* Optional third party package ** On request

NAT**
IP-E ARP

PAP

CHAP

CCP

LCP

Ethernet
TM

Serial
7

PPPoE**

HDLC

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Application Task

Application Task

Telnet FTP Client Server SNMP Telnet FTP Agent Server Client SNTP DHCP Client Server RTCS API

HTTP Server

Application Task

TCP UDP ICMP IGMP IP IP-E

ARP

TCP/IP Task
RTCS MQX

Serial

ADC

I2 C

Enet

TM

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

TM

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

TM

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, t he Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Create RTCS by calling RTCS_create() Initialize interface(s)


Assign

MAC addresses IP address, subnet mask

RTCS Apps RTCS API

Bind RTCS to interface


Assign

Initialize RTCS applications

TCP/IP Task
RTCS Enet

MQX

TM

11

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

TM

12

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

TM

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, t he Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Data transfer is done with sockets A socket is one endpoint of a two-way communication link Socket defines:
Protocol Local

IP address and port # Remote IP address and port #

RTCS supports TCP and UDP sockets

TM

14

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Unbound Bound to datagram (UDP) recvfrom() bind() sendto() connect() accept() listen() Bound to stream (TCP)

socket()

send()

recv()

select()

getsockopt()

setsockopt()

shutdown ()

TM

15

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

TM

16

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

TM

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, t he Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Socket options can be set to override default socket behavior using setsockopt():

value = 256; setsockopt(listensock,SOL_TCP, OPT_TBSIZE, &value, sizeof(value));

Socket options that can be set include:


Window

sizes Various timeouts Blocking vs. non-blocking mode Send and receive push flags

Some options must be set before socket is bound For memory constrained applications, it will be necessary to override a few defaults

TM

18

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Close to 100 compile time configuration settings Defaults set in RTCSCFG.H, overridden by user_config.h

Each protocol can be individually enabled/disabled Protocol statistics can be individually enabled/disabled Level of error checking performed is configurable

TM

19

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Allows dynamic control of RTCS, including:


RTCS task priority and stack size RTCS memory allocation (where, how much) Enabled protocols and protocol behavior Socket behavior

TM

20

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

TM

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, t he Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Telnet Server Telnet Client

FTP Server FTP Client

TFTP Server TFTP Client

DHCP Server DHCP Client

HTTP Server DNS Resolver SNMP Agent

IPCFG

SNTP Client

RTCS API

TCP/IP Task

RTCS
MQX

TM

22

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

TM

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, t he Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

HTTP 1.1 with persistent connections PUT and GET Methods Form decoding Support for multiple virtual WEB folders, with custom WEB folder path mapping to file system paths. Static filesystem content: pages, images, multimedia, Java archives Dynamic page content, suitable for AJAX applications.

CGI-like, dynamic content pages ASP-like, in-page placeholders

Basic authentication Integrated with MQX I/O subsystem, MFS and TFS Runs as:

Single task servicing multiple sessions One task per session Polled mode

TM

24

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

HTTP Client

HTTP Server

CGI Table CGI CGI

MQX I/O Subsystem FN Table TFS

MFS

Others
fn USB CF SD etc fn

TM

25

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Include tfs.h, httpd.h and httpd_types.h Declare CGI and Function callback tables, if required

TM

26

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Install Filesystem Initialize HTTP server, specify root directory and home page Register CGI table and function callback table, if required Start server

TM

27

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

The Redpine WiFi Tower Module (TWRWIFIRS2101) is a lowcost evaluation, demonstration and development board that features an 802.11n solution from Redpine Signals Features RS9110N1121 WiFi module:

Compliant to 802.11b/g and single stream 802.11n Supports all WiFi client security protocols (WEP, WPA, and WPA2) Reference design certified for FCC/IC/CE RoHS compliant Does not require any WLAN driver on the host processor Host interface through SPI Terminates SLIP connections and offers transparent serial modem functionality Integrated antenna, frequency reference, and lowfrequency clock Ultra low power operation with power save modes Single supply 3.1 to 3.6V operation

TM

28

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

TM

29

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

The RS9110N1121 module from Redpine's Connection family of products is a complete IEEE 802.11b/g/n WiFi client device with a standard serial or SPI interface to a host processor or data source It integrates a MAC, baseband processor, RF transceiver with power amplifier, a frequency reference, an antenna, and all WLAN protocol and configuration functionality in embedded firmware to provide a selfcontained 802.11n WLAN solution for a variety of applications. No WLAN driver functionality is required on the host processor For the TWRWIFIRS2101 Tower Peripheral Module, the RS9110N1121 module communicates with the MCU through an SPI

TM

30

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

TM

31

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Demos:
Telnet

server Web server SNTP* SMTP with sockets* DNS resolution* DHCP client* Digital sign**

RTCS Users Guide ** MPC5125 demo only

*MCF51CN demos only

TM

32

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

TM

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, t he Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Quickly add Wi-Fi and IP connectivity to Freescale MCU based products

For External Antenna (optional)

Secondary Connector Connector

RS232 DB9 Connector for Programming Module

Coldfire and Kinetis Support

GS1011MIP WiFi Module Power Connector (Optional)

Wi-Fi and IP network parameter provisioning through Web Server or Wi-Fi Protected Set-up (WPS) Supports all GS1011M family SKUs providing flexibility for ultra low power capability or extended range capability

Program Switch

Primary Connector

TM

34

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

GainSpan WiFi Tower Module (TWRWIFIGS1011M) Lowcost, ultra low power evaluation board Featuring the GainSpan GS1011M module Family
Antenna

3.3V QSPI_DOUT SSPI_DIN SSPI_DOUT SSPI_CS

Cold Fire or Kinetis MCU (SPI Master) TWR BRD

QSPI_DIN QSPI_CS0

GS1011M TWR Module (SPI Slave)


GPIO 28 UART

LEDs

QSPI_CLK

SSPI_CLK

GS_SPI_HOST_WAKEUP

RS232
Debug or Programming Port
TM

35

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

TM

36

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Solder down module family Three types that are pin compatible

Low Power (Internal PA) Extended Range (External PA) 802.11b/g/n


Low Power (GS1011MI)
0.9 in X 1.28 in 48 4-layer, single sided 8dBm (internal PA) Trace or Ext Antenna (u.FL) SPI, UART, I2C, GPIO, A/D, PWM FCC, ETSI, IC, Japan, Wi-Fi Serial to Wi-Fi, IP to Wi-Fi, SoC SDK Raw frames, UDP, TCP/IP, AT, XML UART, SPI 48 4-layer, single sided 18dBm (external PA) Trace or Ext Antenna (u.FL) SPI, UART, I2C, GPIO, A/D, PWM FCC, ETSI, IC, Japan, Wi-Fi Serial to Wi-Fi, IP to Wi-Fi, SoC SDK Raw frames, UDP, TCP/IP, AT, XML UART, SPI
37

GS1500M June11 Samples Q311 certification and production release

Features
Size No. of Pins Layers RF Output (Typical) Antenna Options I/O Certifications Firmware Options Data and Control Protocols Host Connection

Extended Range (GS1011ME)


0.9 in X 1.45 in 48

802.11b/g/n (GS1500M)
0.9 in X 1.45 in

4-layer, single sided 18dBm (internal PA) Trace or Ext Antenna (u.FL) SPI, UART, I2C, GPIO, A/D, PWM FCC, ETSI, IC, Japan, Wi-Fi Serial to Wi-Fi, IP to Wi-Fi, SoC SDK Raw frames, UDP, TCP/IP, AT, XML UART, SPI

TM

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Compliant to 802.11b and operates with standard 802.11 b/g/n access points Provides the lowest average power consumption with power save modes

7 uA in Standby State 150 uA in Deep Sleep state

Lowest latency from standby to network connectivity

System is ready for network connection and data transfer within 25ms

TWR-WIFI-GS1011M module uses GS1011MIP integrated antenna SKU


GS1011M SKUs with external antenna and PA are also available All GS1011M SKUs are pin compatible

Certified RF Module: FCC/IC, ETSI, RoHS, Compliant with JAPAN regulatory Interfaces with MCU using either UART and/or SPI interfaces (SPI Default)

Up to 3 MHz in SPI Slave Mode Up to 921.6 kbps baud rate on UART

TM

38

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Wi-Fi Connectivity via embedded firmware on TWR-WIFI Module Full Wi-Fi stack and optional IP stack and services No additional Wi-Fi functions required on MCU side Supports Infrastructure, Adhoc mode or Limited AP Mode Ease of use and provisioning using Wi-Fi Protected Setup (WPS) Embedded Web Server (HTTP) Supports both Personal and 802.1x Enterprise Security WEP, WPA, WPA2-PSK EAP-TLS, EAP-TTLS, EAP-FAST, PEAP Provides support for Over the Air Programming
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

TM

39

Traditional Wi-Fi
400+MHz ARM11 WinCE, Linux
Networking and High Level Wi-Fi Software (WPS, Security) Host

GainSpan Embedded Wi-Fi


IP to Wi-Fi
Host

Serial to Wi-Fi
Host

32bit CPU
Applications Network Services Network Stack Wi-Fi Services Device Driver

32/16bit MCU
Applications Network Services Network Stack Device Driver

8/16bit MCU
Applications Command Driver

GS1011 GS1011 Wi-Fi Chip


API Interface Wi-Fi Services Kernel/RTOS MAC, I/O Drivers IP to Wi-Fi Wi-Fi Services Device Drivers RTOS Serial to Wi-Fi Network Services Network Stack Device Drivers RTOS

Low Level Wi-Fi Firmware

API Interface Wi-Fi Services Kernel MAC, I/O Drivers

API Interface Wi-Fi Services Kernel MAC, I/O Drivers

All Wi-Fi related firmware (WPS, Security)


TM

40

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Host Microcontroller

GainSpan Wi-Fi Module

AT Commands

Serial to Wi-Fi

TCP Pipe UDP Pipe

No TCP/UDP/IP Stack

Wi-Fi Configuration FW Update - OTA

WPA/2 Security

Home

HTTP/ TCP Pipe

Mobile Monitoring and Control

SSL

IP

Data Management Remote Diagnostics

Device Data & Commands


IP to Wi-Fi AT Commands 802.11 Frame Wi-Fi Configuration FW Update - OTA

Internet

TCP/UDP/IP Stack
For More details go to www.gainspan.com
TM

Remote Support

41

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Application
HTTP FTP Other Applications

Freescale MCU Cold Fire Or Kinetis

Socket Interface

Freescale Real Time TCP/IP Communication Suite (RTCS)


MQX

TCP

UDP

DHCP

ARP

ICMP

GS1011 WiFi Driver

Freescle MQX QSPI/DSPI/TTY HAL

Host Interface layer

GainSpan GS1011M

Station Management Entity

Data Processing Engine

WPA-WPA2

802.11 b/g Mac/Phy

TM

42

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

GS1011M Device Driver

Receive Data

Command Response

Send Data

Command Send

Serial Input Task: gs_serial_task gs_init.c

Read API

SPI Handler Task: gs_spi_hlr_task Write API gs_util.c

TM

43

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Gs_initialize() [gs_init.c] Driver initialization starts with this function called from FSL NW Stack Initializes the serial interface on the MCU Allocates resources and gets basic GS1011 information Puts the GS1011M in ready state to accept commands Sets up the necessary tasks for handling serial data Interface structure between the GS WiFi driver and MQX network stack is GS_IF of type ENET_MAC_IF_STRUCT Structure contains the entire WiFi driver APIs that NW stack can access Serial Input Handling Runs as a state machine processing all commands Receives all serial data from GS1011M which is packed with a header and tail Strips the header and sends data to MQX network stack Data is received in following format ESC<R>:<Length>:<Data>
TM

44

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

SPI data transfer always works in full duplex mode. SPI data transfer request will be triggered by following events: Data transfer request by Host Application Task (write request): After receiving the data transfer request from application task via write operation, SPI data handler task starts transmitting data to slave ( GS1011M), till all the data transferred and host wakeup signal is in de-asserted state(host wake-up signal becomes LOW). While transmitting the data, it also receives data resulting in full-duplex transfer. Data ready indication from Slave GS101 node via host wake-up signal: Host wake-up signal assertion (LOW to HIGH transition) is detected by GPIO driver and appropriate callback will be executed to send an event to SPI handler task. After receiving host wake-up signal event, SPI handler task starts pulling out the data by giving clock (i.e. write IDLE dummy pattern). It continues to pull the data as long as Host wake-up signal is HIGH. During this period, if any transmit request is pending, thats getting serviced. This approach results in full duplex data transfer. During data transfer it also handles flow control. If there is no data to transmit then IDLE fill pattern shall be transmitted. Byte stuffing and de-stuffing is incorporated by this task. For Details refer to the GS WiFi Driver Document

TM

45

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

The GS1011 device driver interfaces with the ENET layer of RTCS as an NIC. The GS1011 module is added as the ENET device 1, whereas the Ethernet controller (FEC) is ENET device 0. The MAC and PHY callbacks and the default ENET device parameters submitted for GS1011 module are as follows:
Gs_stop() [gs_util.c] This API reset the GainSpan SOC and free all the resources allocated for the wifi driver. Gs_send() [gs_send.c] This API sends an Ethernet packet formed by the Mqx network stack to the GainSpan SOC which sends that to wifi. Gs_read() [gs_util.c] This is a dummy function to make compatible with Ethernet driver. Gs_write() [gs_util.c] This is a dummy function to make compatible with Ethernet driver.
TM

46

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Gs_init.c contains the driver initialization, interface initialization and resource allocation for the GS1011 wifi driver. Gs_open.c contains the driver open function Gs_utils.c contains various functions which communicate to the GS1011 module through SPI or uart interface with predefined command set. Gs_send.c contains the data send function which sends data from MCU to GS1011 module. Gs_receive.c contains the data receive function which receive data from GS1011 module pass to the MCU network stack. Gs_conn_mgt.c contains the connection management functions. Gs_con_manage.c contains the network connection handler. gs_mediactl.c contains the media control handlers Gs_prv.h contains the GS1011 module specific definitions.
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

TM

47

The connection management state machine starts with the Wi-Fi mode setting on the Wi-Fi driver using the GS Wi-Fi driver ioctl (gs_mediactl()) function. Before setting the mode the application should fill the ssid, security type and security key/information on the GS Wi-Fi driver using the GS Wi-Fi driver ioctl(gs_mediactl()) functions. The connection management state machine function is gs_conn_handler(). The main states of this connection management are: Station Ready Station Down, not associated Station security set done Station management done Station association done. This connection management handles any disconnect event from the AP and make sure the node is associated to the AP.

TM

48

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

RTCS provides the Wireless media parameters control and configuration interfaces through the iwconfig set/get API or ENET_mediactl API. All the control and configuration commands issued by the application for a particular device are directed to the media control callback submitted by that device driver. For the GS1011 module, Gs_mediactl is the callback. The GS1011 device drivers set/get functions are invoked by the Gs_mediactl in response to the iwconfig/ENET_mediactl invocations from the application. The following are the parameters that can be configured: Power save mode Wireless retry count(both set and get) Scan (both set and get) Security type (both set and get) Network to join (essid) (both set and get) Network mode(both set and get) Wpa/wpa2 psk security passphrase (both set and get) Wep key(both set and get) WPS Web provisioning Arguments for some of the above parameters are defined in enet_wifi.h.

TM

49

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

ENET_SET_MEDIACTL_MODE saves mode i.e Infrastructure or Adhoc ENET_SET_MEDIACTL_SCAN Starts scan ENET_SET_MEDIACTL_PASSPHRASE ENET_SET_MEDIACTL_ESSID ENET_SET_MEDIACTL_RETRY ENET_SET_MEDIACTL_ENCODE ENET_SET_MEDIACTL_POWER (en/dis pwr save) ENET_SET_MEDIACTL_SEC_TYPE ENET_SET_WPS_ENABLE ENET_SET_WEB_PROV_ENABLE ENET_SET_WEB_PROV_PARAM_SSID ENET_SET_WEB_PROV_PARAM_CH ENET_SET_WEB_PROV_PARAM_USRNAME ENET_SET_WEB_PROV_PARAM_PWD

TM

50

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

ENET_GET_MEDIACTL_SEC_TYPE ENET_SET_MEDIACTL_PASSPHRASE ENET_GET_MEDIACTL_MODE ENET_GET_MEDIACTL_SCAN ENET_GET_MEDIACTL_RETRY ENET_GET_MEDIACTL_ENCODE ENET_GET_MEDIACTL_POWER ENET_MEDIACTL_IS_INITIALIZED ENET_GET_WEB_PROV_PARAM_USRNAME ENET_GET_WEB_PROV_PARAM_PWD

TM

51

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

#ifndef BSPCFG_ENABLE_GS #define BSPCFG_ENABLE_GS #endif #if BSPCFG_ENABLE_GS #define BSP_GS_UART_DEVICE #define BSP_GS_SPI_DEVICE #define BSP_GS_GPIO_DEVICE #define BSP_GS_GPIO_INT_PIN #ifndef BSPCFG_GS_PCB #define BSPCFG_GS_PCB #endif #endif

/* If GS driver module is NOT enabled */

"ittye:" "spi2:" "gpio:input"

/* GainSpan UART channel configuration */ /* GainSpan SPI channel */ /* GPIO pin as input*/

/* GPIO pins configuration PORT A pin#27 */ (GPIO_PORT_A|GPIO_PIN_IRQ_RISING|GPIO_PIN27) 16 /* PCB count for GS driver module */

Existing Macros modified:

/* ENET device count added for GS driver */


#define BSP_ENET_DEVICE_COUNT File Name: user_config.h

(MACNET_DEVICE_COUNT+ (BSPCFG_ENABLE_GS?1:0))

Newly added Macro list:

#define BSPCFG_ENABLE_GS
Modified Macro list:

/* New macro defined to enable GS driver */

#define BSPCFG_ENABLE_ITTYE #define BSPCFG_ENABLE_TTYF #define BSPCFG_ENABLE_SPI2 #define BSPCFG_ENABLE_FLASHX 0 1 1

/* serial interface to GS1011 SOC */

/* Not used in case of GS1011 SOC interface */ /* SPI interface to GS1011 SOC */

TM

52

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

iwcfg_set_essid (IPCFG_default_enet_device, essid); This API sets the network to which the GS1011 module has to connect. The first argument is the device number (1 for the GS1011 module) and the second argument is the string that contains the network name to which the module will connect. #define DEMOCFG_SECURITY "none" iwcfg_set_sec_type (IPCFG_default_enet_device,DEMOCFG_SECURITY); This API sets the security type of the network to join as open. iwcfg_set_mode (IPCFG_default_enet_device,DEMOCFG_NW_MODE); This API triggers the GS1011 module to scan and connect to a network.

The above calls are sufficient for the GS1011 module to set up a Wireless link. If the network to join is security enabled, security key and security type have to be configured with iwcfg_set_passphrase and iwcfg_set_sec_type as follows (before iwcfg_set_mode).

#define DEMOCFGPSK 12345678 iwcfg_set_passphrase(IPCFG_default_enet_device,(char_ptr)DEMOCFGPSK); #define DEMOCFG_SECURITY "wpa2" iwcfg_set_sec_type (IPCFG_default_enet_device,DEMOCFG_SECURITY)

TM

53

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

To put the GS1011 module into power save mode, the following iwconfig interface needs to be invoked as shown below. iwcfg_set_power ( IPCFG_default_enet_device, 0, FALSE

);
To bring the GS1011 module out of power save mode, use the same iwconfig interface as shown below. iwcfg_set_power ( IPCFG_default_enet_device, 0, TRUE ); Similarly to scan all channels and get the scan information as shown below. The scan results are getting printed on the serial console. iwcfg_set_scan ( IPCFG_default_enet_device, NULL )

Similarly using the ENET_mediactl to scan all channels as shown below.


ENET_SCAN_LIST param; ENET_mediactl (ENET_handle,ENET_SET_MEDIACTL_SCAN,NULL); ENET_mediactl (ENET_handle,ENET_GET_MEDIACTL_SCAN,&param);

TM

54

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

The TWR-WIFI-GS1011M patch will install the necessary folder/files to MQX


GS directory and related GS driver files are copied to following path ~\mqx\source\io\enet\gs Files phy_gs.h and phy_gs.c are copied to ~mqx\source\io\enet\phy

Steps to add GS driver files to BSP project:


1. Go the directory in which 'mqx' is installed (explore outside the IDE) Make sure 'gs' directory and related GS driver files are present in the following path '~\mqx\source\io\enet\gs' Also make sure that 'phy_gs.h' and 'phy_gs.c' files are present in the following path '~\mqx\source\io\enet\phy' (Note: If for some reason GS driver files are not available, then you must copy latest GS driver files to above said location)

2. Open the project file '~\mqx\build\cw10\bsp_twrk60n512\.project' ==> In case of TWRK60N512 tower module '~\mqx\build\cw10\bsp_twrmcf52259\.project' ==> In case of TWRMCF52259 tower module
3. Click on 'Peripheral I/O Drivers' 4. Click on 'enet' 5. Add 'gs' driver files to 'bsp' project. You can add these files to bsp project by just drag and drop method. (i.e. drag the 'gs' directory to 'enet' folder in CodeWarrior IDE 'bsp' project and 'phy_gs.h' and 'phy_gs.c' files to 'phy' folder in CodeWarrior IDE 'bsp' project)

TM

55

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Steps to include GS driver files into project: 1. Open the project file '~\mqx\build\cw10\bsp_twrk60n512\.project' ==> In case of TWRK60N512 tower module '~\mqx\build\cw10\bsp_twrmcf52259\.project' ==> In case of TWRMCF52259 tower module 2. Right click on 'bsp' project and select 'properties' option 3. Click on 'C/C++ General' 4. Click on 'paths and Symbols' Select tab option 'includes' Now click on 'C Source File' and add following path '${MQX_ROOT_DIR}\mqx\source\io\enet\gs' Click on 'Apply' and 'OK'

TM

56

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

To enable GS Wi-Fi driver, in the bsp_twrk60n512 User_config.h file ensure that below # define is set
/*

GainSpan(GS) Wi-Fi Driver Support Enable*/


1

#define BSPCFG_ENABLE_GS

To compile the httpsrvr example demo:


Add

the gs_httpsrver project to the work space Then first compile the BSP, followed by PSP, RTCS, Shell and then the application (GS_httpsrv ) Ensure run/debug settings to point to the gs_httpsrv application so that the flash program utility picks the right file to download

TM

57

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

Documentation from Freescale website


IP2WiFi Application Programmers Guide

Lists the supported AT commands for IP2WiFi

GS WiFi Driver

Describes the driver architecture, details and example demo


Provides details on the TWR-WIFI-GS1011M module and the jumper setting Provides step by step instruction on how to enable GS driver and run demos

TWR User Manual

TWR Lab Manual

Documentation from GainSpan website

User can register and get access to the following documentation without NDA

Serial to WiFi (S2W) Application Programmers Guide

Lists the supported AT commands for Serial to Wi-Fi

GS1011M Data Sheet

Describes the details of the GainSpan modules

Additional details on GS1011 chip, the Embedded firmware can also be obtained under NDA with GainSpan

Session materials will be posted @ www.freescale.com/FTF


Look for announcements in the FTF Group on LinkedIn or follow Freescale on Twitter

TM

58

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, SMARTMOS, TurboLink, VortiQa and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.

TM

Você também pode gostar