OTA Update Prerequisites
For your gadget to receive OTA updates, ensure that the requirements in this topic are met. Then refer to OTA Update Process (Bluetooth Low Energy) or OTA Update Process (Classic Bluetooth), depending on the transport that your gadget uses to connect to the Echo device.
You must upload the new firmware image to the Alexa cloud before an Echo device can download the image to a gadget. To upload a firmware image to the Alexa cloud, please work with your partner on the Alexa Gadgets team or email email@example.com. Every time you upload a firmware image for the same gadget type, the Alexa cloud increases the OTA version number of the uploaded image. The maximum OTA image size is 7 MB.
The OTA update will only occur if the OTA version number of the update is larger than the OTA version number that the gadget reports in the
firmwareVersion field of its
Discover.Response event. The requirements for the OTA version are as follows:
- The gadget must store its OTA version in non-volatile memory. The gadget first stores a default value. After it starts to receive OTA updates, the gadget gets its OTA version during the update process.
- The initial value of the gadget's OTA version must be zero.
- When the Echo device sends the gadget a
Discoverdirective during Bluetooth connection or reconnection, the gadget must respond with a
Discover.Responseevent that contains its OTA version in the
To avoid overwriting the existing image, your gadget must have enough flash to store two images: the "active" image (the image that is currently running), and the OTA image. You can store these in separate partitions. For example, you might divide your gadget's memory into three sections, as follows:
| 0x0000 – 0x1FFF | (Non-volatile data that doesn't change with OTA) | 0x2000 – 0x5999 | (Image section 1) | 0x6000 – 0x9FFF | (Image section 2)
Image sections 1 and 2 can take turns being the active section and the OTA section. The active section is the section that the gadget loads into RAM when the gadget boots up. The OTA section is only used to store the downloaded OTA image. After downloading and verifying the OTA image in the OTA section, the gadget changes the boot address to the address of the section that contains the OTA image. Therefore, when the gadget resets, it loads the new image instead of the old one.