xref: /aosp_15_r20/external/openthread/tools/cp-caps/README.md (revision cfb92d1480a9e65faed56933e9c12405f45898b4)
1*cfb92d14SAndroid Build Coastguard Worker# RCP Capabilities Test
2*cfb92d14SAndroid Build Coastguard Worker
3*cfb92d14SAndroid Build Coastguard WorkerThis test is used for testing RCP capabilities.
4*cfb92d14SAndroid Build Coastguard Worker
5*cfb92d14SAndroid Build Coastguard Worker## Test Topology
6*cfb92d14SAndroid Build Coastguard Worker
7*cfb92d14SAndroid Build Coastguard Worker```
8*cfb92d14SAndroid Build Coastguard Worker                    +-------+
9*cfb92d14SAndroid Build Coastguard Worker    +---------------|  PC   |----------------+
10*cfb92d14SAndroid Build Coastguard Worker    |               +-------+                |
11*cfb92d14SAndroid Build Coastguard Worker    | ADB/SSH                                | ADB/SSH/SERIAL
12*cfb92d14SAndroid Build Coastguard Worker    |                                        |
13*cfb92d14SAndroid Build Coastguard Worker+-------+                           +------------------+
14*cfb92d14SAndroid Build Coastguard Worker|  DUT  |<-----------Thread-------->| Reference Device |
15*cfb92d14SAndroid Build Coastguard Worker+-------+                           +------------------+
16*cfb92d14SAndroid Build Coastguard Worker
17*cfb92d14SAndroid Build Coastguard Worker```
18*cfb92d14SAndroid Build Coastguard Worker
19*cfb92d14SAndroid Build Coastguard Worker- PC : The computer to run the test script.
20*cfb92d14SAndroid Build Coastguard Worker- DUT : The device under test.
21*cfb92d14SAndroid Build Coastguard Worker- Reference Device : The device that supports all tested features.
22*cfb92d14SAndroid Build Coastguard Worker
23*cfb92d14SAndroid Build Coastguard Worker### Python Dependences
24*cfb92d14SAndroid Build Coastguard Worker
25*cfb92d14SAndroid Build Coastguard WorkerBefore running the test script on PC, testers should install dependences first.
26*cfb92d14SAndroid Build Coastguard Worker
27*cfb92d14SAndroid Build Coastguard Worker```bash
28*cfb92d14SAndroid Build Coastguard Worker$ pip3 install -r ./tools/cp-caps/requirements.txt ./tools/otci
29*cfb92d14SAndroid Build Coastguard Worker```
30*cfb92d14SAndroid Build Coastguard Worker
31*cfb92d14SAndroid Build Coastguard Worker### Reference Device
32*cfb92d14SAndroid Build Coastguard Worker
33*cfb92d14SAndroid Build Coastguard WorkerThe [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*cfb92d14SAndroid Build Coastguard Worker
35*cfb92d14SAndroid Build Coastguard Worker[ot-nrf528xx-nrf52840]: https://github.com/openthread/ot-nrf528xx/blob/main/src/nrf52840/README.md
36*cfb92d14SAndroid Build Coastguard Worker
37*cfb92d14SAndroid Build Coastguard WorkerQuick guide to setting up the nRF52840DK:
38*cfb92d14SAndroid Build Coastguard Worker
39*cfb92d14SAndroid Build Coastguard Worker```bash
40*cfb92d14SAndroid Build Coastguard Worker$ git clone [email protected]:openthread/ot-nrf528xx.git
41*cfb92d14SAndroid Build Coastguard Worker$ cd ot-nrf528xx/
42*cfb92d14SAndroid Build Coastguard Worker$ git submodule update --init
43*cfb92d14SAndroid Build Coastguard Worker$ ./script/bootstrap
44*cfb92d14SAndroid Build Coastguard Worker$ ./script/build nrf52840 UART_trans -DOT_DIAGNOSTIC=ON -DOT_CSL_RECEIVER=ON -DOT_LINK_METRICS_INITIATOR=ON -DOT_LINK_METRICS_SUBJECT=ON
45*cfb92d14SAndroid Build Coastguard Worker$ arm-none-eabi-objcopy -O ihex build/bin/ot-cli-ftd ot-cli-ftd.hex
46*cfb92d14SAndroid Build Coastguard Worker$ nrfjprog -f nrf52 --chiperase --program ot-cli-ftd.hex --reset
47*cfb92d14SAndroid Build Coastguard Worker```
48*cfb92d14SAndroid Build Coastguard Worker
49*cfb92d14SAndroid Build Coastguard Worker## Test Commands
50*cfb92d14SAndroid Build Coastguard Worker
51*cfb92d14SAndroid Build Coastguard Worker### Help
52*cfb92d14SAndroid Build Coastguard Worker
53*cfb92d14SAndroid Build Coastguard WorkerShow help info.
54*cfb92d14SAndroid Build Coastguard Worker
55*cfb92d14SAndroid Build Coastguard Worker```bash
56*cfb92d14SAndroid Build Coastguard Worker$ python3 ./tools/cp-caps/rcp_caps_test.py -h
57*cfb92d14SAndroid Build Coastguard Workerusage: rcp_caps_test.py [-h] [-c] [-d] [-p] [-t] [-v]
58*cfb92d14SAndroid Build Coastguard Worker
59*cfb92d14SAndroid Build Coastguard WorkerThis script is used for testing RCP capabilities.
60*cfb92d14SAndroid Build Coastguard Worker
61*cfb92d14SAndroid Build Coastguard Workeroptions:
62*cfb92d14SAndroid Build Coastguard Worker  -h, --help           show this help message and exit
63*cfb92d14SAndroid Build Coastguard Worker  -c, --csl            test whether the RCP supports CSL transmitter
64*cfb92d14SAndroid Build Coastguard Worker  -d, --diag-commands  test whether the RCP supports all diag commands
65*cfb92d14SAndroid Build Coastguard Worker  -l, --link-metrics   test whether the RCP supports link metrics
66*cfb92d14SAndroid Build Coastguard Worker  -p, --data-poll      test whether the RCP supports data poll
67*cfb92d14SAndroid Build Coastguard Worker  -t, --throughput     test the Thread network 1-hop throughput
68*cfb92d14SAndroid Build Coastguard Worker  -v, --verbose        output verbose information
69*cfb92d14SAndroid Build Coastguard Worker
70*cfb92d14SAndroid Build Coastguard WorkerDevice Interfaces:
71*cfb92d14SAndroid Build Coastguard Worker  DUT_SSH=<device_ip>            Connect to the DUT via ssh
72*cfb92d14SAndroid Build Coastguard Worker  DUT_ADB_TCP=<device_ip>        Connect to the DUT via adb tcp
73*cfb92d14SAndroid Build Coastguard Worker  DUT_ADB_USB=<serial_number>    Connect to the DUT via adb usb
74*cfb92d14SAndroid Build Coastguard Worker  REF_CLI_SERIAL=<serial_device> Connect to the reference device via cli serial port
75*cfb92d14SAndroid Build Coastguard Worker  REF_ADB_USB=<serial_number>    Connect to the reference device via adb usb
76*cfb92d14SAndroid Build Coastguard Worker  REF_SSH=<device_ip>            Connect to the reference device via ssh
77*cfb92d14SAndroid Build Coastguard Worker
78*cfb92d14SAndroid Build Coastguard WorkerExample:
79*cfb92d14SAndroid Build Coastguard Worker  DUT_ADB_USB=1169UC2F2T0M95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 ./tools/cp-caps/rcp_caps_test.py -d
80*cfb92d14SAndroid Build Coastguard Worker```
81*cfb92d14SAndroid Build Coastguard Worker
82*cfb92d14SAndroid Build Coastguard Worker### Test Diag Commands
83*cfb92d14SAndroid Build Coastguard Worker
84*cfb92d14SAndroid Build Coastguard WorkerThe parameter `-d` or `--diag-commands` starts to test all diag commands.
85*cfb92d14SAndroid Build Coastguard Worker
86*cfb92d14SAndroid Build Coastguard WorkerFollowing environment variables are used to configure diag command parameters:
87*cfb92d14SAndroid Build Coastguard Worker
88*cfb92d14SAndroid Build Coastguard Worker- DUT_DIAG_GPIO: Diag gpio value. The default value is `0` if it is not set.
89*cfb92d14SAndroid Build Coastguard Worker- DUT_DIAG_RAW_POWER_SETTING: Diag raw power setting value. The default value is `112233` if it is not set.
90*cfb92d14SAndroid Build Coastguard Worker- DUT_DIAG_POWER: Diag power value. The default value is `10` if it is not set.
91*cfb92d14SAndroid Build Coastguard Worker
92*cfb92d14SAndroid Build Coastguard Worker> 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*cfb92d14SAndroid Build Coastguard Worker
94*cfb92d14SAndroid Build Coastguard Worker```bash
95*cfb92d14SAndroid Build Coastguard Worker$ 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
96*cfb92d14SAndroid Build Coastguard Workerdiag channel --------------------------------------------- OK
97*cfb92d14SAndroid Build Coastguard Workerdiag channel 20 ------------------------------------------ OK
98*cfb92d14SAndroid Build Coastguard Workerdiag power ----------------------------------------------- OK
99*cfb92d14SAndroid Build Coastguard Workerdiag power 11 -------------------------------------------- OK
100*cfb92d14SAndroid Build Coastguard Workerdiag radio sleep ----------------------------------------- OK
101*cfb92d14SAndroid Build Coastguard Workerdiag radio receive --------------------------------------- OK
102*cfb92d14SAndroid Build Coastguard Workerdiag radio state ----------------------------------------- OK
103*cfb92d14SAndroid Build Coastguard Workerdiag repeat 10 64 ---------------------------------------- OK
104*cfb92d14SAndroid Build Coastguard Workerdiag repeat stop ----------------------------------------- OK
105*cfb92d14SAndroid Build Coastguard Workerdiag send 100 64 ----------------------------------------- OK
106*cfb92d14SAndroid Build Coastguard Workerdiag stats ----------------------------------------------- OK
107*cfb92d14SAndroid Build Coastguard Workerdiag stats clear ----------------------------------------- OK
108*cfb92d14SAndroid Build Coastguard Workerdiag frame 00010203040506070809 -------------------------- OK
109*cfb92d14SAndroid Build Coastguard Workerdiag echo 0123456789 ------------------------------------- OK
110*cfb92d14SAndroid Build Coastguard Workerdiag echo -n 10 ------------------------------------------ OK
111*cfb92d14SAndroid Build Coastguard Workerdiag cw start -------------------------------------------- OK
112*cfb92d14SAndroid Build Coastguard Workerdiag cw stop --------------------------------------------- OK
113*cfb92d14SAndroid Build Coastguard Workerdiag stream start ---------------------------------------- OK
114*cfb92d14SAndroid Build Coastguard Workerdiag stream stop ----------------------------------------- OK
115*cfb92d14SAndroid Build Coastguard Workerdiag stats ----------------------------------------------- OK
116*cfb92d14SAndroid Build Coastguard Workerdiag stats clear ----------------------------------------- OK
117*cfb92d14SAndroid Build Coastguard Workerdiag rawpowersetting enable ------------------------------ NotSupported
118*cfb92d14SAndroid Build Coastguard Workerdiag rawpowersetting 44556688 ---------------------------- NotSupported
119*cfb92d14SAndroid Build Coastguard Workerdiag rawpowersetting ------------------------------------- NotSupported
120*cfb92d14SAndroid Build Coastguard Workerdiag rawpowersetting disable ----------------------------- NotSupported
121*cfb92d14SAndroid Build Coastguard Workerdiag powersettings --------------------------------------- NotSupported
122*cfb92d14SAndroid Build Coastguard Workerdiag powersettings 20 ------------------------------------ NotSupported
123*cfb92d14SAndroid Build Coastguard Workerdiag gpio mode 2 ----------------------------------------- NotSupported
124*cfb92d14SAndroid Build Coastguard Workerdiag gpio mode 2 in -------------------------------------- NotSupported
125*cfb92d14SAndroid Build Coastguard Workerdiag gpio mode 2 out ------------------------------------- NotSupported
126*cfb92d14SAndroid Build Coastguard Workerdiag gpio get 2 ------------------------------------------ NotSupported
127*cfb92d14SAndroid Build Coastguard Workerdiag gpio set 2 0 ---------------------------------------- NotSupported
128*cfb92d14SAndroid Build Coastguard Workerdiag gpio set 2 1 ---------------------------------------- NotSupported
129*cfb92d14SAndroid Build Coastguard Worker```
130*cfb92d14SAndroid Build Coastguard Worker
131*cfb92d14SAndroid Build Coastguard Worker### Test CSL Transmitter
132*cfb92d14SAndroid Build Coastguard Worker
133*cfb92d14SAndroid Build Coastguard WorkerThe parameter `-c` or `--csl` starts to test whether the RCP supports the CSL transmitter.
134*cfb92d14SAndroid Build Coastguard Worker
135*cfb92d14SAndroid Build Coastguard Worker```bash
136*cfb92d14SAndroid Build Coastguard Worker$ DUT_ADB_USB=TW69UCKFZTGM95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 ./tools/cp-caps/rcp_caps_test.py -c
137*cfb92d14SAndroid Build Coastguard WorkerCSL Transmitter ------------------------------------------ OK
138*cfb92d14SAndroid Build Coastguard Worker```
139*cfb92d14SAndroid Build Coastguard Worker
140*cfb92d14SAndroid Build Coastguard Worker### Test Data Poll
141*cfb92d14SAndroid Build Coastguard Worker
142*cfb92d14SAndroid Build Coastguard WorkerThe parameter `-p` or `--data-poll` starts to test whether the RCP supports data poll.
143*cfb92d14SAndroid Build Coastguard Worker
144*cfb92d14SAndroid Build Coastguard Worker```bash
145*cfb92d14SAndroid Build Coastguard Worker$ DUT_ADB_USB=1269UCKFZTAM95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 ./tools/cp-caps/rcp_caps_test.py -p
146*cfb92d14SAndroid Build Coastguard WorkerData Poll Parent ----------------------------------------- OK
147*cfb92d14SAndroid Build Coastguard WorkerData Poll Child ------------------------------------------ OK
148*cfb92d14SAndroid Build Coastguard Worker```
149*cfb92d14SAndroid Build Coastguard Worker
150*cfb92d14SAndroid Build Coastguard Worker### Test Link Metrics
151*cfb92d14SAndroid Build Coastguard Worker
152*cfb92d14SAndroid Build Coastguard WorkerThe parameter `-l` or `--link-metrics` starts to test whether the RCP supports link metrics.
153*cfb92d14SAndroid Build Coastguard Worker
154*cfb92d14SAndroid Build Coastguard Worker```bash
155*cfb92d14SAndroid Build Coastguard Worker$ DUT_ADB_USB=1269UCKFZTAM95OR REF_CLI_SERIAL=/dev/ttyACM0 python3 ./tools/cp-caps/rcp_caps_test.py -l
156*cfb92d14SAndroid Build Coastguard WorkerLink Metrics Initiator ----------------------------------- OK
157*cfb92d14SAndroid Build Coastguard WorkerLink Metrics Subject ------------------------------------- OK
158*cfb92d14SAndroid Build Coastguard Worker```
159*cfb92d14SAndroid Build Coastguard Worker
160*cfb92d14SAndroid Build Coastguard Worker### Test Throughput
161*cfb92d14SAndroid Build Coastguard Worker
162*cfb92d14SAndroid Build Coastguard WorkerThe parameter `-t` or `--throughput` starts to test the Thread network 1-hop throughput of the DUT.
163*cfb92d14SAndroid Build Coastguard Worker
164*cfb92d14SAndroid Build Coastguard Worker```bash
165*cfb92d14SAndroid Build Coastguard Worker$ DUT_ADB_USB=1269UCKFZTAM95OR REF_ADB_USB=44061HFAG01AQK python3 ./tools/cp-caps/rcp_caps_test.py -t
166*cfb92d14SAndroid Build Coastguard WorkerThroughput ----------------------------------------------- 75.6 Kbits/sec
167*cfb92d14SAndroid Build Coastguard Worker```
168