Performing an over-the-air (OTA) GPM firmware update on the XBee for Wi-SUN device is a highly convenient feature. This capability allows you to update the device’s firmware wirelessly, without the need for physical access or connection to a computer. It enhances maintenance efficiency, reduces downtime, and ensures that devices in the field stay up-to-date with the latest improvements or security patches.
| The OTA firmware update process can be done easily using the XBee Studio to streamline the entire update procedure. However, if you prefer to implement this process yourself or need to integrate it into a custom application, you can continue reading for more detailed instructions on how to perform the GPM OTA update manually. |
| GPM updates are an additional method of updating the XBee for Wi-SUN device firmware but is not currently supported on the Wi-SUN border router. The preffered method is to use CSMP OTA Updates. |
| Because GPM frames can be sent via frames that can be addressed to a local node (accessible via the SPI or UART) or a remote node (accessible over the RF port), the same process can be used to update firmware on a device in either case. |
To perform a GPM firmware update on the XBee for Wi-SUN, you will need:
-
If the update is done over the network:
-
The XBee for Wi-SUN device to be updated (referred as target from now on), connected and authenticated to the network.
-
A second XBee for Wi-SUN device connected and authenticated on the same network as the target device.
-
For more information about authenticating XBee for Wi-SUN devices on the network, refer to Authentication and onboarding.
-
-
If the update is done serially:
-
The XBee for Wi-SUN device to be updated (referred as target from now on)
-
A computer or host microcontroller connected serially to a device capable of creating and sending GPM frames.
-
There are three phases of the GPM firmware update process:
Distribute the new application
The first phase of performing a GPM firmware update on a device is transferring the new firmware file to the target node.
| Erase the entire GPM prior to beginning an upload of a .gbl file. See the ERASE_REQUEST (0x01) command for more information. |
-
Load the new firmware image in the target node’s GPM prior to installation.
XBee for Wi-SUN devices use a Gecko Bootloader (.gbl) file for both serial and FOTA updates. These firmware files are available via:-
XBee Studio
-
Send the contents of the .gbl file to the target device using general purpose memory WRITE_REQUEST commands.
-
The contents of the .gbl file should be stored in order in the appropriate GPM memory blocks. The number of bytes that are sent in an individual GPM WRITE frame is flexible and can be catered to the user application.
Example
The following example shows how to divide and address a .gbl file of 55,141 bytes in blocks of 128 bytes, assuming the block size is 2048 bytes:
| GPM_BLOCK_NUM | GPM_START_INDEX | GPM_NUM_BYTES | .gbl bytes |
|---|---|---|---|
0 |
0 |
128 |
0 to 127 |
0 |
128 |
128 |
128 to 255 |
0 |
256 |
128 |
256 to 383 |
— |
— |
— |
— |
0 |
1896 |
128 |
1896 to 2023 |
1 |
0 |
128 |
2024 to 2151 |
— |
— |
— |
— |
26 |
1536 |
128 |
54784 to 54911 |
26 |
1664 |
128 |
54912 to 55039 |
26 |
1792 |
101 |
55040 to 55140 |
See WRITE_REQUEST (0x02) and ERASE_THEN_WRITE_REQUEST (0x03) for an example of how to use the write commands.
Verify the newly uploaded application
For an uploaded application to pass verification checks correctly, every single byte from the .gbl file must be properly transferred to GPM.
To guarantee that this is the case, GPM FIRMWARE_VERIFY_REQUEST commands exist to ensure that all bytes are properly in place. These commands include:
-
FIRMWARE_VERIFY_REQUEST: reports whether or not the uploaded image is valid but does not install the image.
-
FIRMWARE_VERIFY_AND_INSTALL_REQUEST: determines if the uploaded image is valid. If so, it installs the image. Otherwise, the device does not install the image and an error is reported.
See FIRMWARE_VERIFY_REQUEST (0x05) and FIRMWARE_VERIFY_AND_INSTALL_REQUEST (0x06) for an example of how to use these commands.
Install the new application
When installing your new application, you will need to use the FIRMWARE_VERIFY_AND_INSTALL_REQUEST command to complete the process.
| Write all non-default configuration parameters with the WR command before performing a firmware update to avoid loss of configuration. |
-
When the entire .gbl file is uploaded to the GPM of the target node, issue a FIRMWARE_VERIFY_AND_INSTALL command.
-
Once the target receives the command, it verifies the .gbl file loaded in the GPM.
-
If the .gbl is valid, then the device installs the new firmware. This installation process can take up to eight seconds.
During the installation, the device is unresponsive to serial communication. -
To complete the installation, the target module resets. AT parameter settings which have not been written to flash using the WR command will be lost.
-
The firmware will be updated at this point. Query VR to confirm that the expected firmware version is running.