Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
143
Ver.1.0.0
will be regarded as valid only when the result matches the CRC (19
th
~20
th
byte) of the
data.
6.2.3 RF Transfer Processing on Master Side
Since BLE link-layer RF data will be automatically responded with ack to avoid packet
loss, during OTA data transfer Master won’t check if every OTA data is responded with
ack, that is, after sending an OTA data
via write command, Master won’t check if there’s
ack response from Slave by software, and directly push the following data into TX buffer
as long as the number of data to be sent in TX buffer does not reach the threshold.
The OTA Master processes RF transfer by software as below:
1) Check if
there’s any action to trigger entering OTA mode. If so, Master enters OTA
mode.
2) To send OTA commands and data to Slave, Master needs to know the Attribute
Handle value of current OTA data Attribute on Slave side. Users can decide to
directly use the pre-appointed value or obtain the Handle val
ue via “Read By Type
Request
”. UUID of OTA data in Telink BLE SDK is always 16-byte value as shown
below:
#define
TELINK_SPP_DATA_OTA
{0x12,0x2B,0x0d,0x0c,0x0b,0x0a,0x09,0x08,0x07,0x06,0x05,0x04,
0x03,0x02,0x01,0x00}
//!< TELINK_SPP data for ota
In “Read By Type Request” from Master, the “Type” is set as the 16-byte UUID. The
Attribute Handle for the OTA UUID is available from “Read By Type Rsp” responded
by Slave. In the figure below, the Attribute Handle
value is shown as “0x0031”.
Figure 6-4 Master O
btains OTA Attribute Handle via “Read By Type Request”
3) (optional) Obtain current Slave firmware version number. User can check
if it’s the
newest version and decide whether to start OTA upgrade correspondingly.
In 5316 BLE SDK, user needs to determine the method to obtain FW version
number.
An OTA version command is reserved, however, the transfer of version number is
not realized in current 5316
BLE SDK. An “OTA version cmd” can be sent to Slave in
the form of “write cmd”; Slave only supplies a callback function after it receives the
request, and user needs to decide in the callback function how to transfer Slave
firmware version number to Master (e.g. manually send a NOTIFY/INDICATE data).
4) Start a timer when OTA starts, and continuously check if the count value exceeds the
timeout duration (e.g. 15s, only for reference).
If so, it’s regarded as OTA failure due
to timeout. Since Slave will check CRC after the OTA data are received, once there’s
CRC error or any other error (e.g. Flash burning error), OTA fails, and firmware is