nRF5 SDK for Thread and Zigbee v1.0.0
OpenThread serialization

The OpenThread stack allows for serialization of the Thread protocol between an application processor and a network co-processor (NCP) over a serial link, as shown in Figure 1. In general, any type of serial link can be used (such as UART, SPI, or USB), but support for a particular serial link type is platform dependent. Currently, nRF52840 supports serialization over UART, USB CDC, and SPI.

thread_serialization_1.PNG
Figure 1. Thread serialization overview

An OpenThread-based NCP can run in one of two modes: full stack mode or tunnel mode. In the full stack mode (as shown in Figure 2), all Thread-related messages and logic is handled by the NCP itself. The application processor can control the NCP’s operation on the Thread network (e.g. request for joining or leaving the network), 802.15.4 MAC and PHY parameters (e.g. channel number, transmit power), as well as receive and send IPv6 packets from/to the Thread network.

thread_serialization_2.PNG
Figure 2. Full stack mode

In the tunnel mode (as shown in Figure 3), the NCP acts as a simple 802.15.4 radio interface. The application can control the NCP’s 802.15.4 MAC and PHY parameters, and receive and sent RAW 802.15.4 frames. Since the NCP is solely an interface, all Thread relate messages and logic must be handled by the application processor.

thread_serialization_3.PNG
Figure 3. Tunnel mode

By default, OpenThread stack uses the Spinel NCP Protocol for serialization of network and control data over a serial link. The protocol supports encapsulation of IPv6 packets and 802.15.4 frames which allows for using the NCP full stack or tunnel modes. It also provides control over the NCP state (e.g. change power state) and 802.15.4 PHY and MAC parameters. The Spinel NCP Protocol specification gives a detailed description of the protocol and its capabilities. Thread NCP Example provides a reference implementation of an OpenThread NCP for nRF52840.

Spinel support on application processors

WPAN Network Deamon (wpantund on GitHub) provides an implementation of the Spinel protocol for POSIX-compliant application processors. wpantund provides a user-space network interface/daemon which exposes a native IPv6 network interface to the Thread network, and a set of command line tools to manage the NCP state and its behavior on the Thread network. In the Thread Border Router example, wpantund runs on a Raspberry Pi and is used to forward IPv6 traffic between Thread and external networks.

pyspinel is a Python module, which provides a subset of functions implemented by wpantund. It allows for connecting to a Thread network using the full stack mode and controlling an NCP from a Python script. pyspinel is used in nrfutil for Thread (available from nRF5 SDK for Thread web page) to connect to a Thread network from an application for the purpose of device firmware update (DFU). A kernel module for Windows 10, which supports both full stack and tunnel modes, is also available.

Currently, there is no implementation of the Spinel protocol for non-POSIX application processors.


Documentation feedback | Developer Zone | Subscribe | Updated