GW nRF52811 UART communication
Last updated
Last updated
The host and device (nRF52) communicate with each other via UART using the following message format:
Note 1: LEN
field determines the length of the payload (CMD
field is not included in LEN
).
Thus, the message with LEN
=0 contains only the CMD
byte and no Payload
.
Note 2: CRC16 is calculated for Header
(LEN
and CMD
) and Payload
.
CRC is CRC-16-CCITT-FALSE, Polynomial Formula: x16+x12+x5+1, Polynomial: 1021
Command RE_CA_UART_SET_CH_37
:
Complete message: CA 02 0A 01 2C B6 78 0A
Ack RE_CA_UART_ACK
:
Complete message: CA 04 20 0A 2C 00 2C E7 7E 0A
Command RE_CA_UART_SET_ALL:
Complete message: CA 05 0F 99 04 2C 7D 2C 21 61 0A
Ack RE_CA_UART_ACK:
Complete message: CA 04 20 0F 2C 00 2C A2 C2 0A
Command :
Complete request message: CA 00 18 36 8E 0A
Response:
Complete response message: CA 10 11 40 98 A7 78 58 1A E1 38 2C C8 25 2D 8E 9C 2C 2C 7F 67 0A
Note: The length of the Advertisement is determined by the LEN field in the Header. Adv_Len := LEN - 10
Complete report message: CA 29 10 C6 A5 B9 E0 AD 06 2C 02 01 06 1B FF 99 04 05 14 64 47 25 C4 41 00 34 00 00 04 1C A9 36 11 01 58 C6 A5 B9 E0 AD 06 2C D9 2C 11 08 0A
CONFIGURATION REQUEST sequence
Complete configuration request message: CA 00 19 17 9E 0A
Constant | Value |
---|---|
Command | CMD | Param | Value |
---|---|---|---|
Command | CMD | Param 1 | Param 2 |
---|---|---|---|
Ack | CMD | Param 1 | Param 2 |
---|---|---|---|
STX | LEN | CMD | Filter ID | DELIMITER | State bit-mask | DELIMITER | CRC16 | ETX |
---|---|---|---|---|---|---|---|---|
STX | LEN | CMD | Command | DELIMITER | Ack | DELIMITER | CRC16 | ETX |
---|---|---|---|---|---|---|---|---|
Request | CMD | Param |
---|---|---|
Response | CMD | Param 1 | Param 2 |
---|---|---|---|
STX | LEN | CMD | CRC16 | ETX |
---|---|---|---|---|
STX | LEN | CMD | Device ID | DELIMITER | MAC Addr | DELIMITER | CRC16 | ETX |
---|---|---|---|---|---|---|---|---|
Report | CMD | Param 1 | Param 2 | Param 3 |
---|---|---|---|---|
STX | LEN | CMD | MAC Addr | DELIMITER | Adv | DELIMITER | RSSI | DELIMITER | CRC16 | ETX |
---|---|---|---|---|---|---|---|---|---|---|
Request | CMD | Param |
---|---|---|
STX | LEN | CMD | CRC16 | ETX |
---|---|---|---|---|
STX
0xCA
ETX
0x0A
DELIMITER
0x2C
RE_CA_UART_SET_FLTR_TAGS
0x05
Enable/disable BLE tags filter
0...1
RE_CA_UART_SET_FLTR_ID
0x06
Manufacturer ID to be filtered (uint16)
0...65535
RE_CA_UART_SET_CODED_PHY
0x07
Enable/disable BLE coded PHY
0...1
RE_CA_UART_SET_SCAN_1MB_PHY
0x08
Enable/disable BLE scan PHY
0...1
RE_CA_UART_SET_EXT_PAYLOAD
0x09
Enable/disable BLE extended payload
0...1
RE_CA_UART_SET_CH_37
0x0A
Enable/disable BLE channel 37
0...1
RE_CA_UART_SET_CH_38
0x0B
Enable/disable BLE channel 38
0...1
RE_CA_UART_SET_CH_39
0x0C
Enable/disable BLE channel 39
0...1
RE_CA_UART_LED_CTRL
0x0E
Turn on the LED for the specified time interval in milliseconds (uint16)
0...65535
RE_CA_UART_SET_ALL
0x0F
Manufacturer ID to be filtered:
0...65535
Bit-mask (uint8) for all state flags: - bit 0: Filter tags - bit 1: BLE coded PHY - bit 2: BLE scan PHY - bit 3: BLE extended payload - bit 4: BLE chan 37 - bit 5: BLE chan 38 - bit 6: BLE chan 39
RE_CA_UART_ACK
0x20
Command to which the ACK responds:
0x05...0x0C, 0x0F
Ack state:
0
- OK
1
- Error
STX
LEN
CMD
State
DELIMITER
CRC16
ETX
CA
02
0A
01
2C
78B6
0A
STX
LEN
CMD
Command
DELIMITER
Ack
DELIMITER
CRC16
ETX
CA
04
20
0A
2C
00
2C
7EE7
0A
CA
05
0F
0499
2C
7D
2C
6121
0A
CA
04
20
0F
2C
00
2C
C2A2
0A
RE_CA_UART_GET_DEVICE_ID
0x18
-
RE_CA_UART_DEVICE_ID
0x11
Device ID (8 bytes)
MAC Address (6 bytes)
CA
00
18
8E36
0A
CA
10
11
0x38E11A5878A79840
2C
2C:9C:8E:2D:25:C8
2C
677F
0A
RE_CA_UART_ADV_RPRT
0x10
MAC address (6 bytes)
Advertisement:
Variable length (MAX 31 Bytes)
RSSI in dB:
-128...127
CA
29
10
06:AD:E0:B9:A5:C6
2C
02 01 06 1B FF 99 04 05 14 64 47 25 C4 41 00 34 00 00 04 1C A9 36 11 01 58 C6 A5 B9 E0 AD 06
2C
D9
2C
0811
0A
RE_CA_UART_GET_ALL
0x19
-
CA
00
19
9E17
0A