Electronics123 UART2WF User Manual

www.linksprite.com
1 / 50
LS-UART-WiFi Module User Manual
May 2010
)PIGXVSRMGWGSQ-RG
[[[IPIGXVSRMGWGSQ
www.linksprite.com
2 / 50
TABLE OF CONTENTS
1.OVERVIEW........................................................................................................................................4
1.1. Main Function ...................................................................................................................4
1.1.1. Summary ....... ....... ....... ...................................................................................4
1.1.2. Specifications . ....... ....... ....... ....... ....... ..........................................................4
1.2. Typical Applications...........................................................................................................4
1.2.1. Wireless POS Machine......................................................................................5
1.2.2. Wirelsee Monitoring and Control System...........................................................5
2. FUNCITON DESCRIPTION .............................................................................................................6
2.1. Block Diagram...................................................................................................................6
2.2. Parameter management ...................................................................................................6
2.3. Connection Model .................................................................................................... ........7
2.3.1. Automatic Connection........................................................................................7
2.3.2. Manual Connection ...........................................................................................9
2.4. Encryption.........................................................................................................................9
2.5. Data transmission.............................................................................................................9
2.5.1. RAW format .....................................................................................................10
2.5.2. UDP format .....................................................................................................10
2.5.3. TCP format.......................................................................................................13
3. TESTING GUIDE ……………........................................................................................................14
3.1. Summary .......................................................................................................................14
3.2. Client Software...............................................................................................................15
3.3. Server Software...............................................................................................................16
3.4. Parameter management .................................................................................................17
3.4.1. Parameter query/edit .......................................................................................17
3.4.2. Parameter Explanation ...................................................................................18
3.5. Automatic networking.....................................................................................................20
3.6. Manual networking .........................................................................................................21
3.7. TCP Monitor Mode Test..................................................................................................23
3.8. Text Transfer Test...........................................................................................................24
3.9. Document Trabsfer Test .................................................................................................26
3.10. The Answers of Familiar Questions .............................................................................27
4. SERIAL PROTOCOL......................................................................................................................30
4.1. Summary ........................................................................................................................30
4.2. UART serial protocol ......................................................................................................30
4.2.1. Data Format.....................................................................................................30
4.2.2. Transfer Mechanism........................................................................................31
4.2.3. Serial Configuration..........................................................................................32
4.3. User Serial Control Protocol ...........................................................................................33
4.3.1. Data Format.....................................................................................................33
4.3.2. Order of Starting to Scan Network...................................................................34
4.3.3. Message of Scanning Network Result.............................................................34
4.3.4. Order of Starting to Connect to Network ........................................................35
4.3.5. Message of Network Connected ....................................................................35
4.3.6. Order of Starting to Disconnect Network........................................................36
4.3.7. Message of Network Disconnected................................................................36
4.3.8. Setting Parameter Order ................................................................................36
4.3.9. Message of Setting Parameter Result.............................................................38
4.3.10. Inquiring Parameter Order ............................................................................38
4.3.11. Message of Inquiring Result..........................................................................38
www.linksprite.com
3 / 50
4.3.12. Reset Order...............................................................................................39
4.3.13. Message of Finished Initialization .............................................................39
4.3.14. TCP Connection order................................................................................40
4.3.15. Message of TCP connection Status ..........................................................40
4.3.16. Message of TCP Failed Sending ...............................................................40
4.4. Configuration parameters............................................................................................41
4.4.1. System parameters .....................................................................................41
4.4.2. Network parameters ....................................................................................41
4.5. Programming Guide ...................................................................................................43
4.5.1. The Example of Network Control.................................................................43
4.5.2. The Example of Parameters Setting ...........................................................45
4.5.3. The example of sending data.......................................................................45
4.5.4. CRC-8 Algorithm Reference Implementation...............................................46
4.6. Serial Protocol Modification Notes…...........................................................................47
www.linksprite.com
4 / 50
1. Overview
LS-UART-WiFi is a WLAN Module with UART serial interface by LinkSprite (www.linksprite.com).
1.1. Main Functions
1.1.1 Summary
SOC chip based solution: cost-effective high quality and stable, built-in WiFi protocol stack and serial transfer protocol;
Simple interface: 5V, ground, RX, TX four-wire connection;
Small dimension 22 * 60 * 7 mm;
Simple and efficient serial user interface, easy for development.
Can be easily driven by 8,16, 32-bit microcontroller such as MSC51/PIC/ARM7.
Simple programming.
1.1.2 Specifications
Support UART data interface, baud rate: 19.2k / 38.4k / 57.6k / 115.2k bps;
Support 802.11b wireless data rate up to 11Mbps;
Support Integrated 802.11 MAC protocol functions;
Support STA applications in basic networks;
Support OPEN / WEP authentication method;
Support shared key encryption method wep64/wep128 data transmission;
Support automatic networking mode and manual networking mode.
o In the automatic mode, the module can automatically scan the target network, and can
automatically reconnect when disconnected
o In manual mode, user can control to connect or disconnect flexibly;
Support RAW / UDP / TCP format of network data transmission;
Support 7 groups of basic parameter settings, can connect up to seven target networks;
Support parameter configuration through the user interface;
Support online firmware upgrade
Support external antenna, UFL interface. Maximum transmission power is 100mW, and receiving
sensitivity is -90dBm;
1.2. Typical Applications
1.2.1. Wireless POS Machine
In a Wireless Bus System using WLAN techniques, terminals can be car held or hand held. When buses reach the terminal, wireless POS machine detects the identification automatically, and then connects to the AP. Operational Data in POS machine is uploaded to the Data Center Server in Bus terminal through AP.
3YV9%68;*MWE;0%21SHYPI[MXL9%68WIVMEPMRXIVJEGI
www.linksprite.com
5 / 50
1.2.2. Wireless Monitoring and Control System
Serial device networking through TCP/IP has been popular for industrial networking. However, with wired communication, deployment of new wires and the following construction often become a bottleneck. In contrast, WLAN can be embedded in the monitoring and control terminals, therefore, reduces the wire deployment and construction cost. Furthermore, it can be easily modified to meet the requirements of the Industrial Environment and Factory Automation Systems, and on-site monitoring system etc.
www.linksprite.com
6 / 50
2.
Function Descriptions
2.1. Block Diagram
www.linksprite.com
7 / 50
www.linksprite.com
8 / 50
2.2.
Parameter management
WLAN module provides for user parameters reconfiguration. These parameters are used to control the module operation. Parameters are divided into two types: system parameters and network parameters.
System Parameters
These parameters are used to control the working mode of the module, it include: Networking Mode: WLAN module supports two modes: automatic networking and manual
networking.
Transparent Transmission Mode: WLAN module supports transparent transmission mode
in the serial port. It is worth noting that this mode is valid only when the module is in automatic networking mode AND it uses the UDP protocol in Link Layer.
TCP Monitoring Mode: WLAN module supports the use of TCP listening mode when TCP
protocol is used in Link Layer. After this mode is selected, the WLAN module can be used as a TCP server, waiting for client’s connection requests.
Baud Rate of Serial Port: LAN module supports four baud rates:192003840057600
115200 bps.
Device Physical Address: It’s the MAC address of WLAN module.
Network Parameters
These are the parameters that need to be set to connect to the target network. This module supports up to seven target networks, and users can set seven groups of network parameters. Each group of network parameter includes:
BSSID: The BSSID of target networkIts value is the MAC address of the AP used in target
network. Each AP owns their unique and non-repeated MAC address. The module uses this BSSID to identify a different network.
Channel: It specifies the channel of the target network. This module supports Channel 1-14.  SSID: It specifies the SSID of the target network.  Encryption Type: It defines the encryption method used in the target network. The
encryption methods that this module supports include Non-encrypted, WEP, CCMP, and WPI.
Key: It defines the key used by the target network. According to different method of
encryption, key is in different format.
Data format of the Link Layer: This module supports three data formats: RAW, UDP, TCP.  Physical Address of the Server: It defines the MAC address of the Data Center Server
(only used in RAW format).
IP Address of the Device: It defines the WLAN module’s own IP address (only used in
UDP/TCP format).
IP Address of the Server: It defines the IP address of the Data Center Server (only used in
UDP/TCP format).
Service Port: It defines the server port number (only used in UDP/TCP format).
www.linksprite.com
9 / 50
2.3.
Connection Mode
WLAN module supports two connection modes: automatic mode and manual mode for users to choose from. It needs to be noted that in the 1.3 and older versions, when the WLAN module is set to TCP Link Layer format, the process of connection automatically includes the process of connection with the TCP server.
2.3.1. Automatic Connection
In automatic connection mode, without any user intervention, WLAN module automatically scans and connects to the network after the power-on reset.
If one of the following situations occurs, WLAN module will automatically re-connect:
1Connection fails; 2connection is disconnected 3The target network is rescanned; 4Server disconnects the TCP connection when TCP Data format is used.
If one of the following situations occurs, WLAN module will automatically scan:
1The AP of the target network is off. 2WLAN module leaves the signal coverage area of the AP.
Its work procedure is as follows.
www.linksprite.com
10 / 50
In the automatic mode, all connection process is automatically completed by WAN module without any user intervention. This makes it very easy to use for users. To successfully connect the network, users only need to set at least one group of basic parameters in the first use. Then WLAN module will automatically scan the network after each power-on reset. If the target network is detected, connection will be connected automatically, and user will receive a confirmation message after successful connection. After that, user can send data normally. If the connection is disconnected accidentally in the process, the module can do automatic reconnection. In the case that the AP in the network is off or WLAN module leaves the signal coverage area of the network, WLAN module starts automatic scan until an available net work is found. This module supports at most seven target networks at the same time. When there are more than one target networks in the area, WLAN module may connect automatically to the first available network.
2.3.2. Manual Connection
www.linksprite.com
11 / 50
In the manual connection mode, users need to control connection and disconnection of WLAN module through user command.
2.4.
Encryption
WLAN module supports three encryption modes: WEP, WPI, and CCMP, and the non encrypted OPEN mode.
WEP
In the WEP encryption mode, user can set 4 sets of key, and choose one set as default key. The length of the key can be 64 bit or 128 bit.
64 bit key: In addition to the 24 random bits, user needs to set the rest 40 bits, or 5 bytes.
128bit key: In addition to the 24 random bits, use needs to set the rest 104 bits, or 13 bytes.
WPI In the encryption mode of WPI, user needs to set 32-byte key. Broadcast is achieved from AP automatically. This encryption mode must be used with the AP designed by LinkSprite.
CCMP In the encryption mode of WPI, user needs to set 16-byte key. Broadcast is achieved from AP
automatically. This encryption mode must be used with the AP designed by LinkSprite.
2.5. Data transmission
In a connection, WLAN module automatically transmits the payload data that it receives between the user’s serial (UART) port and the wireless port.
According to the user setting, the Data Link Layer of WLAN module can work in RAW, UDP or TCP data formats.
2.5.1. RAW format
In the raw data format, user data is not encapsulated while it is transmitted in Data Link Layer. Instead, it is directly packed into an 802.11 network frame and transmitted. In this format, WLAN module uses the server’s MAC address as the target address of the transmission.
The RAW data transmission model is as following:
www.linksprite.com
12 / 50
2.5.2. UDP format
UDP (User Data Protocol) is a connectionless data transmission protocol in the TCP/IP protocol stack. UDP protocol supports unreliable data transmission, and does not guarantee the integrity of the data. But UDP uses little network source and processes data fast. Therefore, it is suitable for applications that require real-time but low-integrity data transmission, such as audio and video data transmission. UDP format is also good for data broadcasting.
When Data Link Layer of the WLAN module uses UDP format, the information including device IP address, server IP address and service port number must be set accurately. If server and WLAN module are not in the same subnet, subnet mask and gateway must be set. Otherwise they cannot communicate with each other (the setting of IP address and port number must follow the TCP/IP potocol).
The UDP data transmission model is as following:
www.linksprite.com
13 / 50
Transparent Transmission Mode
In UDP format, WLAN module also supports transparent transmission mode. Transparent transmission means that the WLAN module transmits “transparently” the data it receives from the serial user port to the network. The data transmission model is as following:
The module must meet all the following conditions before it can work in the transparent transmission mode:
1 Automatic networking mode is used;
www.linksprite.com
14 / 50
2 UDP Link Layer data format is used;
3 WLAN module is in successful connection status;
It must be noted that once the WLAN module enters the transparent transmission mode, it cannot receive user’s command from the UART serial port. (In testing or demonstration using the simulation environment, please turn off the WLAN module client software, and use general­purpose serial tools, such as Hyper Terminal, serial debugging assistant etc. to do the data transmission testing).
2.5.3. TCP format
TCP (Transmission Control Protocol) is a connection-oriented data transmission protocol. In TCP format, a virtual connection is created between the two sides of the communication. TCP supports reliable data transmission, and can handle out-of-order, loss, damage of data in the process of transmission.
When TCP format is used in Link Layer, it is highly recommended that the user enables ACK when sending data through UART serial port. In other words, it is recommended to use Send/ACK manner to further ensure the reliability of transmission.
The TCP data transmission model is as following:
TCP Monitoring Mode
When Link layer is set to TCP format, in addition to being used as a client to connect to the TCP server defined in the network parameters, the WLAN module can also be used as a TCP server in the TCP monitoring mode. The TCP monitoring mode can be enabled or disabled by configuring a system parameter. When the data format of Link Layer is not TCP, this parameter can be neglected. According to the status of TCP monitoring mode, the connection procedure of WLAN module is different.
www.linksprite.com
15 / 50
Disable TCP Monitoring
After associating with the AP, the WLAN module automatically connects to the server defined in the network parameters, and returns the message of successful connection to user. If the connection fails, it returns a failure message. The procedure of the WLAN module is the same as that in Version 1.3 and older versions which do not support the TCP Monitoring mode.
Enable TCP Monitoring
After connecting with the AP, the WLAN module returns the message of successful connection to user. Then WLAN module enters TCP Monitoring mode, and can accept external TCP connection requests. If user wishes it works as the client to connect to the server, the server can use TCP connection command to initiate the connection request.
This module does not support multiple TCP connections at the same time. If currently a TCP connection is in place, it can no longer receive or send new connection requests.
Loading...
+ 35 hidden pages