WiFi-Adaptor™ Technical Manual

WiFi-Adaptor™
Low cost serial to Wi-Fi interface for TERN controllers
Technical Manual
1950 5th Street, Davis, CA 95616, USA
Tel: 530-758-0180
Fax: 530-758-0181
Email: sales@tern.com
http://www.tern.com
COPYRIGHT
WiFi-Adaptor, TDU, A-Engine and ACTF are trademarks of TERN, Inc.
Am186ES is a trademark of Advanced Micro Devices, Inc.
XBee® and XBee-PRO® are registered trademarks of Digi, Inc.
Paradigm C/C++ is a trademark of Paradigm Systems.
Microsoft, Windows, Windows98/2000/ME/NT/XP are trademarks of Microsoft
Corporation.
IBM is a trademark of International Business Machines Corporation.
Version 1.02
July 12, 2012
No part of this document may be copied or reproduced in any form or by any means
without the prior written consent of TERN, Inc.
© 1993-2012
1950 5th Street, Davis, CA 95616, USA
Tel: 530-758-0180 Fax: 530-758-0181
Email: sales@tern.com
http://www.tern.com
Important Notice
TERN is developing complex, high technology integration systems. These systems are
integrated with software and hardware that are not 100% defect free. TERN products are
not designed, intended, authorized, or warranted to be suitable for use in life-support
applications, devices, or systems, or in other critical applications. TERN and the Buyer
agree that TERN will not be liable for incidental or consequential damages arising from
the use of TERN products. It is the Buyer's responsibility to protect life and property
against incidental failure.
TERN reserves the right to make changes and improvements to its products without
providing notice.
WiFi-Adaptor™
Chapter 1: Introduction
Chapter 1: Introduction
1.1 Functional Description
The WiFi-Adaptor™ is designed to provide a serial to Wi-Fi (802.11b) wireless networking solution for TERN
controllers. The WiFi-Adaptor™ incorporates a WiFi210 wireless network module from WizNet. It can be driven by
an RS232 serial port or a TTL UART at 115,200 baud. Data and configuration communication is supported by
simple AT commands. Compatible TERN controllers include AE, EE, RE, TDU, 586E, or any TERN board with a
TTL or RS232 UART.
Features:
* Provide WiFi (802.11b) ability to a TERN controller
* Convert WiFi to RS232 or TTL UART
* Operate a TERN controller with iPad or iPhone
* 2.03 x 1.21 inches, 135 mA at 5V DC power
WiFi-232
TM
TM
WiFi210
Wi-Fi Module
TERN
Controller
RS232
RS232-UART
RS232
Driver
J1
U3
WiFi-TTL
TERN
Controller
TTL-UART
TM
TTL-UART
Interface
TTL-UART
J2
Figure 1.1 WiFi-AdaptorTM Functional Diagram
1-1
WiFi-Adaptor™
Chapter 1: Introduction
Physical Description
TM
Below shows the physical layout of the WiFi-Adaptor .
WiFi210
Wi-Fi Module
RS232 Driver
U.FL Antenna
Connection
J1 RS232
Header
Figure 1.2 WiFi-232
TM
J2 TTL
Header
WiFi210
Wi-Fi Module
U.FL Antenna
Connection
TM
Figure 1.3 WiFi-TTL
1-2
WiFi-Adaptor™
Chapter 1: Introduction
Figure 1.4 WiFi-232
TM
+ TDU
Figure 1.5 WiFi-232
TM
+ BE + VE232
1-3
WiFi-Adaptor™
Chapter 1: Introduction
Figure 1.6 WiFi-232TM + BE + VE232 + D32
1-4
WiFi-Adaptor™
Chapter 1: Introduction
TM
Figure 1.7 WiFi-TTL
+ BE
1-5
WiFi-Adaptor™
Chapter 2: Installation
Chapter 2: Installation
2.1 Software Installation
Please refer to the “software_kit.pdf” technical manual on the
tern_docs\manual\software_kit.pdf, for information on installing software.
TERN
installation
CD,
under
2.2 Hardware installation
The WiFi-AdaptorTM can be connected to a TERN controller directly via a 10-pin ribbon connector. WiFi-232TM
versions will connect to the RS232 port of the TERN controller. WiFi-TTLTM versions will connect to the TTL
UART pins of the TERN controller.
Note: The WiFi-AdaptorTM is powered by 5V from the TERN controller. Additional wiring may
be required to route 5V to VIN pin-1 on J1 or J2 on the WiFi-AdapptorTM.
Figure 2.1 WiFi-232
TM
connected to B-Engine + VE232
2-1
WiFi-Adaptor™
Chapter 2: Installation
VE232 H1 pin 2 = VCC
wired to
VE232 J3 pin 1 = VIN on
TM
WiFi-Adaptor
Figure 2.2 WiFi-232
TM
5V = VIN Power Connection
2-2
WiFi-Adaptor™
Chapter 2: Installation
TM
Figure 2.3 WiFi-TTL
connected to B-Engine at header J2
2-3
WiFi-Adaptor™
Chapter 3: Hardware
Chapter 3: Hardware
3.1 Introduction
The WiFi-Adaptor™ is designed to provide a WiFi solution for TERN controllers. The WiFi-Adaptor™ supports a
WizFi210 wireless module from WizNet. It can be driven by an RS232 serial port or a TTL (5V or 3.3V) UART at
115200 baud. Compatible TERN controllers include AE, EE, RE, i386E, 586E, or any TERN board with a TTLUART or an RS232 UART.
3.2 WizFi210 Features
The WizFi210 is a fully certified module that offers a quick, easy, and cost effective way to add Wi-Fi capabilities
to TERN controller products. The module provides a serial UART interface which enables connection to any of
TERN’s controllers. The WizFi210 is an ideal solution for organizations with limited or no Wi-Fi or RF expertise,
as it not only dramatically reduces RF design time but also removes the burden of testing and certification; allowing
customers to focus on their core application, product, or expertise. The module supports data rates up to 11 Mbps,
and is compliant with 802.11b.
Features:
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Brings Wi-Fi connectivity to any device with a microcontroller and serial HOST interface (UART)
Minimal Serial to Wi-Fi “driver” footprint on host microcontroller and minor changes to existing host
MCU firmware
Offloading of smaller host microcontrollers from the Wi-Fi and TCP/ IP networking
Simple AT commands for configuration and data communication
DHCP/Static IP, TCP/UDP, Server/Client, DNS
Reduces development time, testing and certification burden, accelerating time to market
Easy device provisioning through our utility or Wi-Fi Protected Set-up (WPS)
Ultra low power consumption through dynamic power management
Operates with standard 802.11 b/g/n access points at speed up to 11 Mbps (802.11b)
802.11i Security (WEP, WPA, WPA2-PSK, Enterprise)
Rich I/O interfaces (SPI, UART, GTTL, I2C, ADC, JTAG)
Low power modes, Alarm Input for wake-up
High-throughput hardware AES and RC4 encryption/decryption engines
Limited AP Feature (Direct Connection to iPhone, iPad and Android-Phone without AP)
3-1
WiFi-Adaptor™
Chapter 3: Hardware
3.3 Wireless Interface
TERN controllers can interface the WiFi-Adaptor™ either directly via TTL-UART with the WiFi-TTL™ or over
an RS232 serial cable with the WiFi-RS232™
WiFi-232™
The WiFi-232™ version of the WiFi-Adaptor™ connects using an onboard RS232 converter. The controller
communicates with the WiFi-232™ module over RS232.
WiFi-232
TM
WizFi210TM
Wireless Module
RS232-UART
TX-RS232
TERN
Controller
RS232
Header
TXD
J1
RX-RS232
Figure 3.1 WiFi-232
RS232
Converter
RXD
UART
Interface
TM
WiFi-TTL™
The WiFi-TTL™ version of the WiFi-Adaptor™ connects directly to the UART on the WizFi210 module. The
controller communicates with the WiFi-TTL™ module over a 0-5V or 0-3.3V UART connection.
WiFi-TTL
TM
WizFi210TM
Wireless Module
TX-TTL
TERN
Controller
J2 Header
TXD
J2
RX-TTL
RXD
UART
Interface
Figure 3.2 WiFi-TTLTM
3.4 Power Supply
The WiFi-Adaptor™ has an on-board 3.3V linear regulator by default. The linear regulator requires 5VDC input at
pin VIN, J1 pin 1 or J2 pin 1.
3-2
WiFi-Adaptor™
Chapter 4: Software
Chapter 4: Software
4.1 Introduction
The WizFi210 chip is controlled by series of AT commands**. All of the Wi-Fi overhead is managed by the
module and transparent to the user. The commands are used to set up the mode of the module and communicate
data. The module can be configured to communicate with an existing wireless network or can act as a limited
access point and allow devices to connect to it.
Sample programs/projects for the WiFi-AdaptorTM can be found in the following directories depending on your
controller:
c:\tern\186\samples\wifi
c:\tern\386\samples\wifi
c:\tern\586\samples\wifi
** See WizFi210
User Manual for AT command reference
4.2 Wi-Fi Wireless Network
In a typical Wi-Fi network setting, the WiFi-AdaptorTM logs into a wireless router. The WiFi-AdaptorTM can either
use a static IP address or request an IP address from the wireless router. Once it has an IP address, the module can
create a TCP server socket, which listens for incoming TCP requests, or a TCP client socket that establishes a
connection to a TCP server. The figure below illustrates a Wi-Fi network with multiple WiFi-AdaptorsTM configured
as TCP clients connecting to a WiFi-AdaptorTM configured as a TCP server.
Wi-Fi Network
TCP Server
TCP Clients
Figure 4.1 Standard Wi-Fi Network
4-1
WiFi-Adaptor™
Chapter 4: Software
TCP Server
The following AT commands establish WiFi-AdaptorTM as a TCP server at port 5000
// Connect to TERNTEST
AT
AT+WWPA=terntest
//
AT+NDHCP=1
//
AT+WA=TernTest,,0 //
WIFI network, password “TernTest”
wifi network password
enable dchp for dynamic ip address
wifi network name (ssid)
//After connected to WIFI network, set as TCP Server
"AT+NSTCP=5000"
// Start a TCP server listening on port 5000
Figure 4.2 TCP Server Sample wifi_server.c
Sample program wifi_server.c in the WiFi sample directory demonstrates creating a TCP server. Watch the
following variables: wifi_data, wifi_ip, connect_ID[0], and connect_ID[1].
4-2
WiFi-Adaptor™
Chapter 4: Software
TCP Client
The following AT commands establish WiFi-AdaptorTM as a TCP client:
// Connect to TERNTEST
AT
AT+WWPA=terntest
//
AT+NDHCP=1
//
AT+WA=TernTest,,0 //
WIFI network, password “TernTest”
wifi network pasword
enable dchp for dynamic ip address
wifi network name (ssid)
//After connected to WIFI network, create client socket
"AT+NCTCP=192.168.1.145,5000"
// TCP client connection to 192.168.1.145 port: 5000
Auto Connection
Auto connection mode acts as a cable replacement insofar that the interface acts like a serial interface and no
commands or user intervention are required for connection management. In this mode, the WiFi-AdaptorTM transfers
data transparently between the Host and Target in data mode. No status information is sent to the controller.
Auto Server Connection
AT+WWPA=terntest
AT+NDHCP=1
AT+WAUTO=0,TernTest,,0
AT+NAUTO=1,1,,5001
ATA
//
//
//
//
//
wifi network password
enable dchp for dynamic ip address
wifi network name (ssid)
TCP server, listen on port: 5001
start server auto connection
Auto Client Connection
AT+WWPA=terntest
AT+NDHCP=1
AT+WAUTO=0,TernTest,,0
AT+NAUTO=0,1,192.168.1.225,5042
ATA
//
//
//
//
//
wifi network password
enable dchp for dynamic ip address
wifi network name (ssid)
TCP client connection to 192.168.1.225 port: 5042
start client auto connection
4-3
WiFi-Adaptor™
Chapter 4: Software
4.3 Wi-Fi Limited Access Point
The WiFi-AdaptorTM can also act as an access point for other wireless devices such as iPhones, iPads and Android
Smart Phones. As an access point, devices can log into the WiFi-AdaptorTM and communicate with it. It is
considered “limited” because the WizFi210 can only manage a few connections at a time. Once a device is
connected, telnet software or specifically designed software can communicate with the TERN controller via TCP/IP.
Limited Access Point
Wi-Fi
Access Point
Figure 4.3 Limited Access Point
The following commands establish a limited access point named LimitedAP
// Create limited access point “LimitedAP”
AT+WM=2
// operating mode 2 = limited AP
AT+WAUTH=1
// authentication = open
AT+WWEP1=1234567890
// wep key = 1234567890
AT+NDHCP=0
// disable dhcp
AT+NSET=192.168.55.1,255.255.255.0,192.168.55.1 //static ip address, mask and gateway
AT+WA=LimitedAP,,8
// set network name = LimitedAP, channel = 8
AT+DHCPSRVR=1
// enable dhcp server to assign ip addresses
AT+NAUTO=1,1,,5000
// enable auto connect as tcp server, port 5000
ATA2
// start auto connect
See sample program “s1_ipad.c” in the WiFi sample directory.
4-4
VIN
/RXD
/TXD
GND
3.3V MAX3232
U3
1 C1+ VCC
2 V+ GND
3 C1- T1O
4
C2+ R1I
5 C2- R1O
6 V- T1I
7 T2O T2I
8 R2I R2O
J1 HDRD10
2
4 /RTS
6 /CTS
8
10
1
3
5
7
9
C1+
V+
C1C2+
C2V/TXD
/RXD
G1
C1+
16
15
14
13
12
11
10
9
MAX232D
MAX232D
V33
GND
/RTS
/CTS
CTS
RTS
TXD
RXD
C1-
C5
CAPNP
VIN
RXDH
TXDH
GND
1
3
5
7
9
J2 HDRD10
2
4 RTSH
6 CTSH
8
10
R2
RXDH
RXD
C2
CAPNP
RN1
10
9
8
7
6
5
4
3
2
1
C2+
C2-
C3
CAPNP
V+
GND
C6
CAPNP
V-
C7
CAPNP
V33
R1
LED
2K
1K
2K
COM/D
ALM1
P/RUN
/RST
L_AP
INSTALL R5 FOR 5V PIO
U1
R4
R5
TXD
G2
P28L
1
3
5
7
9
P28
WIFI ASSOCIATE
LED
RESV
G3
P30L
RN10S1
RN10S1
INSTALL R2 FOR 5V PIO
TXDH
LED
RESV
L_AP
P28L
P30L
P31L
COM/D
ALM1
P/RUN
/RST
LED
V33
J3 HDRD10
2
4
6
8
10 GND
P30
UART-RXD
LED
RESV
G4
P31L
P31
UART-WIFI
LED
RESV
1K
R6
R7
RTSH
RTS
2K
1K
INSTALL R7 FOR 5V PIO
R8
R9
CTSH
2K
CTS
1K
INSTALL R9 FOR 5V PIO
D1
VIN
+5V
U2
1N5817
C1
10UF35V
ALCAP2
GND
V33
+5V
1
2
3
GNG
4 V33
VOVO
VI
C4
BB1117
10UF35V
ALCAP2
1
2
3
4
5
6
ALM1 7
8
V33 9
10
11
12
13
14
15
16
V18
17
GND 18
C8
CAPNP
GND
WIZFI210
E_ANT
GND
GND
J_TCK WIFI210 P28
J_TDO
P29
J_TDI
P30
J_TMS
P31
J_NTRST
P24
ALARM1
P0
RTC_O
P25
VBAT
P1
DC_CNTL
P2
ALARM2
P3
ADC1
WIFI210 P27
ADC2
P26
P6
EX_RST
P7
SVDDIO
P5
EN_V18
PS
S I P SV33
V18
_IP
GNDP P P P P P
I C _ IGND
P1P1 122P_ LC_
4390 9018O KSI
49
48
47
46
45
44
43
42
41
40
39
38
37
36
35
34
33
32
31
GND
P28
COM/D
P30
P31
CTS
RXD
RTS
TXD
P/RUN
/RST
V33
GND
C9
CAPNP
1222 22222 223
9012 34567 890
L_AP
TERN
Title
WIZFI210, RS232
Size Document Number
B
WIFI.SCH
Date:
May 29, 2012 Sheet
REV
1 of
1