How to build a STM32WBA Bluetooth® Low Energy project

1. Presentation

This page describes how to build easily and install STM32WBA Bluetooth® Low Energy example applications.
Project examples can be found on STM32CubeWBA MCU Package[1], and are available for different platforms.

STMicroelectronics Bluetooth® Low Energy example project directory
WBA BLE application folder.png


Some of the following information can be retrieved from the STM32WBA application note.

2. Requirements

2.1. Software and system requirements

The required softwares are the following (minimum IDEs version):

  • IAR Embedded Workbench for Arm (EWARM) toolchain V9.20.1, plus a patch available in the WBA firmware package: STM32Cube_FW_WBA_Vx.x.x/Utilities/PC_Software/EWARMv8_STM32WBAx_V1.2.zip
  • RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.37, plus a patch available in the WBA firmware package: STM32Cube_FW_WBA_Vx.x.x/Utilities/PC_Software/Keil.STM32WBAx_DFP.1.0.0.zip
  • STM32CubeIDE toolchain V1.12.0 [2].

The required programmer is the following:

  • STM32CubeProgrammer[3]: To flash the board with an already generated binary

2.2. Hardware requirements

The board NUCLEO-WBA52CG [4] is necessary to install the application.

Hardware platforms illustration
Connectivity Nucleo-WBA5.jpg


3. Bluetooth® Low Energy Host Stack and Link Layer libraries compatibilities

In order to use Bluetooth® Low Energy connectivity in STM32WBA projects, an association of two libraries is required:

  • One library implementing the Link Layer
  • One library for the STLINK Layer Controller(called sometimes in documentation Bluetooth® Low Energy Controller) and/or Bluetooth® Low Energy Host Stack
Bluetooth® Low Energy Stack interface
Host Stack Solution Link Layer Only Solution
Connectivity WBA BLE Stack interface.png
Connectivity WBA BLE Stack Schema ThirdParty.png


Different Bluetooth® Low Energy Host Stack variants are available in the STM32WBA package, depending on project requirements. Depending on the variant, the associated Link Layer library must be included in the project:

  • stm32wba_ble_stack_full.a: full host stack + ST LL controller, requires LinkLayer_BLE_Full_lib.a to work.
  • stm32wba_ble_stack_basic.a: basic host stack + ST LL controller (basic features), requires LinkLayer_BLE_Basic_lib.a to work.
  • stm32wba_ble_stack_llo.a: ST LL controller only, requires LinkLayer_BLE_Full_lib.a to work.
  • stm32wba_ble_stack_llobasic.a: ST LL controller (basic features) only, requires LinkLayer_BLE_Basic_lib.a to work.

It is possible to interact directly at HCI + ACI interface (or HCI in LL only case) level by using STM32CubeMonitor-RF and the Transparent Mode application. See STM32WBA TransparentMode wiki page for more information.

Information about the Bluetooth® Low Energy Host Stack and Link Layer libraries, and the different configurations for STM32WBA projects are available in: STM32Cube_FW_WBA_Vx.x.x/Middlewares/ST/STM32_WPAN/ble/stack/doc/STM32WBA_BLE_Stack_User_Manual.html

4. Build and install the application

This section describes the build process using IAR Embedded Workbench or STM32CubeIDE.

4.1. Build with IAR Embedded Workbench IDE

Select the application that you want to build. Open the IAR (EWARM) dedicated directory and launch the project.eww IAR file to open the demonstration project on IDE.

IAR project directory
Connectivity WBA IAR proj location.png


Ensure that your project is correctly visible into the Project explorer view.

Build your project by reproducing the following steps:

IAR: build
Connectivity WBA IAR proj build.png


You can build and flash the project on your board by clicking on the button illustrated below:

IAR: build and flash memory
Connectivity WBA IAR proj run.png

4.2. Buid with STM32CubeIDE

Select the application that you want to build. Open the STM32CubeIDE dedicated directory and launch the Cube IDE.project of the demonstration.

STM32CubeIDE project folder
Connectivity WBA CDE proj location.png



Ensure that your project is correctly visible into the Project explorer view.
Build you project by reproducing the following steps:

STM32CubeIDE: build
Connectivity WBA CDE proj build.png


Flash it on the board:

STM32CubeIDE: Flash memory
Connectivity WBA CDE proj run.png

4.3. Install from STM32CubeProgrammer

It is possible to flash the binary built following the IAR Embedded Workbench IDE or STM32CubeIDE section, using the STM32CubeProgrammer software[5].

Select your device and connect to it:

STM32CubeProgrammer: platform connection
Connectivity WBA cubeProg 1.png


Once connected, the device information is displayed on the STM32CubeProgrammer interface. Click on the programming icon, in the left column, and select the project binary to flash:

  • STM32Cube_FW_WBA_V[...]\Projects\[...]\Applications\BLE\BLE_p2pServer\[...]\ BLE_p2pServer.bin

Set the Start address to 0x08000000.

Info white.png Information
The Start address is different for Firmware Update Over The Air application, please refer to BLE_Fuota page.


Then, click ok on the Start Programming button:

STM32CubeProgrammer: flash project
Connectivity WBA cubeProg 2.png


When the programming is complete, the following logs are displayed:

STM32CubeProgrammer: logs
Connectivity WBA cubeProg 3.png

5. References