串口通信协议
在USB模式下,POS和支付终端之间使用串行通信协议
通信参数
- Baud Rate : 115200
- Data bits : 8
- Stop bits : 1
消息结构

Offset | Field | Byte Length | Description |
---|---|---|---|
0x00 | STX | 2 | Start text, fixed value: 0x55AA |
0x02 | Message type | 1 | 0x00: normal package 0x01: handshake command 0x02: handshake confirmation command |
0x03 | ACK | 1 | If the field is 0, it means that the field is invalid; non-0, it represents the id of the last received data packet that passed the verification |
0x04 | Message ID | 1 | There is no valid data in the message, the value is 0; the initial value can be 1, and each time a new data packet is sent, it will automatically + 1, greater than 255, and reset to the initial value of 1; |
0x05 | Message Data length | 2 | Represents the sum of the lengths of message data segments, with high bytes first; |
0x07 | Message Data | n | Valid data, the upper business layer is responsible for parsing the specific Action category; |
0x08+n | CRC | 1 | Checksum, Byte-by-byte XOR result for data from “message type” to “message data” |
0x09+n | ETX | 2 | End text, fixed value: 0xCC33 |
备注
消息最大长度为1024字节