We utilize WAKE-like protocol. 0xC0 is the package start/end. 0xDB is ESC. To send 0xC0 send 0xDB 0xDC, to send 0xDB send 0xDB 0xDD. Escaping should not affect the payload size field.
0xC0 0x00 {command} {payload size} [channel address] {payload}
0xC0: frame begin (and end) usStart, usEnd
0x00: protocol version usProtoVer
Command: 1 byte, MSB is always 0 for request package (pc2modem), 1 for response package (modem2pc) usCommand
Payload size: 1 byte, 0 to 32 (5 to 37 for payloads with channel address) usPDataLength
Channel address: 5 bytes, part of payload usPAddressTo
Payload: up to 32 bytes usPData
0xC0 0x00 {command} {response code} {payload size} {payload}
Command: same as in the request, but with a high bit set.
Response code: high bit 0 means successful command execution, 1 means command did not do what it requested to do
Payload consists of command (1 byte) and data. Unimplemented requests marked cursive.
Description |
enum |
# (hex) |
Arguments |
Return |
Echo |
00 |
Same payload as in request |
||
Version |
mcVersion |
01 |
Firmware build version, uint32_t |
|
Get modem status |
mcStatus |
08 |
— |
See description below |
Get NRF addresses |
mcAddresses |
09 |
— |
See description below |
Set RF channel |
mcSetChannel |
10 |
0 — 127 |
ACK |
Set TX power |
mcSetTxPower |
11 |
00 -18dBm 01 -12dBm 02 -6dBm 03 0dBm |
ACK |
Set bit rate |
mcSetBitRate |
12 |
00 1Mbps 01 2Mbps 02 250kbps |
ACK |
Set auto retransmit delay |
mcSetAutoRetransmitDelay |
13 |
0 — 15 D = 250uS x (arg+1) |
ACK |
Set auto retransmit count |
mcSetAutoRetransmitCount |
14 |
0 — 15 |
ACK |
Clear TX queue |
mcClearTX |
20 |
— |
ACK |
Clear RX queue |
mcClearRX |
21 |
— |
ACK |
Listen given address at pipe 0 |
mcListen |
30 |
{address} |
00 |
Set master/slave mode |
mcSetMode |
40 |
{is_master} 0 for debug (no automatic actions) 1 for slave (always listening) 2 for master |
{code}{mode} 0 is OK Mode is current mode regardless of code, if code 1 mode is unchanged. |
Set master address In slave mode it will always listen to that address for new requests. |
mcSeListenAddress |
41 |
{address} |
|
Request receive RF rx buffer |
mcReadRFBuffer |
50 |
{address}{data} Response codes: 0x10 buffer empty 0x15 ack packet 0x12 ack timeout 0x14 data packet 0x11 slave timeout |
|
Queue package for transmission |
mcTransmit |
7F |
{address}{data} |
Code |
Name |
0x00 |
Ok |
0x10 |
No packets |
0x11 |
Slave response timeout |
0x12 |
Ack timeout |
0x14 |
Data packet |
0x15 |
Ack packet |
0x80 |
General fail |
0x90 |
Bad protocol version |
0x91 |
Bad command |
0x92 |
Memory error |
0x93 |
Argument validation error |
0x94 |
Not implemented |
Byte in payload |
Length |
Field |
NRF register |
0 |
1 |
CONFIG |
00 |
1 |
1 |
EN_AA |
01 |
2 |
1 |
EN_RXADDR |
02 |
3 |
1 |
SETUP_AW |
03 |
4 |
1 |
SETUP_RETR |
04 |
5 |
1 |
RF_CH |
05 |
6 |
1 |
RF_SETUP |
06 |
7 |
1 |
STATUS |
07 |
8 |
1 |
OBSERVE_TX |
08 |
9 |
1 |
RPD |
09 |
a |
1 |
RX_PW_P0 |
11 |
b |
1 |
RX_PW_P1 |
12 |
c |
1 |
RX_PW_P2 |
13 |
d |
1 |
RX_PW_P3 |
14 |
e |
1 |
RX_PW_P4 |
15 |
f |
1 |
RX_PW_P5 |
16 |
10 |
1 |
FIFO_STATUS |
17 |
11 |
1 |
DYNPD |
1C |
12 |
1 |
FEATURE |
1D |
13 |
1 |
RF packets number in buffer |
--- |
Byte in payload |
Length |
Field |
NRF register |
0 |
5 |
RX_ADDR_P0 |
0A |
5 |
5 |
RX_ADDR_P1 |
0B |
a |
1 |
RX_ADDR_P2 |
0C |
b |
1 |
RX_ADDR_P3 |
0D |
c |
1 |
RX_ADDR_P4 |
0E |
d |
1 |
RX_ADDR_P5 |
0F |
e |
5 |
TX_ADDR |
10 |
Add new comment