1# OpenThread Factory Diagnostics Module Reference 2 3The OpenThread diagnostics module is a tool for debugging platform hardware manually, and it will also be used during manufacturing process, to verify platform hardware performance. 4 5The diagnostics module supports common diagnostics features that are listed below, and it also provides a mechanism for expanding platform specific diagnostics features. 6 7## Common Diagnostics Command List 8 9- [diag](#diag) 10- [diag start](#diag-start) 11- [diag channel](#diag-channel) 12- [diag cw](#diag-cw-start) 13- [diag stream](#diag-stream-start) 14- [diag power](#diag-power) 15- [diag powersettings](#diag-powersettings) 16- [diag send](#diag-send-packets-length) 17- [diag repeat](#diag-repeat-delay-length) 18- [diag radio](#diag-radio-sleep) 19- [diag rawpowersetting](#diag-rawpowersetting) 20- [diag stats](#diag-stats) 21- [diag gpio](#diag-gpio-get-gpio) 22- [diag stop](#diag-stop) 23 24### diag 25 26Show diagnostics mode status. 27 28```bash 29> diag 30diagnostics mode is disabled 31``` 32 33### diag start 34 35Start diagnostics mode. 36 37```bash 38> diag start 39start diagnostics mode 40status 0x00 41``` 42 43### diag channel 44 45Get the IEEE 802.15.4 Channel value for diagnostics module. 46 47```bash 48> diag channel 49channel: 11 50``` 51 52### diag channel \<channel\> 53 54Set the IEEE 802.15.4 Channel value for diagnostics module. 55 56```bash 57> diag channel 11 58set channel to 11 59status 0x00 60``` 61 62### diag cw start 63 64Start transmitting continuous carrier wave. 65 66```bash 67> diag cw start 68Done 69``` 70 71### diag cw stop 72 73Stop transmitting continuous carrier wave. 74 75```bash 76> diag cw stop 77Done 78``` 79 80### diag stream start 81 82Start transmitting a stream of characters. 83 84```bash 85> diag stream start 86Done 87``` 88 89### diag stream stop 90 91Stop transmitting a stream of characters. 92 93```bash 94> diag stream stop 95Done 96``` 97 98### diag power 99 100Get the tx power value(dBm) for diagnostics module. 101 102```bash 103> diag power 104tx power: -10 dBm 105``` 106 107### diag power \<power\> 108 109Set the tx power value(dBm) for diagnostics module. 110 111```bash 112> diag power -10 113set tx power to -10 dBm 114status 0x00 115``` 116 117### diag powersettings 118 119Show the currently used power settings table. 120 121- Note: The unit of `TargetPower` and `ActualPower` is 0.01dBm. 122 123```bash 124> diag powersettings 125| StartCh | EndCh | TargetPower | ActualPower | RawPowerSetting | 126+---------+-------+-------------+-------------+-----------------+ 127| 11 | 14 | 1700 | 1000 | 223344 | 128| 15 | 24 | 2000 | 1900 | 112233 | 129| 25 | 25 | 1600 | 1000 | 223344 | 130| 26 | 26 | 1600 | 1500 | 334455 | 131Done 132``` 133 134### diag powersettings \<channel\> 135 136Show the currently used power settings for the given channel. 137 138```bash 139> diag powersettings 11 140TargetPower(0.01dBm): 1700 141ActualPower(0.01dBm): 1000 142RawPowerSetting: 223344 143Done 144``` 145 146### diag send \<packets\> \<length\> 147 148Transmit a fixed number of packets with fixed length. 149 150Length parameter has to be in range [3, 127]. 151 152```bash 153> diag send 20 100 154sending 0x14 packet(s), length 0x64 155status 0x00 156``` 157 158### diag repeat \<delay\> \<length\> 159 160Transmit packets repeatedly with a fixed interval. 161 162Length parameter has to be in range [3, 127]. 163 164```bash 165> diag repeat 100 100 166sending packets of length 0x64 at the delay of 0x64 ms 167status 0x00 168``` 169 170### diag repeat stop 171 172Stop repeated packet transmission. 173 174```bash 175> diag repeat stop 176repeated packet transmission is stopped 177status 0x00 178``` 179 180### diag radio sleep 181 182Enter radio sleep mode. 183 184```bash 185> diag radio sleep 186set radio from receive to sleep 187status 0x00 188``` 189 190### diag radio receive 191 192Set radio from sleep mode to receive mode. 193 194```bash 195> diag radio receive 196set radio from sleep to receive on channel 11 197status 0x00 198``` 199 200### diag radio state 201 202Return the state of the radio. 203 204```bash 205> diag radio state 206sleep 207``` 208 209### diag rawpowersetting 210 211Show the raw power setting for diagnostics module. 212 213```bash 214> diag rawpowersetting 215112233 216Done 217``` 218 219### diag rawpowersetting \<settings\> 220 221Set the raw power setting for diagnostics module. 222 223```bash 224> diag rawpowersetting 112233 225Done 226``` 227 228### diag rawpowersetting enable 229 230Enable the platform layer to use the value set by the command `diag rawpowersetting \<settings\>`. 231 232```bash 233> diag rawpowersetting enable 234Done 235``` 236 237### diag rawpowersetting disable 238 239Disable the platform layer to use the value set by the command `diag rawpowersetting \<settings\>`. 240 241```bash 242> diag rawpowersetting disable 243Done 244``` 245 246### diag stats 247 248Print statistics during diagnostics mode. 249 250```bash 251> diag stats 252received packets: 10 253sent packets: 10 254first received packet: rssi=-65, lqi=101 255last received packet: rssi=-64, lqi=98 256``` 257 258### diag stats clear 259 260Clear statistics during diagnostics mode. 261 262```bash 263> diag stats clear 264stats cleared 265``` 266 267### diag gpio get \<gpio\> 268 269Get the gpio value. 270 271```bash 272> diag gpio get 0 2731 274Done 275``` 276 277### diag gpio set \<gpio\> \<value\> 278 279Set the gpio value. 280 281The parameter `value` has to be `0` or `1`. 282 283```bash 284> diag gpio set 0 1 285Done 286``` 287 288### diag gpio mode \<gpio\> 289 290Get the gpio mode. 291 292```bash 293> diag gpio mode 1 294in 295Done 296``` 297 298### diag gpio mode \<gpio\> in 299 300Sets the given gpio to the input mode without pull resistor. 301 302```bash 303> diag gpio mode 1 in 304Done 305``` 306 307### diag gpio mode \<gpio\> out 308 309Sets the given gpio to the output mode. 310 311```bash 312> diag gpio mode 1 out 313Done 314``` 315 316### diag stop 317 318Stop diagnostics mode and print statistics. 319 320```bash 321> diag stop 322received packets: 10 323sent packets: 10 324first received packet: rssi=-65, lqi=101 325last received packet: rssi=-61, lqi=98 326 327stop diagnostics mode 328status 0x00 329``` 330 331### diag rcp 332 333RCP-related diagnostics commands. These commands are used for debugging and testing only. 334 335#### diag rcp start 336 337Start RCP diagnostics mode. 338 339```bash 340> diag rcp start 341Done 342``` 343 344#### diag rcp stop 345 346Stop RCP diagnostics mode. 347 348```bash 349> diag rcp stop 350Done 351``` 352 353#### diag rcp channel \<channel\> 354 355Set the RCP IEEE 802.15.4 Channel value for diagnostics module. 356 357```bash 358> diag rcp channel 11 359Done 360``` 361 362#### diag rcp power \<power\> 363 364Set the RCP tx power value(dBm) for diagnostics module. 365 366```bash 367> diag rcp power 0 368Done 369``` 370 371#### diag rcp echo \<message\> 372 373RCP echoes the given message. 374 375```bash 376> diag rcp echo 0123456789 3770123456789 378Done 379``` 380 381#### diag rcp echo -n \<number\> 382 383RCP echoes the message with the given number of bytes. 384 385```bash 386> diag rcp echo -n 20 38701234567890123456789 388Done 389``` 390