STM32 Cube WBGetting Started
STM32 Cube WBGetting Started
User manual
Getting started with STM32CubeWB for STM32WB Series
Introduction
STM32Cube is an STMicroelectronics original initiative to make developers’ lives easier by
reducing development effort, time and cost. STM32Cube covers the whole STM32 portfolio.
STM32Cube includes:
• STM32CubeMX, a graphical software configuration tool that allows the generation of C
initialization code using graphical wizards.
• A comprehensive embedded software platform, delivered per Series (such as
STM32CubeWB for STM32WB Series):
– The STM32Cube HAL, STM32 abstraction layer embedded software ensuring
maximized portability across STM32 portfolio. The HAL is available for all
peripherals
– Low-layer APIs (LL) offering a fast light-weight expert-oriented layer which is
closer to the hardware than the HAL. LL APIs are available only for a set of
peripherals.
– A consistent set of middleware components such as USB Device, STMTouch
(STM32 touch sensing library), STM32_WPAN (Bluetooth® Low Energy 5.0,
OpenThread, 802-15-4 MAC, ZigBee), FatFS and FreeRTOS.
– All embedded software utilities coming with a full set of examples.
This user manual describes how to get started with the STM32CubeWB MCU Package.
Section 1 describes the main features of the STM32CubeWB MCU Package.
Section 2 and Section 3 provide an overview of the STM32CubeWB architecture and MCU
Package structure.
Contents
6 FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
6.1 What is the license scheme for the STM32CubeWB firmware? . . . . . . . . 32
6.2 What boards are supported by the STM32CubeWB firmware package? . 32
6.3 Are any examples provided with the ready-to-use toolset projects? . . . . 32
6.4 Is there any link with Standard Peripheral Libraries? . . . . . . . . . . . . . . . . 32
6.5 Does the HAL layer take benefit from interrupts or DMA?
How can this be controlled? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
7 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
List of tables
List of figures
The STM32CubeWB MCU Package runs on STM32 32-bit microcontrollers based on the
Arm®(a) Cortex®-M processor.
STM32CubeWB gathers, in a single package, all the generic embedded software
components required to develop an application on STM32WB microcontrollers. In line with
the STM32Cube initiative, this set of components is highly portable, not only within
STM32WB Series but also to other STM32 Series.
STM32CubeWB is fully compatible with STM32CubeMX code generator that allows
generating initialization code. The package includes low-layer (LL) and hardware
abstraction layer (HAL) APIs that cover the microcontroller hardware, together with an
extensive set of examples running on STMicroelectronics boards. The HAL and LL APIs are
available in open-source BSD license for user convenience.
STM32CubeWB MCU Package also contains a set of middleware components with the
corresponding examples. They come in free user-friendly license terms:
• CMSIS-RTOS implementation with FreeRTOS™ open source solution
• Full USB Device stack supporting many classes: Audio, HID, MSC, CDC and DFU
• STMTouch, touch sensing library solution
• STM32_WPAN, wireless personal area network middleware developed within the
STM32WB framework to support Bluetooth® Low Energy (BLE) 5.0, 802.15.4
OpenThread certified stacks, 802-15-4 MAC layer and ZigBee.
• FAT file system based on open source FatFS solution
Several applications and demonstrations implementing all these middleware components
are also provided in the STM32CubeWB MCU Package.
a. Arm is a registered trademark of Arm Limited (or its subsidiaries) in the US and or elsewhere.
STM32_WPAN
(Bluetooth 5,
Touch
USB RTOS Mesh V1.0, Zigbee 3.0,
library CMSIS
Thread, and 802.15.4
MAC layer)
Board support package (BSP) Low-layer APIs (LL) Hardware abstraction layer APIs (HAL)
The STM32CubeWB firmware solution is built around three independent levels that easily
interact as described in Figure 2.
Applications
Level 1
Library and protocol based components
(for example FatFS, USB, STMTouch, FreeRTOS™ or
STM32_WPAN)
Examples
HAL
MSv61375V1
2.1 Level 0
This level is divided into three sub-layers:
• Board support package (BSP)
• Hardware abstraction layer (HAL)
– HAL peripheral drivers
– Low-layer drivers
• Basic peripheral usage examples
(such as LCD, Audio, microSD™ and MEMS drivers). It is composed of two parts:
• Component
This is the driver relative to the external device on the board and not to the STM32. The
component driver provide specific APIs to the BSP driver external components and
could be portable on any other board.
• BSP driver
It allows linking the component driver to a specific board and provides a set of user-
friendly APIs. The API naming rule is BSP_FUNCT_Action().
Example: BSP_LED_Init(), BSP_LED_On()
The BSP is based on a modular architecture allowing an easy porting on any hardware by
just implementing the low-level routines.
2.2 Level 1
This level is divided into two sub-layers:
• Middleware components
• Examples based on the middleware components.
2.3 Level 2
This level is composed of a single layer which consist in a global real-time and graphical
demonstration based on the middleware service layer, the low-level abstraction layer and
the basic peripheral usage applications for board based features.
STM32WB10xx STM32WB10CCU
STM32WB15xx STM32WB15CCU, STM32WB15CCUxE, STM32WB15CCY
STM32WB30xx STM32WB30CEU5
STM32WB35CEU6, STM32WB35CEY6, STM32WB35CCU6,
STM32WB35xx
STM32WB35CCY6
STM32WB50xx STM32WB50CGU5
STM32WB55CGU6, STM32WB55CEU6, STM32WB55CCU6,
STM32WB55RGV6, STM32WB55REV6, STM32WB55RCV6,
STM32WB55xx
STM32WB55VGY6, STM32WB55VEY6, STM32WB55VCY6,
STM32WB55VGQ6, STM32WB55VEQ6, STM32WB55VCQ6
STM32WB5Mxx STM32WB5MMGH6
STM32CubeWB features a rich set of examples and applications at all levels making it easy
to understand and use any HAL driver and/or middleware components. These examples run
on the STMicroelectronics boards listed in Table 2.
P-NUCLEO-WB55.Nucleo STM32WB55RG
P-NUCLEO-WB55
P-NUCLEO-WB55.USBDongle STM32WB55CG
NUCLEO-WB35CE STM32WB35CE NA
NUCLEO-WB15CC STM32WB15CC NA
STM32WB5MM-DK STM32WB5MMG NA
functionalities:
• a Nucleo-68 board: P-NUCLEO-WB55.Nucleo
• a USB dongle: P-NUCLEO-WB55.USBDongle
The NUCLEO-WB35CE and P-NUCLEO-WB55.Nucleo are compatible with Adafruit® LCD
display Arduino® UNO shields which embed a microSD™ connector and a joystick in
addition to the LCD.
The Arduino® shield drivers are provided within the BSP component. Their usage is
illustrated by a demonstration firmware.
The STM32CubeWB firmware is able to run on any compatible hardware. The user simply
updates the BSP drivers to port the provided examples on his own board, if this latter has
the same hardware features (LED, LCD display, buttons...).
BSP driver
Drivers of external
components
Wireless personal
area network
middleware
Wirelss firmware
binaries
MS53625V1
1. The components files must not be modified by the user. Only the \Projects sources are eligible to changes
by the user.
For each board, a set of examples are provided with pre-configured projects for EWARM,
The examples are classified depending on the STM32Cube level they apply to, and are
• SW4STM32
a) Open the SW4STM32 toolchain
b) Click File->Switch Workspace->Other and browse to the SW4STM32
workspace directory
c) Click File->Import, select General->Existing Projects into Workspace and then
click Next
d) Browse to the SW4STM32 workspace directory and select the project
e) Rebuild all project files: select the project in the Project explorer window then
click the Project->build project menu
f) Run program: Run->Debug (F11)
implementations in user file (using a general purpose timer for example or other time
source). For more details, refer to HAL_TimeBase example.
4.2.3 LL application
This section describes the steps needed to create your own LL application using
STM32CubeWB.
1. Create your project
To create a new project you either start from the Templates_LL project provided for
each board under \Projects\<STM32xxx_yyy>\Templates_LL or from any available
project under \Projects\<STM32xxy_yyy>\Examples_LL (<STM32xxx_yyy> refers to
the board name, such as P-NUCLEO-WB55.Nucleo).
The Template project provides an empty main loop function, however it is a good
starting point to get familiar with project settings for STM32CubeWB.
Template main characteristics are the following:
– It contains the source codes of the LL and CMSIS drivers which are the minimal
components needed to develop code on a given board.
– It contains the include paths for all the required firmware components.
– It selects the supported STM32WB device and allows to configure the CMSIS and
LL drivers accordingly.
– It provides ready-to-use user files, that are pre-configured as follows:
main.h: LED & USER_BUTTON definition abstraction layer.
main.c: System clock configuration for maximum frequency.
2. Port an existing project to another board
To port an existing project to another target board, start from the Templates_LL project
provided for each board and available under
\Projects\<STM32xxx_yyy>\Templates_LL:
a) Select a LL example
To find the board on which LL examples are deployed, refer to the list of LL
examples STM32CubeProjectsList.html or to application note “STM32Cube
firmware examples for STM32WB Series” (AN5155).
b) Port the LL example
– Copy/paste the Templates_LL folder - to keep the initial source - or directly update
existing Templates_LL project.
– Then porting consists principally in replacing Templates_LL files by the
Examples_LL targeted project.
– Keep all board specific parts. For reasons of clarity, board specific parts have been
flagged with specific tags:
/* ========= BOARD SPECIFIC CONFIGURATION CODE BEGIN ========== */
/* ========== BOARD SPECIFIC CONFIGURATION CODE END ============ */
Thus the main porting steps are the following:
The STM32CubeWB firmware package contains several wireless stack binaries located
under Projects\STM32WB_Copro_Wireless_Binaries.
STM32WB5x (Projects\STM32WB_Copro_Wireless_Binaries\STM32WB5x)
The supported binaries are the following:
• - stm32wb5x_BLE_HCI_AdvScan_fw.bin
– HCI Layer only mode 5.2 certified: Link Layer, HCI
– BT SIG Certification listing: Declaration ID D042213
Usage: advertising and scanning through HCI interface
• stm32wb5x_BLE_LLD_fw.bin
– BLE LLD (low level driver) radio transparent firmware
Usage: direct access on BLE LLD features and API
• stm32wb5x_BLE_Stack_full_fw.bin
– Full BLE stack, certified 5.2: link layer, HCI, L2CAP, ATT, SM, GAP and GATT
database
– BT SIG certification listing: declaration ID D042164
– Following features are kept:
GAP peripheral, central (LL master up to 6 links with slave up to 2 links/ master up
to 7 links with slave up to 1 links/ Master up to 8 links)
GATT server, client
Data length extension
2Mbit PHY / PHY update
Privacy
White list
Legacy pairing, LE secure connections
HCI interface (full, like stm32wb5x_BLE_HCILayer_fw.bin)
Direct test mode
• stm32wb5x_BLE_Stack_light_fw.bin
– Full BLE stack 5.2 certified: link layer, HCI, L2CAP, ATT, SM, GAP and GATT
database
– BT SIG Certification listing: Declaration ID D042164
– Wireless BLE stack light configuration – slave only
– Following features are kept:
GAP peripheral only (LL slave up to 2 links)
GATT server
Data length extension
Privacy
White list
Legacy pairing, LE secure connections
HCI interface (reduced)
Direct test mode
– BLE slave only stack implies that with this stack configuration, STM32WB is not
• stm32wb5x_BLE_Thread_static_fw.bin
– Static concurrent mode BLE thread
– Supports full BLE stack 5.2 certified and full thread device certified v1.1
• stm32wb5x_BLE_Thread_dynamic.bin
– Dynamic concurrent mode BLE thread
– Supports full BLE stack 5.2 certified and full thread device certified v1.1
• stm32wb5x_Mac_802_15_4_fw.bin
– MAC API based on the latest official IEEE Std 802.15.4-2011
Usage: MAC FFD and RFD devices
• stm32wb5x_phy802_15_4_fw.bin
– 802.15.4 features exposed on application side
– Reduced number of commands called from application side to manage 802.15.4
API
– Not a transparent mode, 802.15.4 API not deployed on application side
– Can be used with STM32CubeMonitor-RF application or dedicated M4
application.
• stm32wb5x_Zigbee_FFD_fw.bin
– Zigbee compliant platform certified.
Supports: full function device (FFD)
• stm32wb5x_Zigbee_RFD_fw.bin
– Zigbee Reduced Function Device
– Zigbee Compliant Platform certified
Usage: end device Zigbee role
• stm32wb5x_BLE_Mac_802_15_4_fw.bin
– Static concurrent mode BLE MAC 802.15.4.
Supports: Full BLE stack 5.2 certified and MAC 802.15.4 API based on latest
official IEEE Std 802.15.4-2011
• stm32wb5x_BLE_Zigbee_FFD_static_fw.bin
– Static Concurrent Mode BLE Zigbee
Supports: full BLE Stack 5.2 certified and Zigbee FFD compliant platform certified
• stm32wb5x_BLE_Zigbee_RFD_static_fw.bin
– Static concurrent mode BLE Zigbee RFD
Supports full BLE stack 5.2 certified and Zigbee RFD (reduced function device)
compliant platform certified
– Optimized for power consumption.
• stm32wb5x_BLE_Zigbee_FFD_dynamic_fw.bin
– Dynamic Concurrent Mode BLE Zigbee FFD
Supports full BLE stack 5.2 certified and Zigbee FFD (full function device)
compliant platform certified
• stm32wb5x_BLE_Zigbee_RFD_dynamic_fw.bin
– Dynamic concurrent mode BLE Zigbee RFD
Supports full BLE stack 5.0 certified and Zigbee RFD (reduced function device)
compliant platform certified
STM32WB3x (Projects\STM32WB_Copro_Wireless_Binaries\STM32WB3x)
The supported binaries are the following:
• - stm32wb3x_BLE_HCI_AdvScan_fw.bin
– HCI Layer only mode 5.2 certified: Link Layer, HCI
– BT SIG Certification listing: Declaration ID D042213
Usage: advertising and scanning through HCI interface
• stm32wb3x_BLE_LLD_fw.bin
– BLE LLD (low level driver) radio transparent firmware
Usage: direct access on BLE LLD features and API
• stm32wb3x_BLE_Stack_full_fw.bin
– Full BLE stack, certified 5.2: link layer, HCI, L2CAP, ATT, SM, GAP and GATT
database
– BT SIG certification listing: declaration ID D042164
– Following features are kept:
GAP peripheral, central (LL master up to 6 links with slave up to 2 links/ master up
to 7 links with slave up to 1 links/ Master up to 8 links)
GATT server, client
Data length extension
2Mbit PHY / PHY update
Privacy
White list
Legacy pairing, LE secure connections
HCI interface (full, like stm32wb5x_BLE_HCILayer_fw.bin)
Direct test mode
• stm32wb3x_BLE_Stack_light_fw.bin
– Full BLE stack 5.2 certified: link layer, HCI, L2CAP, ATT, SM, GAP and GATT
database
– BT SIG Certification listing: Declaration ID D042164
– Wireless BLE stack light configuration – slave only
– Following features are kept:
GAP peripheral only (LL slave up to 2 links)
GATT server
Data length extension
Privacy
White list
Legacy pairing, LE secure connections
HCI interface (reduced)
Direct test mode
– BLE slave only stack implies that with this stack configuration, STM32WB is not
– Communication between the RCP and the host processor is managed by open
thread daemon through an SPI interface over the Spinel protocol.
• stm32wb3x_Mac_802_15_4_fw.bin
– MAC API is based on latest official IEEE Std 802.15.4-2011
Usage: MAC FFD and RFD devices
• stm32wb3x_phy802_15_4_fw.bin
– 802.15.4 features exposed on application side
– Reduced number of commands called from application side to manage 802.15.4
API
– Not a transparent mode, 802.15.4 API not deployed on application side
– Can be used with STM32CubeMonitor-RF application or dedicated M4
application.
• stm32wb3x_Zigbee_FFD_fw.bin
– Zigbee compliant platform certified.
Supports: full function device (FFD)
• stm32wb3x_Zigbee_RFD_fw.bin
– Zigbee Reduced Function Device
– Zigbee Compliant Platform certified
Usage: end device Zigbee role
• stm32wb3x_BLE_Mac_802_15_4_fw.bin
Static concurrent mode BLE MAC 802.15.4.
Supports: Full BLE stack 5.2 certified and MAC 802.15.4 API based on latest
official IEEE Std 802.15.4-2011
STM32WB1x (Projects\STM32WB_Copro_Wireless_Binaries\STM32WB1x)
The supported binaries are the following:
• - stm32wb1x_BLE_HCI_AdvScan_fw.bin
– HCI Layer only mode 5.2 certified: Link Layer, HCI
– BT SIG Certification listing: Declaration ID D042213
Usage: advertising and scanning through HCI interface
• stm32wb1x_BLE_LLD_fw.bin
– BLE LLD (low level driver) radio transparent firmware
Usage: direct access on BLE LLD features and API
• stm32wb1x_BLE_Stack_full_fw.bin
– Full BLE stack, certified 5.2: link layer, HCI, L2CAP, ATT, SM, GAP and GATT
database
– BT SIG certification listing: declaration ID D042164
– Following features are kept:
GAP peripheral, central (LL master up to 6 links with slave up to 2 links/ master up
to 7 links with slave up to 1 links/ Master up to 8 links)
GATT server, client
Data length extension
2Mbit PHY / PHY update
Privacy
White list
Legacy pairing, LE secure connections
HCI interface (full, like stm32wb5x_BLE_HCILayer_fw.bin)
Direct test mode
• stm32wb1x_BLE_Stack_light_fw.bin
– Full BLE stack 5.2 certified: link layer, HCI, L2CAP, ATT, SM, GAP and GATT
database
– BT SIG Certification listing: Declaration ID D042164
– Wireless BLE stack light configuration – slave only
– Following features are kept:
GAP peripheral only (LL slave up to 2 links)
GATT server
Data length extension
Privacy
White list
Legacy pairing, LE secure connections
HCI interface (reduced)
Direct test mode
– BLE slave only stack implies that with this stack configuration, STM32WB is not
able to scan and request a BLE connection.
– It just advertise, and accept incoming connection request from other master
devices (e.g. smartphone) (slave up to 2 links).
– While with the full feature BLE stack, STM32WB1xx is able to support both master
and slave roles on different links
• stm32wb1x_BLE_Stack_basic_fw.bin
– Full BLE stack 5.2 certified: link layer, HCI, L2CAP, ATT, SM, GAP and GATT
database
– BT SIG certification listing: Declaration ID D042164
– Wireless BLE stack basic configuration
– Following features are kept:
GAP peripheral and central (8 links - LL slave up to 2 links)
GATT server, client
Data length extension
Privacy
White list
Legacy Pairing, LE secure connections
HCI interface (reduced)
6 FAQ
allows an easier migration from the SPL to the STM32Cube LL drivers, since each SPL
API has its equivalent LL API(s).
6.5 Does the HAL layer take benefit from interrupts or DMA?
How can this be controlled?
Yes. The HAL layer supports three API programming models: polling, interrupt and DMA
(with or without interrupt generation).
6.10 Can I use HAL and LL drivers together? If yes, what are the
constraints?
It is possible to use both HAL and LL drivers. One handles the IP initialization phase with
HAL and then manages the I/O operations with LL drivers.
The major difference between HAL and LL is that HAL drivers require to create and use
handles for operation management while LL drivers operates directly on peripheral
6.11 Are there any LL APIs which are not available with HAL?
Yes, there are.
A few Cortex® APIs have been added in stm32wbxx_ll_cortex.h , for instance for accessing
SCB or SysTick registers.
7 Revision history
STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications, and
improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on
ST products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at the time of order
acknowledgement.
Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or
the design of Purchasers’ products.
Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product.
ST and the ST logo are trademarks of ST. For additional information about ST trademarks, please refer to www.st.com/trademarks. All other
product or service names are the property of their respective owners.
Information in this document supersedes and replaces information previously supplied in any prior versions of this document.