• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

platform/11-Mar-2024-11,9877,541

CMakeLists.txtD11-Mar-20243.2 KiB9279

Makefile-posixD11-Mar-202410.1 KiB368300

Makefile.amD11-Mar-20247.9 KiB170112

README.mdD11-Mar-20244.8 KiB172117

cli.cmakeD11-Mar-20242.1 KiB6253

cli_readline.cppD11-Mar-20243.7 KiB12878

cli_stdio.cppD11-Mar-20243.3 KiB10760

client.cppD11-Mar-202411.3 KiB439325

daemon.cmakeD11-Mar-20242.4 KiB7665

main.cD11-Mar-202412.7 KiB437301

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 implemenation 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 -DOT_THREAD_VERSION=1.2
81   ```
82
83   b. For nRF52840 Development Kit
84
85   ```sh
86   rm -rf build
87   script/build nrf52840 UART_trans -DOT_THREAD_VERSION=1.2
88   ```
89
90   This creates an RCP image at `build/bin/ot-rcp`.
91
925. Depending on the hardware platform, complete the following steps to program the device:
93
94   a. nRF52840 Dongle (USB transport)
95
96   ```sh
97   # Install nRF Util:
98   python3 -m pip install -U nrfutil
99
100   # Generate the RCP firmware package:
101   nrfutil pkg generate --hw-version 52 --sd-req=0x00 \
102       --application build/bin/ot-rcp.hex --application-version 1 build/bin/ot-rcp.zip
103   ```
104
105   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.
106
107   ```sh
108   # Install the RCP firmware package onto the dongle
109   nrfutil dfu usb-serial -pkg build/bin/ot-rcp.zip -p /dev/ttyACM0
110   ```
111
112   b. nRF52840 Development Kit
113
114   ```sh
115   # Program the image using the nrfjprog utility.
116   nrfjprog -f nrf52 --chiperase --program build/bin/ot-rcp.hex --reset
117   ```
118
119   Disable the Mass Storage feature on the device, so that it does not interfere with the core RCP functionalities:
120
121   ```sh
122   JLinkExe -device NRF52840_XXAA -if SWD -speed 4000 -autoconnect 1
123   J-Link>MSDDisable
124   Probe configured successfully.
125   J-Link>exit
126   ```
127
128   Power-cycle the device to apply the changes.
129
130#### Run
131
132```sh
133./build/posix/src/posix/ot-cli 'spinel+hdlc+uart:///dev/ttyACM0?uart-baudrate=115200'
134```
135
136### CC2538
137
138#### Build
139
140```
141./script/cmake-build cc2538 -DOT_APP_CLI=OFF -DOT_APP_NCP=OFF -DOT_FTD=OFF -DOT_MTD=OFF
142```
143
144#### Flash
145
146```sh
147arm-none-eabi-objcopy -O ihex build/cc2538/examples/apps/ncp/ot-rcp ot-rcp.bin
148# see https://github.com/JelmerT/cc2538-bsl
149python cc2538-bsl/cc2538-bsl.py -b 460800 -e -w -v -p /dev/ttyUSB0 ot-rcp.bin
150```
151
152#### Run
153
154```sh
155./build/posix/src/posix/ot-cli 'spinel+hdlc+uart:///dev/ttyUSB0?uart-baudrate=115200'
156```
157
158## Daemon Mode
159
160OpenThread 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.
161
162```
163# build daemon mode core stack for POSIX
164./script/cmake-build posix -DOT_DAEMON=ON
165# Daemon with simulation
166./build/posix/src/posix/ot-daemon 'spinel+hdlc+forkpty://build/simulation/examples/apps/ncp/ot-rcp?forkpty-arg=1'
167# Daemon with real device
168./build/posix/src/posix/ot-daemon 'spinel+hdlc+uart:///dev/ttyACM0?uart-baudrate=115200'
169# Built-in controller
170./build/posix/src/posix/ot-ctl
171```
172