PLTBEITO Single UART Protocol

PLTBEITO Single UART Protocol---- Suzhou Pairlink Network Technology Ltd.,VersionHistoryRemark

1.0First release

1.1

New CMD&EVENT added

1.2Fix some typos

1.3

New CMD added

Q&A window

cai.yi@pairlink.com.cn

All rights reserved

Combine Master and SlaveMode

1Suzhou Pairlink Network Technology Ltd.

PLTBEITO Single UART Protocol

目录
PLTBEITO Single UART Protocol.......................................................................................................................................1
1. UART Control.......................................................................................................................................................4
1.1 UART configuration........................................................................................................................................... 4
1.2 UART Packet format.......................................................................................................................................... 4
1.3 UART packet -- Command.................................................................................................................................5
1.3.1 Command Opcode: Get Local address[0x01](M/S).......................................................................................5
1.3.2 Command Opcode: Send User Data[0x02](M/S).......................................................................................... 5
1.3.3 Command Opcode: Get Paired Device[0x03]](M).........................................................................................5
1.3.4 Command Opcode: Add device[0x04](M).....................................................................................................5
1.3.5 Command Opcode: Delete device[0x05](M).................................................................................................6
1.3.6 Command Opcode: Discoverable[0x06](M）............................................................................................... 61.3.7 Command Opcode:Get Connection ID[0x07](S)........................................................................................... 6
1.3.8 Command Opcode: Get Device Info[0x08](M/S).......................................................................................... 7
1.3.9 Command Opcode: Shut Down Sleep[0x09](M/S)........................................................................................7
1.3.10 Command Opcode:Get CCC Value[0x0a](S)................................................................................................ 7
1.3.11 Command Opcode:Upgrade Control[0x0b](M/S)....................................................................................... 81.3.12 Command Opcode:Upgrade Data[0x0c](M/S)............................................................................................ 8
1.3.13 Command Opcode:Discover Slaves[0x0d](M).............................................................................................8
1.3.14 Command Opcode:Discover Specified Slave[0x0e](M)...............................................................................91.3.15 Command Opcode:Set UART Baud Rate[0x0f](M/S).................................................................................. 9
1.3.16 Command Opcode:Set Device Name[0x10](S)............................................................................................91.3.17 Command Opcode:Set ADV TX Power[0x11](S)........................................................................................10
1.3.18 Command Opcode:Set ADV Interval[0x12](S)...........................................................................................10
1.3.19 Command Opcode:Set ADV User Data[0x13](S)....................................................................................... 10
1.3.20 Command Opcode:Set UART Flow Control[0x14](M/S)............................................................................11
1.4 UART packet -- Response................................................................................................................................ 11
1.4.1 Response Error Code....................................................................................................................................111.5 UART packet -- Event.......................................................................................................................................121.5.1 Event opcode: System Ready[0x01](M/S)................................................................................................... 121.5.2 Event opcode: Connection up [0x02](M/S)................................................................................................. 121.5.3 Event opcode: Connection down[0x03](M/S).............................................................................................12
1.5.4 Event opcode: Paired Device[0x04](M)....................................................................................................... 121.5.5 Event opcode: User Data Received[0x05](M/S).......................................................................................... 121.5.6 Event opcode: Connection Recover from BUSY[0x06](M/S).......................................................................13
1.5.7 Event opcode:Notify Enabled[0x07](S)........................................................................................................13
1.5.8 Event opcode:RSSI_Of_Connection[0x08](M).............................................................................................13
1.5.9 Event opcode:Found_Slave[0x09](M)......................................................................................................... 13
1.5.10 Event opcode:Found_Specified_Slave[0x0a](M).......................................................................................13
2. Appendix........................................................................................................................................................... 14
2.1 中心设备绑定关系（串口命令）............................................................................................................... 14
2.2 数据传输....................................................................................................................... 错误！未定义书签。

All rights reserved

2Suzhou Pairlink Network Technology Ltd.

PLTBEITO Single UART Protocol

All rights reserved

3

Suzhou Pairlink Network Technology Ltd.

PLTBEITO Single UART Protocol

1. UART Control
1.1 UART configuration
NO1234NAME
Baud Rate
Data Bit
Stop
Parity Bit

CONFIG
115200(default)
8 bits1 bit
None

1.2 UART Packet format
LSB

HeaderType

Header (1 Byte)
Type (1 Byte)

Length (1 Byte)
OpCode (1 Byte)
Parameters ( Length-1Bytes)
Check_XOR (1 Bytes)

All rights reserved

Length

OpcodeParameters

MSB
Check_XOR

0x77
Type of Packet
0xA1: Command
0xA2: Reserved
0xA3: Response
0xA4: Event
Length of OpCode + Parameters
Operation code of this packet
Data payload of each OpCode
Check the packet validity
Check_XOR = Header ^ Type ^ Length ^ OpCode ^ Parameters

4Suzhou Pairlink Network Technology Ltd.

PLTBEITO Single UART Protocol

1.3 UART packet -- Command
Command:MCU--->PLTBEITO.
1.3.1 Command Opcode: Get Local address[0x01](M/S)
Get modules’s MAC.
CommandHeader
Type
Length
Opcode77
A101
01

Parameters
N/A

Check_XOR

ResponseHeader
77

Parameters
Public_Address[6]Check_XOR

Type
A3Length
07

Opcode01

1.3.2 Command Opcode: Send User Data[0x02](M/S)
MCU send data to remote M/S.
CommandHeader
Type
LengthOpcode

Parameters
Connection_ID77
A1n02
Userdata[]
Connection_ID:uint16_t,each connection will be allocated a connection ID.
Userdata[]：Passthrough data，max 252bytes.
ResponseHeader
Type
Length
OpcodeParameters
77
A30202
Err
Parameters : Err = Error Code Refer to 1.4.1 [1byte]

Check_XOR

Check_XOR

1.3.3 Command Opcode: Get Paired Device[0x03]](M)Get the stored slave devices’ MAC.The paired devices will be report in the event.
CommandHeader
Type
Length
OpcodeParameters
Check_XOR
77
A10103N/A
ResponseHeader
Type
Length77
A302
num：the number of paired device.

Opcode03

1.3.4 Command Opcode: Add device[0x04](M)Add device.
CommandHeader
Type
Length
Opcode77
A10704All rights reserved

5Parametersnum

Check_XOR

Parameters
Public_Address[6]Check_XOR
variableSuzhou Pairlink Network Technology Ltd.

PLTBEITO Single UART Protocol

ResponseHeader
Type
Length
Opcode77
A30204
Parameters : Err = Error Code Refer to 1.4.1 [1byte]

Parameters
Err

Check_XOR

Parameters
Public_Address[6]Check_XOR

variable

1.3.5 Command Opcode: Delete device[0x05](M)Delete device.
CommandHeader
Type77
A1Length07

Opcode05

ResponseHeader
Type
Length
Opcode77
A30205
Parameters : Err = Error Code Refer to 1.4.1 [1byte]

Parameters
Errvariable

Check_XOR
variable

1.3.6 Command Opcode: Discoverable[0x06](M）Set the module the discoverable mode in which OTA is possible.
CommandHeader
TypeLength
OpcodeParameters
77
A10206
Duration
Duration :Unit s.
ResponseHeader
Type
Length
Opcode77
A30206
Parameters : Err = Error Code Refer to 1.4.1 [1byte]

Parameters
Err

Check_XOR
variable

Check_XORvariable

1.3.7 Command Opcode:Get Connection ID[0x07](S)Get the current connection ID.
CommandHeader
TypeLength77
A101
ResponseHeader

TypeOpcode
07

Parameters
Connection
77
A30307_ID
Connection_ID: 0x0000 means disconnected，others mean connected.

All rights reserved

LengthParameters
NULL

Opcode6

Check_XOR
variable

Check_XOR
variableSuzhou Pairlink Network Technology Ltd.

PLTBEITO Single UART Protocol

1.3.8 Command Opcode: Get Device Info[0x08](M/S)
Get the information about the module.
CommandHeader
Type
Length
Opcode77
A10208
Type: 00
model01
software version
02
hardware version
03-FF RESERVED
ResponseHeader

Type

LengthParameters
type

Opcode77
A3n08
Info_String[]:information returned according to the type.

Parameters
Info_String[]

Check_XOR
variable

Check_XOR
variable

1.3.9 Command Opcode: Shut Down Sleep[0x09](M/S)
Set the module to deep sleep mode.
CommandHeader
Type
Length77
A101

Opcode09

Parameters
NULL

ResponseHeader
Type
Length
Opcode77
A302
09
A rising edge on P00 will wake up the module。

Parameters
00

Check_XOR
variable

Check_XOR
variable

1.3.10 Command Opcode:Get CCC Value[0x0a](S)Get client configuration value .
CommandHeader
TypeLength77
A101

Opcode0aParameters
NULL

Check_XOR
variable

ResponseHeader
TypeLength
OpcodeParameters
Check_XOR
77
A3030a
CCC_value
variable
When CCC_value is 0x0001,it means notification is enabled。
Only when notification is enabled,the slave module can send data to master module。

All rights reserved

7Suzhou Pairlink Network Technology Ltd.

PLTBEITO Single UART Protocol

1.3.11 Command Opcode:Upgrade Control[0x0b](M/S)
Local firmware update through UART.
CommandHeader
Type
Length77
A1nOpcode0bParameters
Upgrade command

Check_XOR
variable

ResponseHeader
TypeLengthOpcode
Parameters
Check_XOR
77
A3020bstatus
variableUpgrade command：
start： 01 xx xx xx xx, append the length of the bin file
stop： 02
check：03 xx xx xx xx, append the crc32 of the bin file，if check successfully，module will reboot.
1.3.12 Command Opcode:Upgrade Data[0x0c](M/S)
Local firmware update through UART.
CommandHeader
77
ResponseHeader
77

TypeA1
TypeA3Lengthn

Opcode0c

Length02

Parameters
Data[]

Opcode0cParameters
statusCheck_XOR
variable

Check_XOR
variable

Send firmware data in sequence after UART upgrade start。
1.3.13 Command Opcode:Discover Slaves[0x0d](M)Master module try to find slaves nearby.
Note:During the procedure,auto connection establish will not work.The CMD< Add device>willstop the discovery right now.
CommandHeader
77

TypeA1

Length02

Opcode0d

Parameters
Timeout

If Timeout == 0,stop the previous discovery
If Timeout != 0,start discovery until timeout,unit is second.

ResponseHeader
77

TypeA3

Length02

Opcode0d

Parameters
statusCheck_XOR
variable

Check_XOR
variableAn event will be generated when a slave is found.

All rights reserved

8Suzhou Pairlink Network Technology Ltd.

PLTBEITO Single UART Protocol

1.3.14 Command Opcode:Discover Specified Slave[0x0e](M)Master module try to find a specified slave nearby.
CommandHeader
77

TypeA1

Length08

Opcode0eParameters
Timeout
Address[6]If Timeout == 0,stop the previous discovery
If Timeout != 0,start discovery until timeout,unit is second.
Address[6]:specify the address to findResponseHeader
77

TypeA3

Length02

Opcode0eParameters
statusCheck_XOR
variable

Check_XOR
variableAn event will be generated when the slave is found.
1.3.15 Command Opcode:Set UART Baud Rate[0x0f](M/S)
Change the baud rate of UART.
The default value is 115200.
CommandHeader
Type
Length77
A105
Baudrate: 9600~1000000
ResponseHeader
Type
Length77
A302

Opcode0f

Parametersbaudrate

Opcode0f

Parameters
statusCheck_XOR
variable

Check_XOR
variable

The baud rate will change to the new setting after 150ms.
The baud rate will be stored to NVRAM.
1.3.16 Command Opcode:Set Device Name[0x10](S)Change the device name.
The default name is “ito-single”.
CommandHeader
Type
Length
OpcodeParameters
77
A1n10Name[]Name[]: string of the name,max 29 bytes.
ResponseHeader
TypeLength
OpcodeParameters
77
A302
10status

All rights reserved

9

Check_XOR
variable

Check_XOR
variableSuzhou Pairlink Network Technology Ltd.

PLTBEITO Single UART Protocol

The name will be stored to NVRAM.
1.3.17 Command Opcode:Set ADV TX Power[0x11](S)Change the advertising TX power.
The default value is 12dbm.
CommandHeader
Type77A1
level: int8_t,-16~12.
Response
Header
Type77
A3

Length02

Opcode11Length
02

Parameters
level

Opcode11Parameters
statusCheck_XOR
variable

Check_XOR
variable

The TX power will be stored to NVRAM.
1.3.18 Command Opcode:Set ADV Interval[0x12](S)Change the advertising interval.
The default value is 0x0040.
CommandHeader
Type
Length
OpcodeParameters
77
A103
12
intervalinterval: uint16_t,0x0020~0x4000.
The actual interval of advertising will be (interval*0.625)ms.
ResponseHeader
Type
Length
OpcodeParameters
77
A302
12
statusCheck_XOR
variable

Check_XOR
variable

The interval will be stored to NVRAM.
1.3.19 Command Opcode:Set ADV User Data[0x13](S)Change the user data in advertising.
CommandHeader
Type
77
A1Data[]:max 8bytes.
ResponseHeader
Type77A3

All rights reserved

Lengthn

Opcode13

Length02

Parameters
Data[]

Opcode13
10

Parameters
statusCheck_XOR
variable

Check_XOR
variableSuzhou Pairlink Network Technology Ltd.

PLTBEITO Single UART Protocol

The data will be stored to NVRAM.

1.3.20 Command Opcode:Set UART Flow Control[0x14](M/S)
Enable/disable the hardware RTS(P28)/CTS(P27) flow control.
CommandHeader
77
ResponseHeader
77

TypeA1enable:1/0.

Length2TypeA3Opcode
14

Length02

Parameters
enableOpcode14

Parameters
statusCheck_XOR
variable

Check_XOR
variable

The data will be stored to NVRAM.

1.4 UART packet -- Response
Response packet could be considered as ACK for the command packet.
The response packet is dedicated to the command package.
1.4.1 Response Error Code1) Error Code
Value
0x00
0x01
0x02
0x03
0x04
0x05
0x06
0x07

