Last Updated on : 2024-06-04 07:44:12download
This topic describes how to update the MCU firmware over-the-air (OTA).
An over-the-air (OTA) update is the wireless delivery of new software, firmware, or other data to connected devices.
The cellular standard protocol supports OTA updates for the MCU. You can upload the update file to the Developer Platform. The cellular module can download the update from the server and send it to the MCU through the serial port. This way, the MCU gets the update and writes it to the local flash memory for installation. For more information, see Update Firmware and Select and Change the Firmware Version.
The OTA update consumes the memory of the MCU. After a device is paired, an OTA update can be initiated through the preset configuration or check for updates. Here is how the OTA update works:
The OTA update can be initiated automatically or manually.
The module sends the following data.
U: protocol version 0: 0x00
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x00 |
Command | 1 | 0x0a |
Data length | 2 | 0x0004 |
Data | 4 | The size of the update file in bytes. The data type is an unsigned integer, and the data is transmitted in big-endian format. |
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
For example, 0x55aa 00 0a 0004 00006800 75
indicates the size of the update file is 26624 bytes (26 KB).
U: protocol version 1: 0x01
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x01 |
Command | 1 | 0x0a |
Data length | 2 | 0x004F |
Data | 40 |
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
The MCU returns the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x03 |
Command | 1 | 0x0a |
Data length | 2 | 0x0001 |
Data | 1 | The options for the maximum size of each packet:
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 0x55aa 03 0a 0001 00 0d
Data format:
The update channel (for protocol version 1) + packet offset (unsigned short) + payload.
When the MCU receives a frame with a length of four bytes and the fragment offset is equal to or greater than the size of the firmware update, the transfer is completed.
For the last packet, the packet offset is the firmware size, and the packet length is 0 bytes.
The module sends the following data.
U: protocol version 0 (0x00):
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x00 |
Command | 1 | 0x0b |
Data length | 2 | The data length is the sum of 0x0004 and the packet length. |
Data | 4 + N | The first four bytes are fixed as packet offset, and the latter bytes are the actual data. |
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
U: protocol version 1 0x01:
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x01 |
Command | 1 | 0x0b |
Data length | 2 | The data length is the sum of 0x0005 and the packet length. |
Data | 5 + N |
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Assume that the size of the update is 530 bytes, and the MCU does not need to respond to the last packet.
0x00000000
, and the packet length is 256 bytes. The module sends 0x55aa 00 0b 0104 00000000 xx…xx XX
.0x00000100
, and the packet length is 256 bytes. The module sends 0x55aa 00 0b 0104 00000100 xx…xx XX
.0x00000200
, and the packet length is 18 bytes. The module sends 0x55aa 00 0b 0016 00000200 xx…xx XX
.0x00000212
, and the packet length is 0 bytes. The module sends 0x55aa 00 0b 0004 00000212 xx...xx XX
.The MCU returns the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x03 |
Command | 1 | 0x0b |
Data length | 2 | 0x0000 |
Data | 0 | None |
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 0x55aa 03 0b 0000 0d
The module sends the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x00 |
Command | 1 | 0x34 |
Data length | 2 | 0x0002 |
Data | 2 |
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
The MCU returns the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x03 |
Command | 1 | 0x34 |
Data length | 2 | 0x0001 |
Data | 1 | 0x09 (subcommand) |
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback