The nRF5 SDK for Thread is intended for use with the nRF52840 Development Kit.
The SDK provides precompiled OpenThread libraries for GCC, IAR, and Keil 5.
USB=1
parameter is optional and enables USB CDC support for serial communication.Toolchains and IDEs
Every Thread example can be built with various toolchains and IDEs. Currently, the following build methods are provided:
The following peripherals are owned by the OpenThread stack and cannot be used directly by an application:
Additionally, OpenThread exposes an API to configure the radio frontend module (FEM). In such case, the application must specify two GPIOTE channels.
OpenThread API can be used to access the hardware random number generator and temperature sensor.
If you want to use the logger module, you must utilize the RTT backend or a UART instance other than UART0.
DISABLE_SPI=1
parameter.You must install a set of tools to complete the environment setup process (either on Linux or Windows).
Make
First, make sure that you have the make
tool installed on your system. To do this, run the following command:
If the command does not provide output, you must install the make
tool. Refer to the documentation of your Linux distribution for information on how to download and install it.
GNU ARM Embedded Toolchain
To be able to compile projects for the nRF52840 Development Kit, you must install GNU ARM Embedded Toolchain in version 6.3.1. You can download this version from GNU ARM Embedded Toolchain. Make sure to install it in the /usr/local/gcc-arm-none-eabi-6-2017-q2-update
folder.
If you already have another version of arm-none-eabi installed, you can modify the default path in the following file: <InstallFolder>/components/toolchain/gcc/Makefile.posix
.
SEGGER J-Link
To enable communication between devices, you need the SEGGER J-Link utility. You can download the latest version from the J-Link Download page.
nrfjprog
You need the nrfjprog tool to program the nRF52840 chips. The latest version of this tool can be found on the nRF52840 product website.
Make
The make
tool, required to build GCC projects, is not natively available on Windows. However, you can use the MinGW package to install it:
C:\MinGW
. When the first part of the installation is finished, the MinGW Installation Manager opens. C:\MinGW\bin
C:\MinGW\msys\1.0\bin
make
tool was installed correctly by typing make --version
and pressing Enter. If there are no errors during installation, the following message is displayed: GNU ARM Embedded Toolchain
To be able to compile projects for the nRF52840 Development Kit, you must install GNU ARM Embedded Toolchain in version 6.3.1. You can download this version from GNU ARM Embedded Toolchain. It is recommended to install it in the default directory: C:\Program Files (x86)\GNU Tools ARM Embedded\6 2017-q2-update
.
If you already have another version of arm-none-eabi installed, or have installed it in a different directory, you can modify the default path in the following file: <InstallFolder>\components\toolchain\gcc\Makefile.windows
.
nRF5x Command Line Tools
To communicate with and program the nRF52840 Development Kit, you need the SEGGER J-Link and nrfjprog tools. Download and install the latest version of nRF5x Command Line Tools from the nRF52840 product website. This package includes the latest version of SEGGER J-Link and nrfjprog utilities.
After the installation is complete, add nrfjprog installation directory (for example C:\Program Files (x86)\Nordic Semiconductor\nrf5x\bin\
) to your system PATH variable.
Building an example with GCC (6.3 2017-q2-update)
To build an example with GCC, perform the following steps:
<InstallFolder>/examples/thread/cli/pca10056/blank/armgcc
make
command in this folder. If the environment was set up correctly, the build process will start._build
folder: <InstallFolder>/examples/thread/cli/pca10056/blank/armgcc/_build/nrf52840_xxaa.hex
. make
command on Windows, make sure that you do not have any other make
instances from other toolsets like Cygwin or GnuWin32 in your PATH variable. Building an example with IAR (7.80.4)
To build an example with IAR, perform the following steps:
<InstallFolder>/examples/thread/cli/thread_cli.eww
.You can program the nRF52840 Development Kit directly from IAR Embedded Workspace (Project->Download And Debug), or use nrfjprog as described in Running an example without the SoftDevice (for standard examples) or Running an example with the SoftDevice (for multiprotocol examples).
Building an example with Keil 5 (5.18a)
To build an example with Keil µVision 5, perform the following steps:
<InstallFolder>/examples/thread/cli/uart/pca10056/blank/arm5_no_packs/thread_cli_uart_pca10056.uvprojx
.You can program the nRF52840 Development Kit directly from Keil µVision (Flash->Download), or use nrfjprog as described in Running an example without the SoftDevice (for standard examples) or Running an example with the SoftDevice (for multiprotocol examples).
Building an example with SEGGER Embedded Studio (3.40)
To build an example with SES, perform the following steps:
<InstallFolder>/examples/thread/cli/uart/pca10056/blank/ses/thread_cli_uart_pca10056.emProject
.You can program the nRF52840 Development Kit directly from SEGGER Embedded Studio (Target->Download project name), or use nrfjprog as described in Running an example without the SoftDevice (for standard examples) or Running an example with the SoftDevice (for multiprotocol examples).
To program the nRF52840 Development Kit, first connect it to your computer with a USB cable. When your board is detected, you can download the example with the appropriate nrfjprog command, depending on the example.
Optionally, when using GCC, you can type the following commands:
The SoftDevice is used by the multiprotocol examples.
Optionally, when using GCC, you can type the following commands:
You can use RTT Viewer to view the log messages produced by the example.
To quickly test an example without having to install the full toolchain, program a precompiled example application to your development board.
The zip version of the SDK provides precompiled hex files for most of the supplied examples. For examples that require a SoftDevice, the SoftDevice must be flashed separately.
Perform the following steps to program a precompiled example:
nRF5-SDK-for-Thread-and-Zigbee
repository file in zip format from the SDK download page.hex subdirectory
. For example, for the Thread CLI Example, navigate to examples\thread\cli\uart\hex
.To test the example, follow the testing instructions in the Thread examples documentation. Depending on the example that you programmed, it might be sufficient to observe the LEDs on the board. Other examples require you to connect to the board through native USB, SPI, or a phone app.
It is recommended to use the provided, precompiled version of the OpenThread library. However, it is possible to compile the latest version from GitHub. You can either:
Building the library with GCC on Linux or Mac (recommended)
Follow these steps to build the library:
make
with the following parameters: libopenthread-nrf52840-sdk.a
– rename to libopenthread-nrf52840-sdk-usb.a
libopenthread-nrf52840-softdevice-sdk.a
– rename to libopenthread-nrf52840-sdk-softdevice-usb.a
<OpenThreadFolder>/output/lib
to the SDK folder: /external/openthread/lib/gcc
.<OpenThreadFolder>/include
folder to the /external/openthread
folder.platform-fem.h
and platform-softdevice.h
files from /external/project/openthread/examples/platforms/nrf52840
to the /external/openthread/include/platform
folder.openthread-system.h
file from /external/project/openthread/examples/platforms
to the /external/openthread/include/platform
folder.Now you can recompile the examples with the latest libraries.
Building the library with GCC on Windows
<InstallFolder>/external/openthread/project/openthread
folder.build_gcc_libs.bat
script to build all of the libraries.<InstallFolder>/external/openthread/project/import_gcc_libs.bat
) to copy the compiled libraries to the output folder./external/project/openthread/include
folder to the /external/openthread
folder.platform-fem.h
and platform-softdevice.h
files from /external/project/openthread/examples/platforms/nrf52840
to the /external/openthread/include/platform
folder.openthread-system.h
file from /external/project/openthread/examples/platforms
to the /external/openthread/include/platform
folder.Now you can recompile the examples with the latest libraries.
Building the library with IAR
Follow these steps to build the library:
<InstallFolder>/external/openthread/project/openthread
folder.<InstallFolder>/external/openthread/project/openthread_lib.eww
) with IAR Embedded Workbench.<InstallFolder>/external/openthread/project/import_iar_libs.bat
) to copy the compiled libraries to the output folder./external/project/openthread/include
folder to the /external/openthread
folder.platform-fem.h
and platform-softdevice.h
files from /external/project/openthread/examples/platforms/nrf52840
to the /external/openthread/include/platform
folder.openthread-system.h
file from /external/project/openthread/examples/platforms
to the /external/openthread/include/platform
folder.Now you can recompile the examples with the latest libraries.
Building the library with Keil 5
Follow these steps to build the library:
<InstallFolder>/external/openthread/project/openthread
folder.<InstallFolder>/external/openthread/project/lib/openthread/ftd/arm5_no_packsc/openthread_lib_libopenthread_ftd.uvprojx
) with Keil µVision 5.<InstallFolder>/external/openthread/project/import_keil_libs.bat
) to copy the compiled libraries to the output folder./external/openthread/project/openthread/include
folder to the /external/openthread
folder.platform-fem.h
and platform-softdevice.h
files from /external/project/openthread/examples/platforms/nrf52840
to the /external/openthread/include/platform
folder.openthread-system.h
file from /external/project/openthread/examples/platforms
to the /external/openthread/include/platform
folder.Now you can recompile the examples with the latest libraries.
As an application developer, you must make sure that calls to the OpenThread API are not preempted by other calls to the OpenThread API.
main
function context. Do not call any OpenThread functions in ISRs or callbacks from ISR context. You can use the app_scheduler
module to execute callbacks from the app_timer
and the SoftDevice in the main context. Refer to the examples included in this SDK to see how the app_scheduler
module should be used with OpenThread.See the following topics for further introduction into Nordic Semiconductor's Thread implementation.