Over-the-air application and wireless firmware update for
STM32WB Series microcontrollers
Introduction
This document describes the procedure for over-the-air (OTA) firmware update on ST32WB
devices with Bluetooth
application provided within the STM32Cube firmware package.
This application can update the user application, the wireless firmware and the firmware
upgrade service.
®
Low Energy (BLE) connection. It explains how to use the OTA
UM2288:STM32CubeMonitor-RF software tool for wireless performance
measurements
All these documents are available on www.st.com.
®
Low-Energy and 802.15.4 radio solution
®
-based Cortex®-M4 with FPU,
6/36AN5247 Rev 3
AN5247OTA application on STM32WB devices
MS51778V3
Wireless stackFUS
BLE user
application
OTA
application
CPU2
CPU1
Updatable by
OTA
Not updatable
by OTA
3 OTA application on STM32WB devices
3.1 Over-the-air firmware update
3.1.1 Principle
Updating firmware during device lifetime is mandatory to guarantee state-of-art
performance, to update the application with new features or corrected patches, and to keep
the highest security level.
User application, wireless firmware and FUS update
The STM32WB Series microcontrollers are based on a dual Arm
®(a)
core.
The user application runs on CPU1 (Cortex® M4), while wireless firmware and FUS run on
CPU2 (Cortex
As wireless and FUS are delivered in encrypted format, their update procedure relies on the
STM
32WB secure firmware for decryption and installation in the protected area of the Flash
memory.
®
M0+). The three applications can be updated independently.
Figure 1. STM32WB dual core FW architecture
Over the air
Update of firmware can be done thanks to typical physical links such as USB, UART or I2C
but this procedure requires a physical access with specific connectors on the device.
Thanks to OTA it is possible to remotely update the firmware by using a wireless connection.
In this application note, the wireless connection uses the BLE protocol.
a. Arm is a registered trademark of Arm Limited (or its subsidiaries) in the US and/or elsewhere.
AN5247 Rev 37/36
35
OTA application on STM32WB devicesAN5247
Update clients
Update procedure follows a client/server architecture. It is initiated by an external client and
the device acts as a server, responding to the request by installing the new firmware.
In this application note two examples (see Figure 2) of BLE-based OTA clients provided by
STMicroelectronics are presented:
ST BLE Sensor: a mobile application for Android™ or iOS devices
STMCubeMonitor-RF: a PC tool communicating with a BLE USE dongle configured in
HCI transparent mode
Figure 2. Update of STM32WB firmware through BLE connection
8/36AN5247 Rev 3
AN5247OTA application on STM32WB devices
MS51780V1
System reset
OTA request?
Application
update service
Wireless
update service
RSS wireless
update service
OTA clientUser app
3 Reboot service
2 OTA request
4 Yes
1 No
6 User FW or
wireless stack
update request
7 Update
5 OTA app active
OTA appOTA client
3.1.2 OTA application
OTA application is designed as a standalone application with BLE services for managing
firmware transfer on client request, and its installation at the right place in the Flash memory.
It is active and executed by CPU1 after an OTA request has been received by the user
application.
The sequence is shown in Figure 3, where the numbers in red indicate the different stages.
Initial state is the user application running (1). When an OTA request is received (2), a
system reset is triggered (3) and the OTA application becomes active (4) listening for client
requests (5). Different services are provided for the update of wireless firmware or user
application (6 and 7).
Figure 3. OTA procedure sequence
Note:With this firmware architecture, the current user application is responsible for receiving OTA
requests for both the user application and the wireless firmware. This is the entry point of
the procedure. OTA application then communicates with the client to update either one or
the other firmware.
3.1.3 Memory architecture
The Flash memory of STM32WB is split in two parts, a user and a secure one. The user part
is accessible by CPU1 and contains the OTA application as well as the user application
code and data. The secure part is accessible by CPU2 only, and contains FUS and the
wireless firmware. This part is not accessible by the debug port, by the user application or
by the bootloader. The boundary between the two areas is given by the option byte SFSA,
the memory above is secure (see
firmware size, it is adjusted during the install procedure.
Figure 4). The SFSA value depends on the wireless
AN5247 Rev 39/36
35
OTA application on STM32WB devicesAN5247
MS51781V2
OTA application
User data
User application
Free area
Wireless FW
FUS
Flash memory
SFSA
CPU2
CPU1
0x080000000
0x080FFFFF
SecureUser part
The location of firmware involved on the OTA procedure is shown in Figure 4.
Figure 4. Simplified memory map of applications
FUS
FUS is stored at the top of the Flash memory. It embeds the secure firmware for wireless
firmware decryption and authentication. It also offers a secure storage for cryptographic
keys. Refer to
[2] for a detailed description of its features.
Wireless firmware
It is stored just below FUS. This firmware drives the RF part of the MCU. Several protocols
are supported: full BLE stack, BLE HCI only layer, Thread MTD, Thread FTD, concurrent
mode (BLE + Thread FTD) and MAC 802.15.4 (low-level access to RF MAC). All stacks are
available on www.st.com.
For BLE, the stack implements the real-time aspects. It contains the LE controller and LE
host needed to manage all real time link layer and radio PHY interaction (
Figure 5).
10/36AN5247 Rev 3
AN5247OTA application on STM32WB devices
Figure 5. BLE application and wireless firmware architecture
User application and data
This is the main user application. It is the applicative part of the device, implementing the
BLE profiles and services relying on a wireless protocol. Communication between the user
application and the wireless part is done through a mailbox system implemented thanks to
the SRAM2 and IPCC hardware blocks (
application in the user Flash memory.
For convenience, a sector for application data not be erased during firmware update can be
reserved between the two applications.
Note:A free area of the Flash memory must be available for the new wireless image download in
case of updates.
AN5247 Rev 311/36
Figure 5). It is stored just above the OTA
35
Loading...
+ 25 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.