![]() |
nRF5 SDK for Thread and Zigbee v1.0.0
|
Choose documentation: | nRF5 SDK | S112 SoftDevice API | S132 SoftDevice API | S140 SoftDevice API | S212 SoftDevice API |
The OTA Client is typically only one of several ZCL clusters defined by the common Zigbee application. The client is based on the OTA cluster and Nordic's Bootloader and DFU modules that both create an integrated upgrade solution. This gives you a useful head start when populating the device with other functionalities.
The Zigbee OTA Client Example consists of two components:
The OTA cluster allows for downloading a new image while the device is running. This process differs from the one in BLE Secure DFU Bootloader, where a new image is downloaded and installed in the bootloader.
Zigbee OTA Client example accepts images that contain a new bootloader or application that contains the Zigbee stack. To protect the target device against malicious attackers who try to impersonate the rightful sender of the firmware update, the initialization packet of the firmware package must be signed.
Zigbee OTA Client Example does not use the SoftDevice. However, the bootloader requires the Master Boot Record (MBR). The example uses a standalone MBR provided as a hex file.
To program the MBR, perform the following steps:
<InstallFolder>\components\softdevice\mbr\nrf52840\hex
.nrfjprog -f nrf52 -r --program mbr_nrf52_2.3.0_mbr.hex --chiperase
.The bootloader for the Zigbee OTA Client Example is implemented through Bootloader and DFU modules. The main role of the bootloader is to check the integrity of the application and to transfer the new image to the active bank in case of dual bank updates (see Dual-bank and single-bank updates). Unlike BLE Secure DFU Bootloader, the bootloader for Thread Secure DFU does not initialize any transports. Therefore, DFU is not possible in the bootloader. If a valid application is missing, the bootloader enters an infinite loop.
During system startup, the Master Boot Record (MBR) is responsible for starting the bootloader. To do this, the MBR must know the start address of the bootloader. Therefore, you must set it to the correct value when you program the bootloader in UICR.BOOTLOADERADDR
, located at address 0x10001014 (see NRF_UICR_BOOTLOADER_START_ADDRESS
).
To program the bootloader:
armgcc
folder of the example at <InstallFolder>\examples\thread\dfu\bootloader\pca10056\blank\armgcc
.make
to build the project._build
folder to the board.nrfjprog -f nrf52 -r --program _build\nrf52840_xxaa_blank.hex --sectoranduicrerase
.nrfutil is a PC tool that allows you to create and sign firmware packages, as well as perform the firmware update process on a PC. Support for Zigbee OTA images has been added to nrfutil in version 3.6.0. Refer to the nrfutil installation section for details on possible ways to install the tool.
The DFU process flow in the Zigbee OTA Client is slightly different from the BLE Secure DFU Bootloader DFU process flow or others.
The are two entities which participate in the Zigbee OTA process:
Because of the nature of the DFU implementation, the OTA Client cannot accept just any Zigbee OTA Upgrade file. The file must comply with several requirements. Apart from mandatory Zigbee OTA header, the image has to consist of all the following Zigbee OTA subelements, in consecutive order:
0xCDEF
and contain the DFU trigger structure.The nrfutil utility generates the OTA Upgrade file of the specified structure automatically, using the provided hex file with the image for upgrading firmware.
There are several defines in the main.c
file of the Zigbee OTA Client example that can help you configure the parameters of the Zigbee OTA Client.
Name | Description |
---|---|
OTA_UPGRADE_TEST_FILE_VERSION | Version of the installed firmware. |
OTA_UPGRADE_TEST_MANUFACTURER | Manufacturer ID for the device. |
OTA_UPGRADE_TEST_IMAGE_TYPE | Image Type of the device. |
HARDWARE_REVISION | Hardware Revision of the device. |
Unless stated otherwise, run all of the presented commands in the main folder of the DFU Example: <InstallFolder>\examples\zigbee\experimental\ota
.
Test the Zigbee OTA Client application by performing the following steps:
dfu_public_key.c:
dfu_public_key.c
file to the project folder <InstallFolder>\examples\dfu
. Replace the existing file. <InstallFolder>\examples\thread\dfu
. Use the path above.main()
function: .zip
format) with the new firmware. See Creating a firmware package for more information: is
the serial number of the Zigbee OTA Server for the Development Kit, and 11
is the 802.15.4 channel number: The device resets and runs the new application. BSP_BOARD_LED_3 is lit.
When adding a bootloader to your device, pay attention to where in the device memory the different firmware components are located. The following table shows the memory layout used by the Zigbee OTA Client - since the Zigbee stack memory consumption is configurable, the default avalues are assumed.
Usage | Memory range nRF52840 |
---|---|
Bootloader settings | 0x000F F000 - 0x0010 0000 (4 kB) |
MBR parameter storage | 0x000F E000 - 0x000F F000 (4 kB) |
Bootloader | 0x000F 8000 - 0x000F E000 (24 kB) |
Zigbee settings | 0x000E C000 - 0x000F 8000 (48 kB) |
Application area (incl. free space) | 0x0000 1000 - 0x000E C000 (940 kB) |
Master Boot Record (MBR) | 0x0000 0000 - 0x0000 1000 (4 kB) |