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 -DOT_WAKEUP_COORDINATOR=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 Info
52
53```bash
54usage: [device configurations] python3 -m unittest -q [test cases]
55
56This unittest is used for testing RCP capabilities.
57
58Device configurations:
59 ADB_KEY=<adb_key> Full path to the adb key
60 DEBUG=on Enable the debug information
61 DUT_ADB_TCP=<device_ip> Connect to the DUT via adb tcp
62 DUT_ADB_USB=<serial_number> Connect to the DUT via adb usb
63 DUT_CLI_SERIAL=<serial_device> Connect to the DUT via cli serial port
64 DUT_SSH=<device_ip> Connect to the DUT via ssh
65 REF_ADB_USB=<serial_number> Connect to the reference device via adb usb
66 REF_CLI_SERIAL=<serial_device> Connect to the reference device via cli serial port
67 REF_SSH=<device_ip> Connect to the reference device via ssh
68
69Test cases:
70 test_csl test whether the RCP supports CSL transmitter
71 test_data_poll test whether the RCP supports data poll
72 test_diag_commands test whether the RCP supports all diag commands
73 test_frame_formats test whether the RCP supports 802.15.4 frames of all formats
74 test_link_metrics test whether the RCP supports link metrics
75 test_radio_frame_tx_info test mTxInfo field of the radio frame
76 test_throughput test Thread network 1-hop throughput
77
78Examples:
79
80Run test cases of the specified categories:
81 DUT_ADB_USB=1169UC2F2T0M95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 -m unittest -q test_csl test_data_poll
82
83Run all test cases:
84 DUT_ADB_USB=1169UC2F2T0M95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 -m unittest discover -q -s ./ -p 'test_*.py'
85
86Run specified test case:
87 DUT_ADB_USB=1169UC2F2T0M95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 -m unittest -q test_diag_commands.TestDiagCommands.test_diag_channel
88
89These commands should be run in the path `tools/cp-caps`.
90```
91
92> Note: If you get an error of `LIBUSB_ERROR_BUSY` when you are using the ADB USB interface, please run the command `adb kill-server` to kill the ADB server.
93
94### Test Diag Commands
95
96The test case `test_diag_commands` tests all diag commands.
97
98Following environment variables are used to configure diag command parameters:
99
100- DUT_DIAG_GPIO: Diag gpio value. The default value is `0` if it is not set.
101- DUT_DIAG_RAW_POWER_SETTING: Diag raw power setting value. The default value is `112233` if it is not set.
102- DUT_DIAG_POWER: Diag power value. The default value is `10` if it is not set.
103
104```bash
105tools/cp-caps$ DUT_ADB_USB=1269UCKFZTAM95OR REF_CLI_SERIAL=/dev/ttyACM0 DUT_DIAG_GPIO=2 DUT_DIAG_RAW_POWER_SETTING=44556688 DUT_DIAG_POWER=11 python3 -m unittest -q test_diag_commands
106diag channel --------------------------------------------- OK
107diag channel 20 ------------------------------------------ OK
108diag cw start -------------------------------------------- OK
109diag cw stop --------------------------------------------- OK
110diag echo 0123456789 ------------------------------------- OK
111diag echo -n 10 ------------------------------------------ OK
112diag frame 00010203040506070809 -------------------------- OK
113diag gpio mode 2 ----------------------------------------- OK
114diag gpio mode 2 in -------------------------------------- OK
115diag gpio mode 2 out ------------------------------------- OK
116diag gpio get 2 ------------------------------------------ OK
117diag gpio set 2 0 ---------------------------------------- OK
118diag gpio set 2 1 ---------------------------------------- OK
119diag power ----------------------------------------------- OK
120diag power 11 -------------------------------------------- OK
121diag powersettings --------------------------------------- NotSupported
122diag powersettings 20 ------------------------------------ NotSupported
123diag radio receive --------------------------------------- OK
124diag radio sleep ----------------------------------------- OK
125diag radio state ----------------------------------------- OK
126diag rawpowersetting enable ------------------------------ NotSupported
127diag rawpowersetting 44556688 ---------------------------- NotSupported
128diag rawpowersetting ------------------------------------- NotSupported
129diag rawpowersetting disable ----------------------------- NotSupported
130diag repeat 10 64 ---------------------------------------- OK
131diag repeat stop ----------------------------------------- OK
132diag send 100 64 ----------------------------------------- OK
133diag stats ----------------------------------------------- OK
134diag stats clear ----------------------------------------- OK
135diag stream start ---------------------------------------- NotSupported
136diag stream stop ----------------------------------------- NotSupported
137```
138
139### Test CSL Transmitter
140
141The test case `test_csl` tests whether the RCP supports the CSL transmitter.
142
143```bash
144tools/cp-caps$ DUT_ADB_USB=TW69UCKFZTGM95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 -m unittest -q test_csl
145CSL Transmitter ------------------------------------------ OK
146```
147
148### Test Data Poll
149
150The test case `test_data_poll` tests whether the RCP supports data poll.
151
152```bash
153tools/cp-caps$ DUT_ADB_USB=TW69UCKFZTGM95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 -m unittest -q test_data_poll
154Data Poll Child ------------------------------------------ OK
155Data Poll Parent ----------------------------------------- OK
156```
157
158### Test Link Metrics
159
160The test case `test_link_metrics` tests whether the RCP supports link metrics.
161
162```bash
163tools/cp-caps$ DUT_ADB_USB=TW69UCKFZTGM95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 -m unittest -q test_link_metrics
164Link Metrics Initiator ----------------------------------- OK
165Link Metrics Subject ------------------------------------- OK
166```
167
168### Test Throughput
169
170The test case `test_throughput` tests the Thread network 1-hop throughput of the DUT.
171
172```bash
173tools/cp-caps$ DUT_ADB_USB=TW69UCKFZTGM95OR REF_ADB_USB=44061HFAG01AQK python3 -m unittest -q test_throughput
174Throughput ----------------------------------------------- 75.6 Kbits/sec
175```
176
177### Test Frame Format
178
179The test case `test_frame_formats` tests whether the RCP supports sending and receiving 802.15.4 frames of all formats.
180
181```bash
182tools/cp-caps$ DUT_ADB_USB=TW69UCKFZTGM95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 -m unittest -q test_frame_formats
1831 TX ver:2003,Cmd,seq,dst[addr:short,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 --------------- OK
1841 RX ver:2003,Cmd,seq,dst[addr:short,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 --------------- OK
1852 TX ver:2003,Bcon,seq,dst[addr:no,pan:no],src[addr:extd,pan:id],sec:no,ie:no,plen:30 -------------- OK
1862 RX ver:2003,Bcon,seq,dst[addr:no,pan:no],src[addr:extd,pan:id],sec:no,ie:no,plen:30 -------------- OK
1873 TX ver:2003,MP,noseq,dst[addr:extd,pan:id],src[addr:extd,pan:no],sec:l5,ie[ren con],plen:0 ------- OK
1883 RX ver:2003,MP,noseq,dst[addr:extd,pan:id],src[addr:extd,pan:no],sec:l5,ie[ren con],plen:0 ------- OK
1894 TX ver:2006,Cmd,seq,dst[addr:short,pan:id],src[addr:short,pan:no],sec:l5,ie:no,plen:0 ------------ OK
1904 RX ver:2006,Cmd,seq,dst[addr:short,pan:id],src[addr:short,pan:no],sec:l5,ie:no,plen:0 ------------ OK
1915 TX ver:2006,Cmd,seq,dst[addr:extd,pan:id],src[addr:extd,pan:no],sec:l5,ie:no,plen:0 -------------- OK
1925 RX ver:2006,Cmd,seq,dst[addr:extd,pan:id],src[addr:extd,pan:no],sec:l5,ie:no,plen:0 -------------- OK
1936 TX ver:2006,Data,seq,dst[addr:extd,pan:id],src[addr:extd,pan:id],sec:no,ie:no,plen:0 ------------- OK
1946 RX ver:2006,Data,seq,dst[addr:extd,pan:id],src[addr:extd,pan:id],sec:no,ie:no,plen:0 ------------- OK
1957 TX ver:2006,Data,seq,dst[addr:short,pan:id],src[addr:short,pan:id],sec:no,ie:no,plen:0 ----------- OK
1967 RX ver:2006,Data,seq,dst[addr:short,pan:id],src[addr:short,pan:id],sec:no,ie:no,plen:0 ----------- OK
1978 TX ver:2006,Data,seq,dst[addr:extd,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 --------------- OK
1988 RX ver:2006,Data,seq,dst[addr:extd,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 --------------- OK
1999 TX ver:2006,Data,seq,dst[addr:short,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 -------------- OK
2009 RX ver:2006,Data,seq,dst[addr:short,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 -------------- OK
20110 TX ver:2015,Data,seq,dst[addr:no,pan:no],src[addr:no,pan:no],sec:no,ie:no,plen:0 ---------------- OK
20210 RX ver:2015,Data,seq,dst[addr:no,pan:no],src[addr:no,pan:no],sec:no,ie:no,plen:0 ---------------- OK
20311 TX ver:2015,Data,seq,dst[addr:no,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 ---------------- OK
20411 RX ver:2015,Data,seq,dst[addr:no,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 ---------------- OK
20512 TX ver:2015,Data,seq,dst[addr:extd,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 -------------- OK
20612 RX ver:2015,Data,seq,dst[addr:extd,pan:id],src[addr:no,pan:no],sec:no,ie:no,plen:0 -------------- OK
20713 TX ver:2015,Data,seq,dst[addr:extd,pan:no],src[addr:no,pan:no],sec:no,ie:no,plen:0 -------------- OK
20813 RX ver:2015,Data,seq,dst[addr:extd,pan:no],src[addr:no,pan:no],sec:no,ie:no,plen:0 -------------- OK
20914 TX ver:2015,Data,seq,dst[addr:no,pan:no],src[addr:extd,pan:id],sec:no,ie:no,plen:0 -------------- OK
21014 RX ver:2015,Data,seq,dst[addr:no,pan:no],src[addr:extd,pan:id],sec:no,ie:no,plen:0 -------------- OK
21115 TX ver:2015,Data,seq,dst[addr:no,pan:no],src[addr:extd,pan:no],sec:no,ie:no,plen:0 -------------- OK
21215 RX ver:2015,Data,seq,dst[addr:no,pan:no],src[addr:extd,pan:no],sec:no,ie:no,plen:0 -------------- OK
21316 TX ver:2015,Data,seq,dst[addr:extd,pan:id],src[addr:extd,pan:no],sec:no,ie:no,plen:0 ------------ OK
21416 RX ver:2015,Data,seq,dst[addr:extd,pan:id],src[addr:extd,pan:no],sec:no,ie:no,plen:0 ------------ OK
21517 TX ver:2015,Data,seq,dst[addr:extd,pan:no],src[addr:extd,pan:no],sec:no,ie:no,plen:0 ------------ OK
21617 RX ver:2015,Data,seq,dst[addr:extd,pan:no],src[addr:extd,pan:no],sec:no,ie:no,plen:0 ------------ OK
21718 TX ver:2015,Data,seq,dst[addr:short,pan:id],src[addr:short,pan:id],sec:no,ie:no,plen:0 ---------- OK
21818 RX ver:2015,Data,seq,dst[addr:short,pan:id],src[addr:short,pan:id],sec:no,ie:no,plen:0 ---------- OK
21919 TX ver:2015,Data,seq,dst[addr:short,pan:id],src[addr:extd,pan:id],sec:no,ie:no,plen:0 ----------- OK
22019 RX ver:2015,Data,seq,dst[addr:short,pan:id],src[addr:extd,pan:id],sec:no,ie:no,plen:0 ----------- OK
22120 TX ver:2015,Data,seq,dst[addr:extd,pan:id],src[addr:short,pan:id],sec:no,ie:no,plen:0 ----------- OK
22220 RX ver:2015,Data,seq,dst[addr:extd,pan:id],src[addr:short,pan:id],sec:no,ie:no,plen:0 ----------- OK
22321 TX ver:2015,Data,seq,dst[addr:short,pan:id],src[addr:short,pan:id],sec:no,ie[csl],plen:0 -------- OK
22421 RX ver:2015,Data,seq,dst[addr:short,pan:id],src[addr:short,pan:id],sec:no,ie[csl],plen:0 -------- OK
22522 TX ver:2015,Data,noseq,dst[addr:short,pan:id],src[addr:short,pan:id],sec:no,ie:no,plen:0 -------- OK
22622 RX ver:2015,Data,noseq,dst[addr:short,pan:id],src[addr:short,pan:id],sec:no,ie:no,plen:0 -------- OK
227```
228
229### Test mTxInfo field of the radio frame.
230
231The test case `test_radio_frame_tx_info` tests whether the RCP supports the mTxInfo field of the radio frame.
232
233```bash
234tools/cp-caps$ DUT_ADB_USB=TW69UCKFZTGM95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 -m unittest -q test_radio_frame_tx_info
235mCsmaCaEnabled=0 ----------------------------------------- OK
236mCsmaCaEnabled=1 ----------------------------------------- OK
237mIsSecurityProcessed=True -------------------------------- OK
238mIsSecurityProcessed=False ------------------------------- OK
239mMaxCsmaBackoffs=0 --------------------------------------- OK (12 ms)
240mMaxCsmaBackoffs=100 ------------------------------------- OK (541 ms)
241mRxChannelAfterTxDone ------------------------------------ OK
242mTxDelayBaseTime=now,mTxDelay=500000 --------------------- OK
243```
244