tree: bd73bd8b7acf9eac2ea6e303dd7459c2c23442a0 [path history] [tgz]
  1. platform/
  2. cli.cmake
  3. cli_readline.cpp
  4. cli_stdio.cpp
  5. client.cpp
  6. CMakeLists.txt
  7. daemon.cmake
  8. main.c
  9. Makefile-posix

OpenThread POSIX app

OpenThread supports running its core on POSIX and transmits radio frames through a radio transceiver.

Currently most platforms in examples/platforms support transceiver mode.

The figure below shows the architecture of OpenThread running in transceiver mode.

|     MLE TMF UDP IP      |
|  MeshForwarder 6LoWPAN  |
| _ _ _ _ _ _ _ _ _ _ _ _ |      spinel         +------------------+
|    OpenThread Core      | <---------------->  | OpenThread Radio |
+-------------------------+     UART|SPI        +------------------+
         POSIX                                          Chip


./script/cmake-build posix

If built successfully, the binary should be found at: build/posix/src/posix/ot-cli.

Transceivers on different platforms


OpenThread provides an implemenation on the simulation platform which enables running a simulated transceiver on the host.


# Only build RCP so that it goes faster
./script/cmake-build simulation -DOT_APP_CLI=OFF -DOT_APP_NCP=OFF -DOT_FTD=OFF -DOT_MTD=OFF


NOTE Assuming the build system is 64bit Linux, you can use the normal OpenThread CLI as described in the command line document. You can also perform radio diagnostics using the command diag.

./build/posix/src/posix/ot-cli 'spinel+hdlc+forkpty://build/simulation/examples/apps/ncp/ot-rcp?forkpty-arg=1'

Nordic Semiconductor nRF52840

The nRF example platform driver can be found in the ot-nrf528xx repo.


To build and program the device with RCP application, complete the following steps:

  1. Clone the OpenThread nRF528xx platform repository into the current directory:

    git clone --recursive
  2. Enter the ot-nrf528xx directory:

    cd ot-nrf528xx
  3. Install the OpenThread dependencies:

  4. Build the RCP example for the hardware platform and the transport of your choice:

    a. nRF52840 Dongle (USB transport)

    rm -rf build
    script/build nrf52840 USB_trans -DOT_BOOTLOADER=USB -DOT_THREAD_VERSION=1.2

    b. For nRF52840 Development Kit

    rm -rf build
    script/build nrf52840 UART_trans -DOT_THREAD_VERSION=1.2

    This creates an RCP image at build/bin/ot-rcp.

  5. Depending on the hardware platform, complete the following steps to program the device:

    a. nRF52840 Dongle (USB transport)

    # Install nRF Util:
    python3 -m pip install -U nrfutil
    # Generate the RCP firmware package:
    nrfutil pkg generate --hw-version 52 --sd-req=0x00 \
        --application build/bin/ot-rcp.hex --application-version 1 build/bin/

    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.

    # Install the RCP firmware package onto the dongle
    nrfutil dfu usb-serial -pkg build/bin/ -p /dev/ttyACM0

    b. nRF52840 Development Kit

    # Program the image using the nrfjprog utility.
    nrfjprog -f nrf52 --chiperase --program build/bin/ot-rcp.hex --reset

    Disable the Mass Storage feature on the device, so that it does not interfere with the core RCP functionalities:

    JLinkExe -device NRF52840_XXAA -if SWD -speed 4000 -autoconnect 1
    Probe configured successfully.

    Power-cycle the device to apply the changes.


./build/posix/src/posix/ot-cli 'spinel+hdlc+uart:///dev/ttyACM0?uart-baudrate=115200'



./script/cmake-build cc2538 -DOT_APP_CLI=OFF -DOT_APP_NCP=OFF -DOT_FTD=OFF -DOT_MTD=OFF


arm-none-eabi-objcopy -O ihex build/cc2538/examples/apps/ncp/ot-rcp ot-rcp.bin
# see
python cc2538-bsl/ -b 460800 -e -w -v -p /dev/ttyUSB0 ot-rcp.bin


./build/posix/src/posix/ot-cli 'spinel+hdlc+uart:///dev/ttyUSB0?uart-baudrate=115200'

Daemon Mode

OpenThread 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.

# build daemon mode core stack for POSIX
./script/cmake-build posix -DOT_DAEMON=ON
# Daemon with simulation
./build/posix/src/posix/ot-daemon 'spinel+hdlc+forkpty://build/simulation/examples/apps/ncp/ot-rcp?forkpty-arg=1'
# Daemon with real device
./build/posix/src/posix/ot-daemon 'spinel+hdlc+uart:///dev/ttyACM0?uart-baudrate=115200'
# Built-in controller