Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
platform/ | 11-Mar-2024 | - | 15,691 | 9,626 | ||
CMakeLists.txt | D | 11-Mar-2024 | 3.2 KiB | 92 | 79 | |
README.md | D | 11-Mar-2024 | 4.4 KiB | 156 | 106 | |
cli.cmake | D | 11-Mar-2024 | 2.4 KiB | 70 | 61 | |
cli_readline.cpp | D | 11-Mar-2024 | 3.7 KiB | 125 | 75 | |
cli_stdio.cpp | D | 11-Mar-2024 | 3.2 KiB | 100 | 53 | |
client.cpp | D | 11-Mar-2024 | 11.3 KiB | 439 | 325 | |
daemon.cmake | D | 11-Mar-2024 | 2.9 KiB | 93 | 80 | |
main.c | D | 11-Mar-2024 | 13 KiB | 432 | 296 |
README.md
1# OpenThread POSIX app 2 3OpenThread supports running its core on POSIX and transmits radio frames through a radio transceiver. 4 5Currently most platforms in [examples/platforms](../../examples/platforms) support transceiver mode. 6 7The figure below shows the architecture of OpenThread running in transceiver mode. 8 9``` 10+-------------------------+ 11| MLE TMF UDP IP | 12| MeshForwarder 6LoWPAN | 13| _ _ _ _ _ _ _ _ _ _ _ _ | spinel +------------------+ 14| OpenThread Core | <----------------> | OpenThread Radio | 15+-------------------------+ UART|SPI +------------------+ 16 POSIX Chip 17``` 18 19## Build POSIX CLI 20 21```sh 22./script/cmake-build posix 23``` 24 25If built successfully, the binary should be found at: `build/posix/src/posix/ot-cli`. 26 27## Transceivers on different platforms 28 29### Simulation 30 31OpenThread provides an implementation on the simulation platform which enables running a simulated transceiver on the host. 32 33#### Build 34 35```sh 36# Only build RCP so that it goes faster 37./script/cmake-build simulation -DOT_APP_CLI=OFF -DOT_APP_NCP=OFF -DOT_FTD=OFF -DOT_MTD=OFF 38``` 39 40#### Run 41 42**NOTE** Assuming the build system is 64bit Linux, you can use the normal OpenThread CLI as described in the [command line document](../../src/cli/README.md). You can also perform radio diagnostics using the command [diag](../../src/core/diags/README.md). 43 44```sh 45./build/posix/src/posix/ot-cli 'spinel+hdlc+forkpty://build/simulation/examples/apps/ncp/ot-rcp?forkpty-arg=1' 46``` 47 48### Nordic Semiconductor nRF52840 49 50The nRF example platform driver can be found in the [ot-nrf528xx](https://github.com/openthread/ot-nrf528xx) repo. 51 52#### Build 53 54To build and program the device with RCP application, complete the following steps: 55 561. Clone the OpenThread nRF528xx platform repository into the current directory: 57 58 ```sh 59 git clone --recursive https://github.com/openthread/ot-nrf528xx.git 60 ``` 61 622. Enter the `ot-nrf528xx` directory: 63 64 ```sh 65 cd ot-nrf528xx 66 ``` 67 683. Install the OpenThread dependencies: 69 70 ```sh 71 ./script/bootstrap 72 ``` 73 744. Build the RCP example for the hardware platform and the transport of your choice: 75 76 a. nRF52840 Dongle (USB transport) 77 78 ```sh 79 rm -rf build 80 script/build nrf52840 USB_trans -DOT_BOOTLOADER=USB 81 ``` 82 83 b. For nRF52840 Development Kit 84 85 ```sh 86 rm -rf build 87 script/build nrf52840 UART_trans 88 ``` 89 90 This creates an RCP image at `build/bin/ot-rcp`. 91 925. Generate the HEX image: 93 94 ```sh 95 arm-none-eabi-objcopy -O ihex build/bin/ot-rcp build/bin/ot-rcp.hex 96 ``` 97 986. Depending on the hardware platform, complete the following steps to program the device: 99 100 a. nRF52840 Dongle (USB transport) 101 102 ```sh 103 # Install nRF Util: 104 python3 -m pip install -U nrfutil 105 106 # Generate the RCP firmware package: 107 nrfutil pkg generate --hw-version 52 --sd-req=0x00 \ 108 --application build/bin/ot-rcp.hex --application-version 1 build/bin/ot-rcp.zip 109 ``` 110 111 Connect the nRF52840 Dongle to the USB port and press the **RESET** button on the dongle to put it into the DFU mode. The LED on the dongle starts blinking red. 112 113 ```sh 114 # Install the RCP firmware package onto the dongle 115 nrfutil dfu usb-serial -pkg build/bin/ot-rcp.zip -p /dev/ttyACM0 116 ``` 117 118 b. nRF52840 Development Kit 119 120 ```sh 121 # Program the image using the nrfjprog utility. 122 nrfjprog -f nrf52 --chiperase --program build/bin/ot-rcp.hex --reset 123 ``` 124 125 Disable the Mass Storage feature on the device, so that it does not interfere with the core RCP functionalities: 126 127 ```sh 128 JLinkExe -device NRF52840_XXAA -if SWD -speed 4000 -autoconnect 1 129 J-Link>MSDDisable 130 Probe configured successfully. 131 J-Link>exit 132 ``` 133 134 Power-cycle the device to apply the changes. 135 136#### Run 137 138```sh 139./build/posix/src/posix/ot-cli 'spinel+hdlc+uart:///dev/ttyACM0?uart-baudrate=115200' 140``` 141 142## Daemon Mode 143 144OpenThread Posix Daemon mode uses a unix socket as input and output, so that OpenThread core can run as a service. And a client can communicate with it by connecting to the socket. The protocol is OpenThread CLI. 145 146``` 147# build daemon mode core stack for POSIX 148./script/cmake-build posix -DOT_DAEMON=ON 149# Daemon with simulation 150./build/posix/src/posix/ot-daemon 'spinel+hdlc+forkpty://build/simulation/examples/apps/ncp/ot-rcp?forkpty-arg=1' 151# Daemon with real device 152./build/posix/src/posix/ot-daemon 'spinel+hdlc+uart:///dev/ttyACM0?uart-baudrate=115200' 153# Built-in controller 154./build/posix/src/posix/ot-ctl 155``` 156