
Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
142
Ver.1.0.0
6.2.2 OTA Data Packet Format
Master sends command and data to Slave via “Write Command” in L2CAP layer.
Figure 6-2 Write Command Format in BLE Stack
The Attribute Handle value is the handle_value of OTA data on Slave side. The Attribute
Value length is set as 20, and the format is shown as below.
CRC
1
0
OTA_CMD
invalid data
19
OTA_cmd
1
0
2
19
18
17
OTA_data
adr_index
firmware data:adr_index*16 - adr_index*16+15
Figure 6-3 Format of OTA Command and Data
When the first two bytes are 0xff00 ~0xff10
, it indicates it’s an OTA command, and the
command type is determined by the two bytes:
1) 0xff00: OTA_FW_VERSION, request to obtain current Slave firmware version
number. This command is reserved and optional. To use this command,
corresponding callback function is available on Slave side for user to transfer
firmware version number.
2) 0xff01: OTA_Start command. To start OTA upgrade process, Master needs to send
this command to Slave.
3) 0xff02: OTA_end command. When Master confirms all OTA data are correctly
received by Slave, it will send this command, which can be followed by four valid
bytes to double check Slave has received all data from Master.
4) 0xff03 ~ 0xff0f: reserved for future use.
When the first two bytes are 0
~0x1000, it indicates it’s an OTA data. Each OTA data
packet transfers 16-byte firmware data, and the adr_index is the actual firmware address
divided by 16. “adr_index=0” indicates OTA data are values of firmware addresses
0x0~0xf
; “adr_index=1” indicates OTA data are values of firmware addresses 0x10~0x1f.
The last two bytes are the CRC value calculated by CRC_16 operation to the former 18
bytes. After Slave receives the OTA data, it will also carry out CRC calculation, the data