Multilink UART Protocol---- Suzhou Pairlink Network Technology Ltd.,VersionHistory

Remark

1.0First release

1.1

Modify event parameter of 02and 03
Add command 06 and event
06
Add sample flow chart

1.2

Add command 07 and event
07

Q&A window

Business:cai.yi@pairlink.com.cn,
Technology:chen.yuke@pairlink.com.cn

All rights reserved

Suzhou Pairlink Network Technology Ltd.

目录Multilink UART Protocol....................................................................................................................11 UART Control.................................................................................................................................. 3
1.1 UART configuration............................................................................................................... 3
1.2 UART Packet format.............................................................................................................. 3
1.3 UART packet -- Command..................................................................................................... 4
1.3.1 Enable Discoverable mode[0x01]..............................................................................4
1.3.2 Get Local address[0x02]............................................................................................ 4
1.3.3 Set IDs[0x03]............................................................................................................. 5
1.3.4 Register Data Channel[0x04].....................................................................................5
1.3.5 Send User Data[0x05]................................................................................................6
1.3.6 Send Bypass User Data[0x06]................................................................................... 6
1.3.7 Check Data Route[0x07]............................................................................................71.4 UART packet -- Response...................................................................................................... 8
1.4.1 Response Error Code................................................................................................. 8
1.5 UART packet -- Event............................................................................................................. 91.5.1 System status [0x01].................................................................................................. 9
1.5.2 Discoverable Status[0x02]......................................................................................... 9
1.5.3 Mesh Status[0x03]..................................................................................................... 9
1.5.4 Local Address[0x04]................................................................................................ 10
1.5.5 User Data[0x05]....................................................................................................... 101.5.6 Bypass User Data[0x06].......................................................................................... 11
1.5.7 Data Route[0x07]..................................................................................................... 112 Flow Chart......................................................................................................................................12
2.1 Boot up................................................................................................................................ 12
2.2 Read BT Address.................................................................................................................12
2.3 Configure Mesh(cmd)..................................................................................................... 13
2.4 Data communication........................................................................................................... 14

All rights reserved

Suzhou Pairlink Network Technology Ltd.

1 UART Control
1.1 UART configuration
NO
1234NAME
Baud Rate
Data Bit
Stop
Parity Bit

CONFIG
1152008 bits1 bit
None

1.2 UART Packet format
LSBHeader

Header (1 Byte)
Type (1 Byte)

Length (1 Byte)
Opcode (1 Byte)
Parameters ( n Bytes)
Check (1 Bytes)All rights reserved

TypeLengthOpcodeParameters

MSB

0x77
Type of packet
0x01: Command
0x02: Reserved
0x03: Response
0x04: EventTotal length of opcode and parameters
Operation code of this packet
Data payload of each opcode
Check the packet validity
Check = Header ^ Type ^ Length ^ Opcode ^ Parameters

Suzhou Pairlink Network Technology Ltd.

Check

1.3 UART packet -- Command
Command packets are defined for MCU to control the PLTBEITO.

1.3.1 Enable Discoverable mode[0x01]
PLTBEITO will enter discoverable mode when receiving this command.
In discoverable mode, the PLTBEITO can be added into one mesh-net, or do
firmware upgrade.
CommandHeader
Type
Length
OpcodeParameters
Check77010201
nSec
Parameters
nSec

ResponseHeader
77

Length1Type03

Parameters
Err

value
1~255

Length02
Length1

Opcode01
value
Refer to 1.4.1

description
the time to stay indiscoverable mode

Parameters
Err

Check

description
The statuscommandof

1.3.2 Get Local address[0x02]
Get the PLTBEITO’s MAC.
When received this command successfully,PLTBEITO will send an event to MCU.
CommandHeader
Type
Length
OpcodeParameters
77010102
N/A
ResponseHeader77Parameters

All rights reserved

Type
03

Length02
Length

Opcode02
value

Parameters
Err

Check75
Checkdescription

Suzhou Pairlink Network Technology Ltd.

theErr

1

Refer to 1.4.1

The statuscommandof

the1.3.3 Set IDs[0x03]
MCU can set companyID and productID into PLTBEITO through this command.
The APK/APP could inquiry this two IDs to learn which product it is.
CommandHeader
Type
Length
OpcodeParameters
Check
CID
77
01
05
03
PID
Parameters
CID

Length2

value
User defined

description
Company id

PID

2

User defined

Product id

Response
Header77
Parameters
Err

Type03

Length02
Length1

Opcode03
value
Refer to 1.4.1

Parameters
Err

Checkdescription
The statuscommandofthe1.3.4 Register Data Channel[0x04]
MCU send this command to PLTBEITO to register the channels, from which it
want to receive mesh data.
CommandHeader
Type
Length
OpcodeParameters
Check
77
01
05
04
channel_sel
Parameterschannel_sel

All rights reserved

Length4

value
Bit0~bit31

description
Bit mask ofchannel

Suzhou Pairlink Network Technology Ltd.

each

Response
Header77

Type
03

Parameters
Err

Length02

Opcode04

Length1Parameters
Err

value
Refer to 1.4.1

CheckcheckdescriptionThe statuscommandofthe

1.3.5 Send User Data[0x05]
MCU send data to other devices in mesh.
CommandHeader
Type
Length
Opcode77

01

nParameters
Virtual Address
ChannelData

05

Parameters
Virtual Address

Length4

value
Uint32_t

Channel

10~31

Data

n

Byte array

Response
Header77
Parameters
Err

Type03

Length02
Length1

Opcode05
value
Refer to 1.4.1

Check

description
The destination of thedata.0xFFFFFFFF
means broadcast
The channel to send
the data
User data

ParametersErr

description
The statuscommand1.3.6 Send Bypass User Data[0x06]
MCU send data to smart phone when in discoverable mode.
All rights reserved

CheckcheckSuzhou Pairlink Network Technology Ltd.

oftheCommandHeader
77

Type01

Parameters
Data

Response
Header77

LengthnLengthnType
03Parameters
Err

Opcode06

Parameters
Data

value
Byte array

Length02
Length1

Opcode06

Checkdescription
User data

Parameters
Err

value
Refer to 1.4.1

Checkcheckdescription
The statuscommandofthe1.3.7 Check Data Route[0x07]
MCU send the source virtual address to get the virtual address of node who has
passed the data,if Err in response equal to ERR_NONE,then an event[07] will begenerated.
CommandHeader
Type
Length
OpcodeParameters
Check
77
01
507
Virtual Address
Parameters
Virtual Address

Response
Header77
Parameters
Err

All rights reserved

LengthType03

4Length02
Length1

value
Virtual address of thesource

Opcode06
value
Refer to 1.4.1

description

Parameters
Err

Check
check

description
The statuscommandSuzhou Pairlink Network Technology Ltd.

ofthe1.4 UART packet -- Response
Response packet could be considered as ACK for the command packet.
When one command packet is sent to PLTBEITO, there is one response packetsent back to MCU.
The response packet is dedicated to the command package.

1.4.1 Response Error Code1) Error CodeValue
0x00
0x01
0x02
0x03
0X04

All rights reserved

Comment
ERR_NONEERR_LENGTH_FAIL
ERR_INVALID_FAIL
ERR_UNKNOWN_CMD
ERR_OFFLINE

Suzhou Pairlink Network Technology Ltd.

1.5 UART packet -- Event
Event packet is sent to MCU from PLTBEITO to notify MCU that, there is event ordata triggered in the Mesh-net.

1.5.1 System status [0x01]
PLTBEITO is ready. This event packet would be sent to MCU after PLTBEITOsystem boot up.
EventHeader
Type
Length
OpcodeParameters
Check7704020101
check1.5.2 Discoverable Status[0x02]
EventHeader
77

Type04

Parameters
statusLength1

Length02

Opcode02

Parameters
status

value
0x01
0x02

Discoverable mode now.
Timeout-exit

Length

Opcode

Check
check

description
Notifythediscoverable status

1.5.3 Mesh Status[0x03]

EventHeader
77

Type040303

Parameters
Type

Length
1

value
0x00
0x01
mesh

Value

1

According to TypeAll rights reserved

Parameters
TypeValue

Check
check

description
Configure Status
Notify the mesh status.
Device Number in

If Type == 0x00,value is below：
MESH_CONFIG_DELETE 0
MESH_CONFIG_NEW
1
Suzhou Pairlink Network Technology Ltd.

MESH_CONFIG_SAME2
If Type == 0x01，value
indicate the device number inmesh

1.5.4 Local Address[0x04]
Generated after receive the command[0x02] of “Get Local address”
EventHeader
Type
Length
OpcodeParameters
77
04
0704
address
Parameters
address

Length6value
Byte[6]

Check
check

description
The MAC address ofthe module

1.5.5 User Data[0x05]
Generated when PLTBEITO receive user data from Mesh-net on the registeredchannel.
EventHeader
TypeLengthOpcode
Parameters
CheckChannel
Virtual address
7704n05
Data
Parameters
ChannelLength1value
0~31

Virtual address

4

Uint32_t

DatanByte array

All rights reserveddescription
The channel receiveddata
The source address
the data
User dataSuzhou Pairlink Network Technology Ltd.

1.5.6 Bypass User Data[0x06]
Generated when PLTBEITO receive user data in discoverable mode.
Event
HeaderType
Length
OpcodeParameters
7704
n06
Data
Parameters
Data

Lengthnvalue
Byte array

Checkdescription
User data

1.5.7 Data Route[0x07]
Generated when PLTBEITO receive cmd[07].
EventHeader
TypeLength
Opcode7704n07
Parameters
Virtual Address Array

All rights reserved

LengthnParameters
Virtual Address Arrayvalue
Src_vaddr
Passed_vaddr...
Dst_vaddr

Checkdescription
Virtual address list

Suzhou Pairlink Network Technology Ltd.

2 Flow Chart
2.1 Boot up
PLTBEITO

MCU

77 04 02 01 01 71

System ready77 04 03 03 01 02 70

Connectedtomesh(2 devices)

Assume there is another PLTBEITO powered on in the same net

2.2 Read BT Address

PLTBEITOMCU

Get address

77 01 01 02 75

77 04 07 04 44 22 11 d7 ac f0 8c

All rights reserved

Address:F0-ACD7-11-22-44

Suzhou Pairlink Network Technology Ltd.

2.3 Configure Mesh(cmd)
PLTBEITO

MCU

Enablediscoverable

77 01 02 01 3C 49

77 04 02 02 01 77

Creat on apk

77 04 03 03 00 01 72

All rights reserved

status:added to a
new meshSuzhou Pairlink Network Technology Ltd.

2.4 Data communication

PLTBEITO

MCU

Register channel0,8,16,24 to listen for
data

77 01 05 04 01 01 01 01 77

Send “11 22 33 44”to the
PLTBEITO using apk onchannel8

Data received

Send data

77 04 0a 05 08 03 00 00 00 11 22 33 44 33

77 01 0a 05 FF FF FF FF 10 55 66 77 88 A577 03 02 05 00 73

Assume the PLTBEITO has already connected to mesh

All rights reserved

Suzhou Pairlink Network Technology Ltd.