Add Ethernet Wifi

59
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. 22 June 2011

Transcript of Add Ethernet Wifi

Page 1: Add Ethernet Wifi

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.

22 June 2011

Page 2: Add Ethernet Wifi

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.

2

Tweeting? Please use hashtag

#FTF2011

Freescale on FacebookTag yourself in photos

and upload your own!

• Introduction

• Session Objectives

• Network Concepts

• Freescale RTCS

− Initialization and Configuration

− Interface Initialization

− Socket API

− Application Layer Protocols

− HTTP Web Server

• Gainspan Wi-Fi

Page 3: Add Ethernet Wifi

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.

3

• 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

Page 4: Add Ethernet Wifi

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.

4

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

Page 5: Add Ethernet Wifi

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.

Page 6: Add Ethernet Wifi

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.

6

• 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

Page 7: Add Ethernet Wifi

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.

7

RPC

XDR Telnet HTTPFTP

POP3*SMTP*

DNS

SNMP

SNTP

SSL*

IP-E IPCP PAP CHAP CCP

PPPARP

Ethernet Serial PPPoE**

TFTP

SSH* XML*

BootP DHCP RIPSockets

ICMP TCP UDP IGMP

NAT** IP

HDLC

LCP

* – Optional third party package

** – On request

Page 8: Add Ethernet Wifi

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.

8

Application

Task

Application

Task

RTCS

MQX

Application

Task

Serial ADC I2C Enet

TCP/IP

Task

RTCS API

FTP

Server

ARP

ICMPTCP UDP IGMP

IP

IP-E

HTTP

ServerTelnet

Client

FTP

Client

Telnet

ServerSNMP

AgentDHCP

Server

SNTP

Client

Page 9: Add Ethernet Wifi

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.

9

999

Page 10: Add Ethernet Wifi

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.

Page 11: Add Ethernet Wifi

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.

11

• Create RTCS by calling RTCS_create()

• Initialize interface(s)

− Assign MAC addresses

• Bind RTCS to interface

− Assign IP address, subnet mask

• Initialize RTCS applications

RTCS

MQXEnet

RTCS

Apps

TCP/IP

Task

RTCS API

Page 12: Add Ethernet Wifi

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.

12

Page 13: Add Ethernet Wifi

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.

Page 14: Add Ethernet Wifi

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.

14

• 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

Page 15: Add Ethernet Wifi

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.

15

getsockopt()

Unbound

Bound to

datagram

(UDP)

Bound to

stream

(TCP)

select() setsockopt() shutdown ()

socket()

sendto()

recvfrom()

bind() listen()

accept()connect()

send() recv()

Page 16: Add Ethernet Wifi

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.

16

Page 17: Add Ethernet Wifi

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.

Page 18: Add Ethernet Wifi

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.

18

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

• 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

value = 256;

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

Page 19: Add Ethernet Wifi

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.

19

• 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

Page 20: Add Ethernet Wifi

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.

20

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

Page 21: Add Ethernet Wifi

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.

Page 22: Add Ethernet Wifi

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.

22

RTCS

MQX

TCP/IP Task

RTCS API

FTP

Server

HTTP

Server

Telnet

Client

FTP

Client

Telnet

Server

SNMP

Agent

DHCP

Server

SNTP

Client

TFTP

Server

TFTP

Client

DHCP

Client

DNS

Resolver

IPCFG

Page 23: Add Ethernet Wifi

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.

Page 24: Add Ethernet Wifi

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.

24

• 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

Page 25: Add Ethernet Wifi

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.

25

HTTP

Server

MFSTFS

USB

CF

SD

etc

MQX I/O Subsystem

Others

HTTP

ClientCGI Table

CGI

CGI

FN Table

fn

fn

Page 26: Add Ethernet Wifi

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.

26

• Include tfs.h, httpd.h and httpd_types.h

• Declare CGI and Function callback tables, if required

Page 27: Add Ethernet Wifi

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.

27

• Install Filesystem

• Initialize HTTP server, specify root directory and home page

• Register CGI table and function callback table, if required

• Start server

Page 28: Add Ethernet Wifi

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.

28

• The Redpine Wi‐Fi Tower Module (TWR‐WIFI‐RS2101) is a low‐cost evaluation, demonstration and development board that features an 802.11n solution from Redpine Signals

• Features RS9110‐N‐11‐21 Wi‐Fi module:

− Compliant to 802.11b/g and single stream 802.11n

− Supports all Wi‐Fi 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 low‐frequency clock

− Ultra low power operation with power save modes

− Single supply 3.1 to 3.6V operation

Page 29: Add Ethernet Wifi

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.

29

Page 30: Add Ethernet Wifi

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.

30

• The RS9110‐N‐11‐21 module from Redpine's Connect‐io‐n™

