README.md
1# RCP Capabilities Test
2
3This test is used for testing RCP capabilities.
4
5## Test Topology
6
7```
8 +-------+
9 +---------------| PC |----------------+
10 | +-------+ |
11 | ADB/SSH | ADB/SSH/SERIAL
12 | |
13+-------+ +------------------+
14| DUT |<-----------Thread-------->| Reference Device |
15+-------+ +------------------+
16
17```
18
19- PC : The computer to run the test script.
20- DUT : The device under test.
21- Reference Device : The device that supports all tested features.
22
23### Python Dependences
24
25Before running the test script on PC, testers should install dependences first.
26
27```bash
28$ pip3 install -r ./tools/cp-caps/requirements.txt ./tools/otci
29```
30
31### Reference Device
32
33The [nRF52840DK][ot-nrf528xx-nrf52840] is set as the reference device by default. Testers can also select the other Thread device as the reference device.
34
35[ot-nrf528xx-nrf52840]: https://github.com/openthread/ot-nrf528xx/blob/main/src/nrf52840/README.md
36
37Quick guide to setting up the nRF52840DK:
38
39```bash
40$ git clone git@github.com:openthread/ot-nrf528xx.git
41$ cd ot-nrf528xx/
42$ git submodule update --init
43$ ./script/bootstrap
44$ ./script/build nrf52840 UART_trans -DOT_DIAGNOSTIC=ON -DOT_CSL_RECEIVER=ON -DOT_LINK_METRICS_INITIATOR=ON -DOT_LINK_METRICS_SUBJECT=ON
45$ arm-none-eabi-objcopy -O ihex build/bin/ot-cli-ftd ot-cli-ftd.hex
46$ nrfjprog -f nrf52 --chiperase --program ot-cli-ftd.hex --reset
47```
48
49## Test Commands
50
51### Help
52
53Show help info.
54
55```bash
56$ python3 ./tools/cp-caps/rcp_caps_test.py -h
57usage: rcp_caps_test.py [-h] [-c] [-l] [-d] [-f] [-p] [-t] [-v] [-D]
58
59This script is used for testing RCP capabilities.
60
61options:
62 -h, --help show this help message and exit
63 -c, --csl test whether the RCP supports CSL transmitter
64 -l, --link-metrics test whether the RCP supports link metrics
65 -d, --diag-commands test whether the RCP supports all diag commands
66 -f, --frame-format test whether the RCP supports 802.15.4 frames of all formats
67 -p, --data-poll test whether the RCP supports data poll
68 -t, --throughput test Thread network 1-hop throughput
69 -v, --version output version
70 -D, --debug output debug information
71
72Device Interfaces:
73 DUT_ADB_TCP=<device_ip> Connect to the DUT via adb tcp
74 DUT_ADB_USB=<serial_number> Connect to the DUT via adb usb
75 DUT_CLI_SERIAL=<serial_device> Connect to the DUT via cli serial port
76 DUT_SSH=<device_ip> Connect to the DUT via ssh
77 REF_ADB_USB=<serial_number> Connect to the reference device via adb usb
78 REF_CLI_SERIAL=<serial_device> Connect to the reference device via cli serial port
79 REF_SSH=<device_ip> Connect to the reference device via ssh
80
81Example:
82 DUT_ADB_USB=1169UC2F2T0M95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 ./tools/cp-caps/rcp_caps_test.py -d
83```
84
85### Test Diag Commands
86
87The option `-d` or `--diag-commands` tests all diag commands.
88
89Following environment variables are used to configure diag command parameters:
90
91- DUT_DIAG_GPIO: Diag gpio value. The default value is `0` if it is not set.
92- DUT_DIAG_RAW_POWER_SETTING: Diag raw power setting value. The default value is `112233` if it is not set.
93- DUT_DIAG_POWER: Diag power value. The default value is `10` if it is not set.
94
95> Note: If you meet the error `LIBUSB_ERROR_BUSY` when you are using the ADB usb interface, please run the command `adb kill-server` to kill the adb server.
96
97```bash
98$ DUT_ADB_USB=1269UCKFZTAM95OR REF_CLI_SERIAL=/dev/ttyACM0 DUT_DIAG_GPIO=2 DUT_DIAG_RAW_POWER_SETTING=44556688 DUT_DIAG_POWER=11 python3 ./tools/cp-caps/rcp_caps_test.py -d
99diag channel --------------------------------------------- OK
100diag channel 20 ------------------------------------------ OK
101diag power ----------------------------------------------- OK
102diag power 11 -------------------------------------------- OK
103diag radio sleep ----------------------------------------- OK
104diag radio receive --------------------------------------- OK
105diag radio state ----------------------------------------- OK
106diag repeat 10 64 ---------------------------------------- OK
107diag repeat stop ----------------------------------------- OK
108diag send 100 64 ----------------------------------------- OK
109diag stats ----------------------------------------------- OK
110diag stats clear ----------------------------------------- OK
111diag frame 00010203040506070809 -------------------------- OK
112diag echo 0123456789 ------------------------------------- OK
113diag echo -n 10 ------------------------------------------ OK
114diag cw start -------------------------------------------- OK
115diag cw stop --------------------------------------------- OK
116diag stream start ---------------------------------------- OK
117diag stream stop ----------------------------------------- OK
118diag stats ----------------------------------------------- OK
119diag stats clear ----------------------------------------- OK
120diag rawpowersetting enable ------------------------------ NotSupported
121diag rawpowersetting 44556688 ---------------------------- NotSupported
122diag rawpowersetting ------------------------------------- NotSupported
123diag rawpowersetting disable ----------------------------- NotSupported
124diag powersettings --------------------------------------- NotSupported
125diag powersettings 20 ------------------------------------ NotSupported
126diag gpio mode 2 ----------------------------------------- NotSupported
127diag gpio mode 2 in -------------------------------------- NotSupported
128diag gpio mode 2 out ------------------------------------- NotSupported
129diag gpio get 2 ------------------------------------------ NotSupported
130diag gpio set 2 0 ---------------------------------------- NotSupported
131diag gpio set 2 1 ---------------------------------------- NotSupported
132```
133
134### Test CSL Transmitter
135
136The option `-c` or `--csl` tests whether the RCP supports the CSL transmitter.
137
138```bash
139$ DUT_ADB_USB=TW69UCKFZTGM95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 ./tools/cp-caps/rcp_caps_test.py -c
140CSL Transmitter ------------------------------------------ OK
141```
142
143### Test Data Poll
144
145The option `-p` or `--data-poll` tests whether the RCP supports data poll.
146
147```bash
148$ DUT_ADB_USB=1269UCKFZTAM95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 ./tools/cp-caps/rcp_caps_test.py -p
149Data Poll Parent ----------------------------------------- OK
150Data Poll Child ------------------------------------------ OK
151```
152
153### Test Link Metrics
154
155The option `-l` or `--link-metrics` tests whether the RCP supports link metrics.
156
157```bash
158$ DUT_ADB_USB=1269UCKFZTAM95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 ./tools/cp-caps/rcp_caps_test.py -l
159Link Metrics Initiator ----------------------------------- OK
160Link Metrics Subject ------------------------------------- OK
161```
162
163### Test Throughput
164
165The option `-t` or `--throughput` tests the Thread network 1-hop throughput of the DUT.
166
167```bash
168$ DUT_ADB_USB=1269UCKFZTAM95OR REF_ADB_USB=44061HFAG01AQK python3 ./tools/cp-caps/rcp_caps_test.py -t
169Throughput ----------------------------------------------- 75.6 Kbits/sec
170```
171
172### Test Frame Format
173
174The option `-f` or `--frame-format` tests whether the RCP supports sending and receiving 802.15.4 frames of all formats.
175
176```bash
177$ DUT_ADB_USB=1269UCKFZTAM95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 ./tools/cp-caps/rcp_caps_test.py -f
178TX ver:2003,Cmd,seq,dst[addr:short,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 ----------------- OK
179RX ver:2003,Cmd,seq,dst[addr:short,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 ----------------- OK
180TX ver:2003,Bcon,seq,dst[addr:no,pan:no],src[addr:extd,pan:id],sec:no,ie:no,plen:30 ---------------- OK
181RX ver:2003,Bcon,seq,dst[addr:no,pan:no],src[addr:extd,pan:id],sec:no,ie:no,plen:30 ---------------- OK
182TX ver:2006,Cmd,seq,dst[addr:short,pan:id],src[addr:short,pan:no],sec:l5,ie:no,plen:0 -------------- OK
183RX ver:2006,Cmd,seq,dst[addr:short,pan:id],src[addr:short,pan:no],sec:l5,ie:no,plen:0 -------------- OK
184TX ver:2006,Cmd,seq,dst[addr:extd,pan:id],src[addr:extd,pan:no],sec:l5,ie:no,plen:0 ---------------- OK
185RX ver:2006,Cmd,seq,dst[addr:extd,pan:id],src[addr:extd,pan:no],sec:l5,ie:no,plen:0 ---------------- OK
186TX ver:2006,Data,seq,dst[addr:extd,pan:id],src[addr:extd,pan:id],sec:no,ie:no,plen:0 --------------- OK
187RX ver:2006,Data,seq,dst[addr:extd,pan:id],src[addr:extd,pan:id],sec:no,ie:no,plen:0 --------------- OK
188TX ver:2006,Data,seq,dst[addr:short,pan:id],src[addr:short,pan:id],sec:no,ie:no,plen:0 ------------- OK
189RX ver:2006,Data,seq,dst[addr:short,pan:id],src[addr:short,pan:id],sec:no,ie:no,plen:0 ------------- OK
190TX ver:2006,Data,seq,dst[addr:extd,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 ----------------- OK
191RX ver:2006,Data,seq,dst[addr:extd,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 ----------------- OK
192TX ver:2006,Data,seq,dst[addr:short,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 ---------------- OK
193RX ver:2006,Data,seq,dst[addr:short,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 ---------------- OK
194TX ver:2015,Data,seq,dst[addr:no,pan:no],src[addr:no,pan:no],sec:no,ie:no,plen:0 ------------------- OK
195RX ver:2015,Data,seq,dst[addr:no,pan:no],src[addr:no,pan:no],sec:no,ie:no,plen:0 ------------------- OK
196TX ver:2015,Data,seq,dst[addr:no,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 ------------------- OK
197RX ver:2015,Data,seq,dst[addr:no,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 ------------------- OK
198TX ver:2015,Data,seq,dst[addr:extd,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 ----------------- OK
199RX ver:2015,Data,seq,dst[addr:extd,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 ----------------- OK
200TX ver:2015,Data,seq,dst[addr:extd,pan:no],src[addr:no,pan:no],sec:no,ie:no,plen:0 ----------------- OK
201RX ver:2015,Data,seq,dst[addr:extd,pan:no],src[addr:no,pan:no],sec:no,ie:no,plen:0 ----------------- OK
202TX ver:2015,Data,seq,dst[addr:no,pan:no],src[addr:extd,pan:id],sec:no,ie:no,plen:0 ----------------- OK
203RX ver:2015,Data,seq,dst[addr:no,pan:no],src[addr:extd,pan:id],sec:no,ie:no,plen:0 ----------------- OK
204TX ver:2015,Data,seq,dst[addr:no,pan:no],src[addr:extd,pan:no],sec:no,ie:no,plen:0 ----------------- OK
205RX ver:2015,Data,seq,dst[addr:no,pan:no],src[addr:extd,pan:no],sec:no,ie:no,plen:0 ----------------- OK
206TX ver:2015,Data,seq,dst[addr:extd,pan:id],src[addr:extd,pan:no],sec:no,ie:no,plen:0 --------------- OK
207RX ver:2015,Data,seq,dst[addr:extd,pan:id],src[addr:extd,pan:no],sec:no,ie:no,plen:0 --------------- OK
208TX ver:2015,Data,seq,dst[addr:extd,pan:no],src[addr:extd,pan:no],sec:no,ie:no,plen:0 --------------- OK
209RX ver:2015,Data,seq,dst[addr:extd,pan:no],src[addr:extd,pan:no],sec:no,ie:no,plen:0 --------------- OK
210TX ver:2015,Data,seq,dst[addr:short,pan:id],src[addr:short,pan:id],sec:no,ie:no,plen:0 ------------- OK
211RX ver:2015,Data,seq,dst[addr:short,pan:id],src[addr:short,pan:id],sec:no,ie:no,plen:0 ------------- OK
212TX ver:2015,Data,seq,dst[addr:short,pan:id],src[addr:extd,pan:id],sec:no,ie:no,plen:0 -------------- OK
213RX ver:2015,Data,seq,dst[addr:short,pan:id],src[addr:extd,pan:id],sec:no,ie:no,plen:0 -------------- OK
214TX ver:2015,Data,seq,dst[addr:extd,pan:id],src[addr:short,pan:id],sec:no,ie:no,plen:0 -------------- OK
215RX ver:2015,Data,seq,dst[addr:extd,pan:id],src[addr:short,pan:id],sec:no,ie:no,plen:0 -------------- OK
216TX ver:2015,Data,seq,dst[addr:short,pan:id],src[addr:short,pan:id],sec:no,ie[csl],plen:0 ----------- OK
217RX ver:2015,Data,seq,dst[addr:short,pan:id],src[addr:short,pan:id],sec:no,ie[csl],plen:0 ----------- OK
218TX ver:2015,Data,noseq,dst[addr:short,pan:id],src[addr:short,pan:id],sec:no,ie:no,plen:0 ----------- OK
219RX ver:2015,Data,noseq,dst[addr:short,pan:id],src[addr:short,pan:id],sec:no,ie:no,plen:0 ----------- OK
220```
221