WAVESHARE ELECTRONICS
WIFI232 User Manual
Page 23 of 81
4.2.2 Serial command mode
In this mode, the user can send the serial data to a different server address, this pattern can be
use udp or TCP client sends data to the server.
Customer MCU send packets according to the following format, parsing module is finished, only
the n bytes of data sent to the destination address.When data is returned, not analytical data from
serial port output directly.
Table 5
Protocol table of Serial command mode
frame
header
length
functio
n
byte
Backup
data area
Destinati
on port
Target
address
Data
Sum
check
2
2
(n+m+5)
1
2
2
m
n
1
frame header
:
0x55 0xAA
(
Constant
)
Length
:
Starting from the function byte, to Sum check (does not contain the sum check) all bytes.
High byte at the front
Function byte
:
Bit0:
(
UDP:0 ;TCP:1
)
Bit1:
(
Short connection:0;Long connection:1
)
Bit2:
(
IP:0;Domain name:1
)
Bit7:
(
cut protocol:0;full protocol:1
)
Note: currently only supports cut protocol
Notes:
Bit1:If it is a short connection, it sends data, and then will be disconnected; if it is long
connection, it sends data, connection will remain, until the re changing the target address.
Bit2:Indicates that the target address is IP or domain name. If it is IP, the target address is 4
bytes; if the domain name, the target address length for the entire domain name string length
(the last byte address is
„\0‟, that is the end of the string).
Bit7:Under the cut protocol, reply frame contains only data; Under the full protocol, reply
frame has "failed to send", "waiting for", "UDP radio response equipment IP" frame data.
Backup data area:
First byte:If it is a short connection, this position is TCP waits for the timeout time (1-255), if
the send command is completed, did not receive a response, then wait a few seconds and
the corresponding, if 5, said to wait for the 5S to disconnect; if the sending command,
immediately receive the returned data, then immediately disconnected; if it is long connection,
this position is 0x00.
Second byte:Reserve
Destination port:
Little endian, low byte in the former,such as port 23, here are 0x17 0x00
Target address:
If it is IP, is 4 bytes, for example, 192.168.0.7 said 0x07 0x00 0xA8 0xC0; if it is a domain
name, then the address of indefinite length,ending with the
‟\0'.
Data:
Variable length,the maximum not exceeding 1000bytes.