family of products is a complete IEEE® 802.11b/g/n Wi‐Fi 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 self‐contained 802.11n WLAN solution for

a variety of applications. No WLAN driver functionality is required

on the host processor

• For the TWR‐WIFI‐RS2101 Tower Peripheral Module, the

RS9110‐N‐11‐21 module communicates with the MCU through

an SPI

Page 31: Add Ethernet Wifi

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.

31

Page 32: Add Ethernet Wifi

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.

32

• Demos:

− Telnet server

− Web server

− SNTP*

− SMTP with sockets*

− DNS resolution*

− DHCP client*

− Digital sign**

• RTCS User’s Guide

*MCF51CN demos only ** MPC5125 demo only

Page 33: Add Ethernet Wifi

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.

Page 34: Add Ethernet Wifi

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.

34

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

− Coldfire and Kinetis Support

• 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

Secondary Connector

Connector For External

Antenna (optional)

GS1011MIP Wi-

Fi Module

Power Connector

(Optional)

Program

Switch

RS232 DB9

Connector for

Programming

Module

Primary

Connector

Page 35: Add Ethernet Wifi

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.

35

Cold Fire or Kinetis

MCU

(SPI Master)

TWR BRD

GS1011M

TWR

Module

(SPI Slave)

QSPI_DOUTSSPI_DIN

QSPI_DIN SSPI_DOUT

QSPI_CS0 SSPI_CS

QSPI_CLK SSPI_CLK

GS_SPI_HOST_WAKEUP GPIO 28

3.3V

LEDs

RS232

Antenna

UART

Debug or Programming Port

• GainSpan Wi‐Fi Tower Module (TWR‐WIFI‐GS1011M)

− Low‐cost, ultra low power evaluation board

− Featuring the GainSpan GS1011M module Family

Page 36: Add Ethernet Wifi

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.

36

Page 37: Add Ethernet Wifi

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.

37

FeaturesLow Power

(GS1011MI)

Extended Range

(GS1011ME)

802.11b/g/n

(GS1500M)

Size 0.9 in X 1.28 in 0.9 in X 1.45 in 0.9 in X 1.45 in

No. of Pins 48 48 48

Layers 4-layer, single sided 4-layer, single sided 4-layer, single sided

RF Output (Typical) 8dBm (internal PA) 18dBm (external PA) 18dBm (internal PA)

Antenna Options Trace or Ext Antenna (u.FL) Trace or Ext Antenna (u.FL) Trace or Ext Antenna (u.FL)

I/O SPI, UART, I2C, GPIO, A/D, PWM SPI, UART, I2C, GPIO, A/D, PWM SPI, UART, I2C, GPIO, A/D, PWM

Certifications FCC, ETSI, IC, Japan, Wi-Fi FCC, ETSI, IC, Japan, Wi-Fi FCC, ETSI, IC, Japan, Wi-Fi

Firmware Options Serial to Wi-Fi, IP to Wi-Fi, SoC SDK Serial to Wi-Fi, IP to Wi-Fi, SoC SDK Serial to Wi-Fi, IP to Wi-Fi, SoC SDK

Data and Control

Protocols

Raw frames, UDP, TCP/IP, AT, XML Raw frames, UDP, TCP/IP, AT, XML Raw frames, UDP, TCP/IP, AT, XML

Host Connection UART, SPI UART, SPI UART, SPI

• Solder down module family

• Three types that are pin compatible

− Low Power (Internal PA)

− Extended Range (External PA)

− 802.11b/g/n

GS1500M

• June’11 Samples

• Q3’11 certification and

production release

Page 38: Add Ethernet Wifi

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.

38

− 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

Page 39: Add Ethernet Wifi

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.

39

− 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

Page 40: Add Ethernet Wifi

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.

40

Wi-Fi Chip

Host

API Interface

Wi-Fi Services

Kernel/RTOS

MAC, I/O Drivers

32bit CPU Applications

Network Services

Network Stack

Wi-Fi Services

Device Driver

Traditional Wi-Fi GainSpan Embedded Wi-Fi

GS1011

Host

GS1011

Host

API Interface

Wi-Fi Services

Kernel

MAC, I/O Drivers

32/16bit MCU Applications

Network Services

Network Stack

Device Driver

IP to Wi-Fi

API Interface

Wi-Fi Services

Kernel

MAC, I/O Drivers

Serial to Wi-Fi

Serial to Wi-Fi

Network Services

Network Stack

Device Drivers

RTOS

400+MHz ARM11

WinCE, Linux…

Networking and

High Level Wi-Fi

Software

(WPS, Security…)

Low Level Wi-Fi

Firmware

8/16bit MCU Applications

Command Driver

All Wi-Fi related firmware

(WPS, Security…)

IP to Wi-Fi

Wi-Fi Services

Device Drivers

RTOS

Page 41: Add Ethernet Wifi

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.

41

802.11

Frame

WP