All rights reserved

Comment
ERR_NONEERR_INVALID_LENGTHERR_INVALID_PARAMETERERR_UNKNOWN_CMD
ERR_DISCONNECTED
ERR_BUSYERR_NOTIFY_DISABLED
ERR_NO_RESOURCE

11Suzhou Pairlink Network Technology Ltd.

PLTBEITO Single UART Protocol

1.5 UART packet -- Event
Event packet is sent to MCU from PLTBEITO to notify MCU that, there is event or data
triggered .
1.5.1 Event opcode: System Ready[0x01](M/S)
System boot up.When P06 is pulled up,the module will enter master mode.When P06 is pulled
down,the module will enter slave mode.
EventHeader
Type
Length
OpcodeParameters
Check_XOR
77
A40201
mode
variablemode: 0x01
slave mode0x02 master mode
1.5.2 Event opcode: Connection up [0x02](M/S)
Generated when a connection is established.
EventHeader
Type
Length77

OpcodeA409
Connection_id:this connection’s identify.
Address[6] :remote’s MAC.

02

Parameters
Connection_idAddress[6]Check_XOR

Parameters
Connection_id

Check_XOR

variable

1.5.3 Event opcode: Connection down[0x03](M/S)
Generated when a connection is shutdown.
EventHeader
Type
Length77

