]>
Commit | Line | Data |
---|---|---|
1 | ------------------------------------------------------------------------------- | |
2 | nRF24L01/nRF24L01+ | |
3 | ------------------------------------------------------------------------------- | |
4 | ||
5 | This directory contains a capture of the communication between two nRF24L01+ | |
6 | transceivers, one connected to a Raspberry Pi and the other connected to an | |
7 | AVR microcontroller, and some generated files to test paths in the protocol | |
8 | decoder that aren't covered in the capture. | |
9 | ||
10 | ||
11 | nrf24l01-communication.sr | |
12 | ------------------------- | |
13 | ||
14 | Logic analyzer setup | |
15 | -------------------- | |
16 | ||
17 | The logic analyzer used was a Lcsoft Mini Board (at 12MHz): | |
18 | ||
19 | Probe Description | |
20 | --------------------------- | |
21 | PB0 (TRG) used to trigger the logic analyzer | |
22 | PB1 (rpi_CSN) chip select signal of the receiving chip, active low | |
23 | PB2 (rpi_CLK) clock signal of the receiving chip | |
24 | PB3 (rpi_MOSI) MOSI signal of the receiving chip | |
25 | PB4 (rpi_MISO) MISO signal of the receiving chip | |
26 | PB5 (rpi_IRQ) interrupt signal for the receiving chip, active low | |
27 | PD0 (uc_CSN) chip select signal of the sending chip, active low | |
28 | PD1 (uc_CLK) clock signal of the sending chip | |
29 | PD2 (uc_MOSI) MOSI signal of the sending chip | |
30 | PD3 (uc_MISO) MISO signal of the sending chip | |
31 | ||
32 | Note that the nRF24L01(+) chips have two chip select pins, "CE" used to | |
33 | control the standby mode, and "CSN" used for SPI communication. This capture | |
34 | only contains the "CSN" signals of the two chips. | |
35 | ||
36 | Data | |
37 | ---- | |
38 | ||
39 | The sigrok command line used was: | |
40 | ||
41 | sigrok-cli --driver fx2lafw --config samplerate=12M \ | |
42 | -p '0=TRG,1=rpi_CSN,2=rpi_CLK,3=rpi_MOSI,4=rpi_MISO,5=rpi_IRQ,8=uc_CSN,9=uc_CLK,10=uc_MOSI,11=uc_MISO' \ | |
43 | -t TRG=0 --time 140 -o nrf24l01-communication.sr | |
44 | ||
45 | The capture starts with the Raspberry Pi initializing its chip as a receiver, | |
46 | followed by the microcontroller initializing the second chip as a transmitter | |
47 | at about 8.8ms - 9ms. 30ms after the start of the capture, the microcontroller | |
48 | starts sending the strings "message #0" to "message #9" in intervals of about | |
49 | 10ms. After sending a message, it uses polling to detect when the message is | |
50 | sent and the acknowledge from the receiver is received. The Raspberry Pi handles | |
51 | the first six messages after the receiving chip asserts the interrupt signal. | |
52 | Because it doesn't handle the other four messages and the receive FIFO in the | |
53 | receiver runs full after three messages, the last message isn't acknowledged. | |
54 | The sender detects that and reads the lost packet counter from the sender chip, | |
55 | which consequently has a value of one. | |
56 | ||
57 | ||
58 | nrf24l01-communication-[rx|tx].sr | |
59 | --------------------------------- | |
60 | ||
61 | These files were generated from the file 'nrf24l01-communication.sr' using | |
62 | the commands | |
63 | ||
64 | sigrok-cli -i nrf24l01-communication.sr -O csv | \ | |
65 | awk -F , '{if (NR > 3) {print $2","$3","$4","$5}}' | \ | |
66 | sigrok-cli -i /dev/fd/0 -I csv:samplerate=12M -o nrf24l01-communication-rx.sr | |
67 | ||
68 | and | |
69 | ||
70 | sigrok-cli -i nrf24l01-communication.sr -O csv | \ | |
71 | awk -F , '{if (NR > 3) {print $7","$8","$9","$10}}' | \ | |
72 | sigrok-cli -i /dev/fd/0 -I csv:samplerate=12M -o nrf24l01-communication-tx.sr | |
73 | ||
74 | respectively, because apparently the pdtest/runtc tools don't support capture | |
75 | files with extra channels. The files are then used to check if the protocol | |
76 | decoder correctly decodes the message payload. | |
77 | ||
78 | ||
79 | nrf24l01-test-... | |
80 | ----------------- | |
81 | ||
82 | These files were generated by the 'gen-testfiles.py' script and contain test | |
83 | cases for the decoder that aren't yet covered by the other captures. | |
84 | ||
85 | ...-activate.sr: Tests decoding of the 'ACTIVATE' instruction. This | |
86 | instruction is only valid for the nRF24L01 chips | |
87 | (without the plus) and is therefore not in the | |
88 | communication dump. | |
89 | ||
90 | ...-excess-bytes.sr: Used to check if the protocol decoder correctly | |
91 | recognizes and reports superfluous bytes after the | |
92 | commands. | |
93 | ||
94 | ...-misc.sr: Contains checks for the instructions 'REUSE_TX_PL', | |
95 | 'R_RX_PL_WID', and 'W_ACK_PAYLOAD', that aren't | |
96 | covered by the other dumps. | |
97 | ||
98 | ...-missing-bytes.sr: Used to check if the protocol decoder correctly | |
99 | recognizes and reports missing bytes after the | |
100 | commands. | |
101 | ||
102 | ...-no-command.sr: Used to check if the protocol decoder correctly | |
103 | handles empty commands. | |
104 | ||
105 | ...-unknown-command.sr: Used to check if the protocol decoder correctly | |
106 | recognizes commands that do not exist. | |
107 | ||
108 | ...-unknown-register.sr: Contains a 'R_REGISTER' (read register) instruction | |
109 | of a non-existing register. |