OTA file system upgrades OTA file system updates: OEM
Digi XBee® 3 Zigbee® RF Module
346
Use the FS command or MicroPython to load all of the files that you want to send onto the local
staging device.
Note The staging device must have the same firmware version installed as the target device or the
file system will be rejected. Use the VR command to check the version number on both the staging
and target devices.
Download the file system image
Run the command ATFS GET /sys/xbfs.bin to download an image of the file system from the staging
device. The file is transferred using the YMODEM protocol. See File system for more information on
downloading files using FS GET.
Pad the file system image
The file system image must be a multiple of 2048 bytes long before it is signed. Using hex editing
software, add 0xFF bytes to the end of the downloaded image until size of the file is a multiple of 2048
(0x800 in hex).
Calculate the image signature
Once the image has been padded to a multiple of 2048 bytes, it is ready to be signed. The ECDSA
signature should be calculated using SHA256 as the hash algorithm.
Assuming a public/private key pair has been generated as described in Generate a public/private key
pair, that the private key is named private.pem, and that the padded image is named xbfs.bin; this
can be done using OpenSSL with the following command:
openssl dgst -sha256 -sign private.pem -binary -out sig.bin xbfs.bin
sig.bin will contain the signature for the image.
Append the calculated signature to the image
The signature should be between 70 and 72 bytes, and it should be appended to the padded image.
Create the OTA file
Put the image into an OTA file that follows the format specified in ZigBee Document 095264r23. The
file should consist of:
n An OTA header
n An upgrade image sub-element tag
n The padded, signed image data
The OTA file must begin with an OTA header. See The OTA header for information on the format of the
header. The image type should be 0x0100 for a file system image upgrade.
The sub-element tag should come before the image data. The sub-element tag follows the format
described in section 6.3.3 of ZigBee Document 095264r23. It consists of 6 bytes: the first 2 bytes are
the tag id and should be set to 0x0000. The next 4 bytes contain the length of the file system image in
little-endian format.
Perform the OTA file system update
The process for performing an OTA file system update is the same as the process for performing a
FOTA upgrade, as described in Over-the-air firmware/file system upgrade process for Zigbee 3.0. Note