A/2

Se

cu

rity

Device Data

& Commands

Remote

Support

Remote

Diagnostics

Mobile

Monitoring

and Control

Data

Management

Inte

rne

tH

om

e

Se

ria

l to

Wi-

Fi

IP t

o W

i-F

i

Host MicrocontrollerGainSpan Wi-Fi Module

HTTP/

TCP

“Pipe”

TCP

“Pipe”

UDP

“Pipe”

SS

L

IP

AT

Co

mm

an

ds

AT

Co

mm

an

ds

No TCP/UDP/IP Stack

TCP/UDP/IP Stack

Wi-Fi Configuration

FW Update - OTA

Wi-Fi Configuration

FW Update - OTA

For More details go to www.gainspan.com

Page 42: Add Ethernet Wifi

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.

42

MQX

Application

HTTP FTP Other Applications

Socket Interface

Freescale Real Time TCP/IP Communication Suite (RTCS)

TCP UDP DHCP ARP ICMP

GS1011 WiFi Driver

Freescle MQX QSPI/DSPI/TTY HAL

Host Interface layer

802.11 b/g Mac/Phy

Data Processing EngineStation Management Entity

WPA-WPA2

GainSpan

GS1011M

Freescale

MCU

Cold Fire

Or

Kinetis

Page 43: Add Ethernet Wifi

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.

43

GS1011M Device Driver

Serial Input Task: gs_serial_task

gs_init.c

Command

ResponseReceive Data

Command

SendSend Data

SPI Handler Task: gs_spi_hlr_task

gs_util.cRead API Write API

Page 44: Add Ethernet Wifi

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.

44

• 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>

Page 45: Add Ethernet Wifi

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.

45

• 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 wake-up 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, that’s 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

Page 46: Add Ethernet Wifi

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.

46

• 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.

Page 47: Add Ethernet Wifi

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.

47

• 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.

Page 48: Add Ethernet Wifi

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.

48

• 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.

Page 49: Add Ethernet Wifi

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.

49

• 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 driver’s 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.

Page 50: Add Ethernet Wifi

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.

50

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

Page 51: Add Ethernet Wifi

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.

51

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

Page 52: Add Ethernet Wifi

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.

52

• #ifndef BSPCFG_ENABLE_GS

• #define BSPCFG_ENABLE_GS 0 /* If GS driver module is NOT enabled */

• #endif

• #if BSPCFG_ENABLE_GS

• #define BSP_GS_UART_DEVICE "ittye:" /* GainSpan UART channel configuration */

• #define BSP_GS_SPI_DEVICE "spi2:" /* GainSpan SPI channel */

• #define BSP_GS_GPIO_DEVICE "gpio:input" /* GPIO pin as input*/

• /* GPIO pins configuration PORT A pin#27 */

• #define BSP_GS_GPIO_INT_PIN (GPIO_PORT_A|GPIO_PIN_IRQ_RISING|GPIO_PIN27)

• #ifndef BSPCFG_GS_PCB

• #define BSPCFG_GS_PCB 16 /* PCB count for GS driver module */

• #endif

• #endif

− Existing Macro’s modified:

• /* ENET device count added for GS driver */

• #define BSP_ENET_DEVICE_COUNT (MACNET_DEVICE_COUNT+ (BSPCFG_ENABLE_GS?1:0))

• File Name: user_config.h

− Newly added Macro list:

• #define BSPCFG_ENABLE_GS 1 /* New macro defined to enable GS driver */

− Modified Macro list:

• #define BSPCFG_ENABLE_ITTYE 1 /* serial interface to GS1011 SOC */

• #define BSPCFG_ENABLE_TTYF 0 /* Not used in case of GS1011 SOC interface */

• #define BSPCFG_ENABLE_SPI2 1 /* SPI interface to GS1011 SOC */

• #define BSPCFG_ENABLE_FLASHX 1

Page 53: Add Ethernet Wifi

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.

53

• 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)

Page 54: Add Ethernet Wifi

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.

54

• 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);

Page 55: Add Ethernet Wifi

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.

55

• 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' projectand 'phy_gs.h' and 'phy_gs.c' files to 'phy' folder in CodeWarrior IDE 'bsp' project)

Page 56: Add Ethernet Wifi

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.

56

• 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'

Page 57: Add Ethernet Wifi

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.

57

• 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*/

#define BSPCFG_ENABLE_GS 1

• 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

Page 58: Add Ethernet Wifi

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.

58

Session materials will be posted @

www.freescale.com/FTFLook for announcements in the FTF Group

on LinkedIn or follow Freescale on Twitter

• 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

− TWR User Manual

Provides details on the TWR-WIFI-GS1011M module and the jumper setting

− TWR Lab Manual

Provides step by step instruction on how to enable GS driver and run demos

• 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

Page 59: Add Ethernet Wifi

TM