Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
141
Ver.1.0.0
Case 1 is the default distribution, the maximum firmware size is 48kB with 16kB left for
User Data Area.
If 52K < firmware size <=56K, users can use Case 2 which has no extra Flash space for
user data.
If 48K < firmware size <=52K, users can use Case 3 which has extra Flash area for user
data.
For Case 2 and Case 3, the API below should be called to set actual firmware size
(firmware size should be 4kB aligned), and ota_offset should be set to 0x10000.
void bls_ota_setFirmwareSizeAndOffset(int firmware_size_k, u32 ota_offset);
6.2 RF Data Proceesing in OTA Mode
6.2.1 OTA Processing in Attribute Table on Slave Side
First, OTA reference needs to be added to app_att.c which includes the Attribute Table:
#include
<stack/ble/ble.h>
//
includes the reference of ble_ll_ota.h.
Second, add OTA related contents in the Attribute Table. The “att_readwrite_callback_t r”
and
“att_readwrite_callback_t w” of the OTA data Attribute should be set as otaRead and
otaWrite, respectively; the attribute should be set as Read and Write_without_Rsp
(Master sends data via Write Command, and does not need Slave to respond with ack to
enable faster speed).
static u8 my_OtaProp= CHAR_PROP_READ | CHAR_PROP_WRITE_WITHOUT_RSP;
{0,2,1,1,(u8*)(&my_characterUUID), (u8*)(&my_OtaProp), 0},
{0,2,1,1,(u8*)(&my_OtaUUID), (&my_OtaData), &otaWrite, &otaRead},
{0,2,sizeof (my_OtaName), sizeof (my_OtaName),(u8*)(&userdesc_UUID),
(u8*)(my_OtaName), 0},
When Master sends OTA data to Slave, it actually writes data to the second Attribute as
shown above, so Master needs to know the Attribute Handle of this Attribute in the
Attribute Table. To use the Attribute Handle value pre-appointed by Master and Slave,
user needs to count the Attribute Handle value, and then define it on Master side.