A4

Opcode0303

variable

1.5.4 Event opcode: Paired Device[0x04](M)Gnerated when cmd<Get Paired Device>is received.
EventHeader
TypeLengthOpcode
77

Parametersnum
Address[num][6]Check_XOR

Parameters
Connection_id

Check_XOR

A4
n04
Num：the number of stored slaves
Address[num][6]:the array of stored slaves’ MAC

variable

1.5.5 Event opcode: User Data Received[0x05](M/S)
Generated when data is received.
EventHeader
Type
Length77
A4nAll rights reserved

Opcode05
12variableSuzhou Pairlink Network Technology Ltd.

PLTBEITO Single UART Protocol

User_data[]
Connection_id:the connection identify
User_data[]:Passthrough data from remote
1.5.6 Event opcode: Connection Recover from BUSY[0x06](M/S)
Generated after the connection recover from busy state.
EventHeader
TypeLength
OpcodeParameters
77
A40306
Connection_id

Check_XOR
variable

1.5.7 Event opcode:Notify Enabled[0x07](S)Generated when the notification is enabled.
EventHeader
Type
Length
Opcode77
A40307

Parameters
Connection_id

Check_XOR

Parameters
RSSI

Check_XOR

Parameters
Address[6]Check_XOR

Parameters
RSSI
Address[6]Advertising data[31]Check_XOR

variable

1.5.8 Event opcode:RSSI_Of_Connection[0x08](M)Generated when a connection is established.
EventHeader
Type
Length
Opcode77
A40208variable

1.5.9 Event opcode:Found_Slave[0x09](M)Generated when a slave is found.
EventHeader
Type
Length77
A407

Opcode09

variable

1.5.10 Event opcode:Found_Specified_Slave[0x0a](M)Generated when the specified slave is found.
EventHeader
Type
Length
Opcode77

A4All rights reserved

270a

13

variableSuzhou Pairlink Network Technology Ltd.

PLTBEITO Single UART Protocol

2. Appendix
2.1 Central role bond flow（UART command）
MCU

Central role

Command:Get Paired Device

Response:Get Paired Device

Event:Paired Device

Command:Add device or Delete device

All rights reserved14Suzhou Pairlink Network Technology Ltd.

PLTBEITO Single UART Protocol

2.2 Data transmit
2.2.1 Central role
Suppose the bonding has completed
MCU

Central role

Event：System Ready

Event：Connection Up

Event：User Data Received。。
。。

Event：Connection Down

All rights reserved

15

Suzhou Pairlink Network Technology Ltd.

PLTBEITO Single UART Protocol

2.2.2 Peripheral role
MCU

Peripheral role
Event：System Ready

Event：Connection Up
Data readyCommand:Send User Data

Response：Send User Data[ERR_NONE]

Command:Send User Data
Response：Send User Data[ERR_NONE]
Data sending
Command:Send User Data

Response：Send User Data[ERR_BUSY]

Waiting
Event：Connection Recover from BUSY
Data sending

All rights reserved

16

Suzhou Pairlink Network Technology Ltd.

PLTBEITO Single UART Protocol

2.3 OTA via UART

Command:Upgrade Control[Start]

Response:Upgrade Control

Command:Upgrade Data
Response:Upgrade Data
.....
.....
.....

Command:Upgrade Control[Calibration]
Reset after calibration done
Response error if calibration failed

All rights reserved

17Suzhou Pairlink Network Technology Ltd.