Last Updated on : 2025-06-17 03:21:50download
An over-the-air (OTA) update is the wireless delivery of new software, firmware, or other data to connected devices.
The Bluetooth mesh standard protocol (generic firmware key: keyen8gu
, v0.2 or later) supports OTA updates for the MCU.
Log in to the Tuya Developer Platform, upload the firmware file to Tuya’s servers, and configure upgrade settings. The Bluetooth module receives the firmware from the cloud and segments it into packets for transmission. The MCU receives the packets, verifies integrity, and writes the firmware to local flash memory. For more information, see Update Firmware and Select and Manage Firmware Versions.
Command | Description |
---|---|
0xD8 | The module queries the MCU version number |
0xD9 | Proactively report MCU version |
0xDA | Initiate an update request |
0xDB | Send the update file information |
0xDC | Request the update file offset |
0xDD | Transmit the update file |
0xDE | Verify the update |
0xDF | Request the update result |
The module sends the following data.
No. | Length (byte) | Field | Description |
---|---|---|---|
01 | 2 | Header | 0x550xAA |
2 | 1 | Version number | 0x00 |
3 | 1 | Command (CMD) | 0xD8 |
45 | 2 | Data length | 0x000x00 |
6 | 1 | CRC8 | 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.
No. | Length (byte) | Field | Description |
---|---|---|---|
01 | 2 | Header | 0x550xAA |
2 | 1 | Version number | 0x00 |
3 | 1 | Command (CMD) | 0xD8 |
45 | 2 | Data length | 0x000x08 |
6 to 13 | 8 | Data | See the following table |
14 | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
Data format
1-3 | 4-6 | 7-8 |
---|---|---|
MCU-soft-version | MCU-hard-version | Len |
MCU-soft-version
: The software version number of the MCU firmware. For example, 0x010000
means the version number is 1.0.0
.MCU-hard-version
: The hardware version number of the MCU firmware (PCBA version number). For example, 0x010000
means the version number is 1.0.0
.Len
: The maximum packet length for OTA update data (0xDD
). The MCU dynamically sets this value based on its available resources to optimize subsequent data transmissions.Len
) that the MCU can negotiate ranges from 64 bytes to 194 bytes. If the length exceeds the range, the module will set the length to the default 194 bytes.0xD8
: After the Bluetooth module sends the first heartbeat and receives a reply each time it is started, it sends this command once to proactively query the MCU’s version number.The MCU sends the following data.
No. | Length (byte) | Field | Description |
---|---|---|---|
01 | 2 | Header | 0x550xAA |
2 | 1 | Version number | 0x00 |
3 | 1 | Command (CMD) | 0xD9 |
45 | 2 | Data length | 0x000x08 |
6 to 13 | 8 | Data | See the following table |
14 | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
Data format
1-3 | 4-6 | 7-8 |
---|---|---|
MCU-soft-version | MCU-hard-version | Len |
MCU-soft-version
: The software version number of the MCU firmware. For example, 0x010000
means the version number is 1.0.0
.MCU-hard-version
: The hardware version number of the MCU firmware (PCBA version number). For example, 0x010000
means the version number is 1.0.0
.Len
: The maximum packet length for OTA update data (0xDD
). The MCU dynamically sets this value based on its available resources to optimize subsequent data transmissions.Len
) that the MCU can negotiate ranges from 64 bytes to 194 bytes. If the length exceeds the range, the module will set the length to the default 194 bytes.0xD9
: The MCU proactively sends the current version number to the module every time it starts (after the serial port initialization is completed). If no response is received, retransmission is required. The retry mechanism is determined by the MCU. This ensures the module gets and reports the firmware version promptly.The module returns the following data.
No. | Length (byte) | Field | Description |
---|---|---|---|
01 | 2 | Header | 0x550xAA |
2 | 1 | Version number | 0x00 |
3 | 1 | Command (CMD) | 0xD9 |
45 | 2 | Data length | 0x000x08 |
6 | 1 | State |
|
7 | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
The module sends the following data.
No. | Length (byte) | Field | Description |
---|---|---|---|
01 | 2 | Header | 0x550xAA |
2 | 1 | Version number | 0x00 |
3 | 1 | Command (CMD) | 0xDA |
45 | 2 | Data length | 0x000x00 |
6 | 1 | CRC8 | 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.
No. | Length (byte) | Field | Description |
---|---|---|---|
01 | 2 | Header | 0x550xAA |
2 | 1 | Version number | 0x00 |
3 | 1 | Command (CMD) | 0xDA |
45 | 2 | Data length | 0x000x04 |
6-9 | 4 | Data | See the following table |
10 | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
Data format
1 | 4-6 |
---|---|
State | version |
State
:
0x00
: accepts the update.0x01
: rejects the update.version
: The current firmware version. For example, 0x010002
represents 1.0.2
.Describe the information about the MCU update file. The MCU can compare the update information.
The module sends the following data.
No. | Length (byte) | Field | Description |
---|---|---|---|
01 | 2 | Header | 0x550xAA |
2 | 1 | Version number | 0x00 |
3 | 1 | Command (CMD) | 0xDB |
45 | 2 | Data length | 0x000x23 |
6-40 | 35 | Data | See the following table |
41 | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
Data format
8 bytes | 3 bytes | 16 bytes | 4 bytes | 4 bytes |
---|---|---|---|---|
Product ID (PID) | Version number (not currently applicable) | MD5 hash value of the file (not currently applicable) | File length | CRC32 |
PID: The PID of the MCU.
0x010001
represents version 1.0.2
(not currently applicable).The MCU returns the following data.
No. | Length (bytes) | Field | Description |
---|---|---|---|
01 | 2 | Header | 0x550xAA |
2 | 1 | Version number | 0x00 |
3 | 1 | Command (CMD) | 0xDB |
45 | 2 | Data length | 0x000x19 |
6-30 | 25 | Data | See the following table |
11 | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
Data format
8 bytes | 3 bytes | 16 bytes | 4 bytes |
---|---|---|---|
State | The size of the update that has already been downloaded. | The CRC32 checksum of the update that has already been downloaded. | The MD5 hash value of the update that has already been downloaded (not currently applicable). |
State
:
0x00
: The update is performed as expected.0x01
: The received PID does not match the one written to the device.0x02
: Reserved.0x03
: The update size exceeds the upper limit.0
, meaning downloading from scratch.0
.If using a gateway-initiated group update, the resumable transfer feature is disabled. Regardless of whether the MCU returns a previously stored file offset or 0
, the transfer will always start from offset 0
.
Send the start offset of the file and compare it with the offset returned by the MCU. If the two match exactly, the file transfer can continue from that offset. Otherwise, the entire file will be transferred from scratch.
The module sends the following data.
No. | Length (byte) | Field | Description |
---|---|---|---|
01 | 2 | Header | 0x550xAA |
2 | 1 | Version number | 0x00 |
3 | 1 | Command (CMD) | 0xDC |
45 | 2 | Data length | 0x000x04 |
6-9 | 4 | Offset | The offset where the file transfer starts. It is 4 bytes in length. |
10 | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
Offset
: The phone or gateway determines the transfer starting point based on the stored length and CRC32 match result from the device’s 0xDB
response.
The MCU returns the following data.
No. | Length (byte) | Field | Description |
---|---|---|---|
01 | 2 | Header | 0x550xAA |
2 | 1 | Version number | 0x00 |
3 | 1 | Command (CMD) | 0xDC |
45 | 2 | Data length | 0x000x04 |
6-9 | 4 | Offset | The start offset required by the MCU. |
10 | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
Offset
: The update offset saved by the device.
0
.The module sends the following data.
No. | Length (byte) | Field | Description |
---|---|---|---|
01 | 2 | Header | 0x550xAA |
2 | 1 | Version number | 0x00 |
3 | 1 | Command (CMD) | 0xDD |
45 | 2 | Data length (Len) | Upper 8 bitsLower 8 bits |
6 to 6+Len-1 | Len | Data | See the following table |
6+Len | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
Data format
4 bytes | 2 bytes | 2 bytes | n byte(s) |
---|---|---|---|
Data offset | The length (n) of current packet data | The CRC16 checksum of the current packet | The payload of the current packet |
Len
set in 0xd8
and 0xd9
commands).The MCU returns the following data.
No. | Length (byte) | Field | Description |
---|---|---|---|
01 | 2 | Header | 0x550xAA |
2 | 1 | Version number | 0x00 |
3 | 1 | Command (CMD) | 0xDD |
45 | 2 | Data length | 0x000x01 |
6 | 1 | State |
|
11 | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
The module sends the following data.
No. | Length (byte) | Field | Description |
---|---|---|---|
01 | 2 | Header | 0x550xAA |
2 | 1 | Version number | 0x00 |
3 | 1 | Command (CMD) | 0xDE |
45 | 2 | Data length | 0x000x00 |
6 | 1 | CRC8 | 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.
No. | Length (byte) | Field | Description |
---|---|---|---|
01 | 2 | Header | 0x550xAA |
2 | 1 | Version number | 0x00 |
3 | 1 | Command (CMD) | 0xDE |
45 | 2 | Data length | 0x000x01 |
6 | 1 | State |
|
7 | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
The module sends the following data.
No. | Length (byte) | Field | Description |
---|---|---|---|
01 | 2 | Header | 0x550xAA |
2 | 1 | Version number | 0x00 |
3 | 1 | Command (CMD) | 0xDF |
45 | 2 | Data length | 0x000x01 |
6 | 1 | State | The update result.
|
7 | 1 | CRC8 | 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.
No. | Length (byte) | Field | Description |
---|---|---|---|
01 | 2 | Header | 0x550xAA |
2 | 1 | Version number | 0x00 |
3 | 1 | Command (CMD) | 0xDF |
45 | 2 | Data length | 0x000x01 |
6 | 1 | State | Return value.
|
7 | 1 | CRC8 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder |
0xDF
), the MCU replies with a state indicating checksum verification status. If the module confirms success, the MCU waits 500 ms before rebooting to run the new firmware. No reboot occurs if the result fails.Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback