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] [-d] [-p] [-t] [-v]
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 -d, --diag-commands test whether the RCP supports all diag commands
65 -l, --link-metrics test whether the RCP supports link metrics
66 -p, --data-poll test whether the RCP supports data poll
67 -t, --throughput test the Thread network 1-hop throughput
68 -v, --verbose output verbose information
69
70Device Interfaces:
71 DUT_SSH=<device_ip> Connect to the DUT via ssh
72 DUT_ADB_TCP=<device_ip> Connect to the DUT via adb tcp
73 DUT_ADB_USB=<serial_number> Connect to the DUT via adb usb
74 REF_CLI_SERIAL=<serial_device> Connect to the reference device via cli serial port
75 REF_ADB_USB=<serial_number> Connect to the reference device via adb usb
76 REF_SSH=<device_ip> Connect to the reference device via ssh
77
78Example:
79 DUT_ADB_USB=1169UC2F2T0M95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 ./tools/cp-caps/rcp_caps_test.py -d
80```
81
82### Test Diag Commands
83
84The parameter `-d` or `--diag-commands` starts to test all diag commands.
85
86Following environment variables are used to configure diag command parameters:
87
88- DUT_DIAG_GPIO: Diag gpio value. The default value is `0` if it is not set.
89- DUT_DIAG_RAW_POWER_SETTING: Diag raw power setting value. The default value is `112233` if it is not set.
90- DUT_DIAG_POWER: Diag power value. The default value is `10` if it is not set.
91
92> 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.
93
94```bash
95$ 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
96diag channel --------------------------------------------- OK
97diag channel 20 ------------------------------------------ OK
98diag power ----------------------------------------------- OK
99diag power 11 -------------------------------------------- OK
100diag radio sleep ----------------------------------------- OK
101diag radio receive --------------------------------------- OK
102diag radio state ----------------------------------------- OK
103diag repeat 10 64 ---------------------------------------- OK
104diag repeat stop ----------------------------------------- OK
105diag send 100 64 ----------------------------------------- OK
106diag stats ----------------------------------------------- OK
107diag stats clear ----------------------------------------- OK
108diag frame 00010203040506070809 -------------------------- OK
109diag echo 0123456789 ------------------------------------- OK
110diag echo -n 10 ------------------------------------------ OK
111diag cw start -------------------------------------------- OK
112diag cw stop --------------------------------------------- OK
113diag stream start ---------------------------------------- OK
114diag stream stop ----------------------------------------- OK
115diag stats ----------------------------------------------- OK
116diag stats clear ----------------------------------------- OK
117diag rawpowersetting enable ------------------------------ NotSupported
118diag rawpowersetting 44556688 ---------------------------- NotSupported
119diag rawpowersetting ------------------------------------- NotSupported
120diag rawpowersetting disable ----------------------------- NotSupported
121diag powersettings --------------------------------------- NotSupported
122diag powersettings 20 ------------------------------------ NotSupported
123diag gpio mode 2 ----------------------------------------- NotSupported
124diag gpio mode 2 in -------------------------------------- NotSupported
125diag gpio mode 2 out ------------------------------------- NotSupported
126diag gpio get 2 ------------------------------------------ NotSupported
127diag gpio set 2 0 ---------------------------------------- NotSupported
128diag gpio set 2 1 ---------------------------------------- NotSupported
129```
130
131### Test CSL Transmitter
132
133The parameter `-c` or `--csl` starts to test whether the RCP supports the CSL transmitter.
134
135```bash
136$ DUT_ADB_USB=TW69UCKFZTGM95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 ./tools/cp-caps/rcp_caps_test.py -c
137CSL Transmitter ------------------------------------------ OK
138```
139
140### Test Data Poll
141
142The parameter `-p` or `--data-poll` starts to test whether the RCP supports data poll.
143
144```bash
145$ DUT_ADB_USB=1269UCKFZTAM95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 ./tools/cp-caps/rcp_caps_test.py -p
146Data Poll Parent ----------------------------------------- OK
147Data Poll Child ------------------------------------------ OK
148```
149
150### Test Link Metrics
151
152The parameter `-l` or `--link-metrics` starts to test whether the RCP supports link metrics.
153
154```bash
155$ DUT_ADB_USB=1269UCKFZTAM95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 ./tools/cp-caps/rcp_caps_test.py -l
156Link Metrics Initiator ----------------------------------- OK
157Link Metrics Subject ------------------------------------- OK
158```
159
160### Test Throughput
161
162The parameter `-t` or `--throughput` starts to test the Thread network 1-hop throughput of the DUT.
163
164```bash
165$ DUT_ADB_USB=1269UCKFZTAM95OR REF_ADB_USB=44061HFAG01AQK python3 ./tools/cp-caps/rcp_caps_test.py -t
166Throughput ----------------------------------------------- 75.6 Kbits/sec
167```
168