Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
138
Ver.1.0.0
4) OTA for the second time:
a) When power on, Slave starts booting and executing firmware2 from Flash
0x20000~0x40000.
b) When firmware2 is running, the area of Slave Flash starting from 0x0 (i.e. Flash
0~0x20000) is cleared during initialization and will be used as storage area for
new firmware.
c) OTA process starts, Master transfers firmware3 into Slave Flash area starting
from 0x0 via RF. Then Slave sets bootloader to boot from the new firmware
offset and reboots.
5) Subsequent OTA process repeats steps (1)~(4): (1)~(2) represents OTA of the
(2n+1)-th time, while (3)~(4) represents OTA of the (2n+2)-th time.
6.1.2 OTA Update Procedure
Based on the Flash storage structure introduced in section 6.1.1, the OTA update
procedure is illustrated as below:
8232 multi-address booting mechanism: OTA only uses two addresses booting (boot
from 0 or 0x20000). After MCU is powered on, Slave boots from Flash address 0 by
default. First Flash address 0x8 is read, if its value is 0x4b, the code starting from 0 are
transferred to RAM, and the following instruction fetch address equals 0 plus PC pointer
value; if the value of Flash 0x8 is not 0x4b, MCU directly reads Flash address 0x20008, if
its value is 0x4b, the code starting from 0x20000 are transferred to RAM, and the
following instruction fetch address equals 0x20000 plus PC pointer value.
By modifying flag bit value of Flash 0x8 and 0x20008, the part of Flash code to be
executed will be determined.
In TLSR8232 SDK with OTA function support, the OTA upgrade process of the (2n+1)-th
or (2n+2)-th time is shown as below:
1) After MCU is powered on, read Flash address 0x8 and 0x20008, and compare the
value with 0x4b to determine the booting address; then Slave boots from
corresponding address (0 or 0x20000) and starts executing the code. This function is
automatically completed by MCU hardware.
2) During firmware initialization, read MCU hardware register to judge the booting
address.
a) If booting address is 0, the ota_program_offset is set as 0x20000, and the area
of Slave Flash starting from 0x20000 (i.e. 0x20000~0x40000) will be all erased
to “0xff”, which indicates the new firmware will be transferred into this area by
Master during the following OTA process.
b) If booting address is 0x20000, the ota_program_offset is set as 0x0, and the
area of Slave Flash starting from 0x0 (i.e. 0~0x20000) will be all erased to 0xff,
which indicates the new firmware will be transferred into this area by Master
during the following OTA process.
3) Slave MCU executes the firmware after booting; OTA Master is powered on and
establishes BLE connection with Slave.
4) Trigger OTA Master to enter OTA mode by UI (e.g. button press, write memory by PC
tool, etc.). After entering OTA mode, OTA Master needs to obtain Handle value of