OTA Update Process (Bluetooth Low Energy)
This topic describes the process by which an Echo device and a gadget communicate to perform an over-the-air (OTA) update over Bluetooth Low Energy (BLE).
For the requirements that your gadget must meet to perform OTA updates, see OTA Update Prerequisites.
- Connect over BLE
- Find the gadget's firmware version
- Start the OTA update
- Transfer the firmware image
- Apply the update
The following figure provides an overview of the OTA process, followed by a description of the steps. This process uses three streams: the control stream, Alexa stream, and OTA stream.
Connect over BLE
First, the Echo device and the gadget perform all the steps up to and including the handshake over BLE, just as they do in the original pairing and connection or reconnection flow.
Find the gadget's firmware version
When the Echo device and the gadget connect, the Echo device sends the gadget a
Discover directive. (This occurs anytime the Echo device and the gadget connect.) The gadget responds with a
Discover.Response event that, along with other information, contains the current firmware version of the gadget. The Alexa service uses this information to determine whether the gadget needs a firmware update. Because
Alexa.Discovery is an Alexa Gadgets Toolkit interface, the
Discover directive and the
Discover.Response event use the Alexa stream.
Start the OTA update
If the Alexa service determines that the gadget needs a firmware update, the Echo device sends the gadget an
UpdateComponentSegment message over the control stream. The last packet of the transaction that contains the
UpdateComponentSegment message will have the ACK flag set in the header, so the gadget must send an ACK/NACK packet in response to the last packet of the transaction.
Transfer the firmware image
Using the OTA stream, the Echo device transfers the firmware image to the gadget in chunks by sending the gadget one or more
UpdateComponent messages. The chunk size is less than or equal to the maximum transactional data size that the gadget reported in the protocol version packet. For example, if the firmware image size is 540 KB and the maximum transactional data size is 100 KB, then the Echo device will send the gadget six
UpdateComponent messages (five 100 KB chunks and one 40 KB chunk).
Apply the update
After the gadget receives the complete firmware image, it responds to the
UpdateComponentSegment message using the control stream. Then, the Echo device sends the gadget an
ApplyFirmware message, also over the control stream, to instruct the gadget to use the new firmware.
The packet that contains the
ApplyFirmware message from the Echo device will have the ACK flag set in the header, so the gadget must send an ACK/NACK packet in response to the last packet of the transaction.
When the gadget sends a final response to the
ApplyFirmware command, the update is complete.
Last updated: Feb 14, 2022