This document provides general information about the Bluetooth LE network and radio coprocessor frameworks on STM32WB05xN which is an ultra-low-power Bluetooth® Low Energy wireless network coprocessor. It also provides general information about supported HW configurations and some HW parameters required to achieve the maximum device performance.
1. Introduction
The STM32WB05xN supports the following network coprocessor options:
- Network coprocessor controller only (also called radio coprocessor (RCP))
- Network coprocessor host and controller (NCP)
In a network coprocessor controller only approach (or radio coprocessor (RCP)), the LE controller and the host reside in two separate microcontrollers. Communication between the two microcontrollers is done through a standard serial interface, e.g. UART, SPI. The host can send HCI commands to control the LE controller. The HCI interface and the HCI commands are standardized by the Bluetooth® core specification. Zephyr framework is tailored for a radio coprocessor approach.
In a network coprocessor host + controller (NCP) approach, the LE controller and the host reside in a single microcontroller.
User application is implemented on an external microcontroller and communication between the two microcontrollers is done through a standard serial interface, e.g. UART, SPI. A specific application interface (ACI) is provided for accessing the Bluetooth LE host and controller.
User application can send ACI commands to control the STM32WB05N Bluetooth LE network co-processor and receive events from it.
1.1. External microcontroller interface (UART or SPI)
A STM32WB05N device provides a hardware interface to external microcontroller based on two very common protocols:
- SPI slave protocol with interrupt signal (with low power mode enabled)
- UART (no power mode)
The physical layer (SPI or UART) is used to transfer commands and events between the external microcontroller and the STM32WB05N device.
1.1.1. UART interface
The characteristics of the UART interface are as follows:
- Baud rate: 921600
- Data bits: 8
- Parity: N
- Stop bits: 1
- Full duplex
The UART interface does not allow the device to go to sleep state and it requires two pins:
- UART TX
- UART RX
1.1.2. SPI interface
The characteristics of the SPI interface are the following:
- SPI clock: 1 MHz
- Data bits: 8
- Polarity: 1 (clock to 1 when idle)
- Phase: second edge
- Full duplex
- Slave mode
The SPI port requires five pins:
- SPI CLK
- SPI MOSI
- SPI MISO
- SPI CS
- SPI IRQ
A dedicated IRQ pin is used to inform the external microcontroller that an event has occurred and the device needs attention. The SPI interface allows the device to go into sleep state achieving the optimal power consumption.
2. External microcontroller interface (UART or SPI) example: X-CUBE-WB05N
The X-CUBE-WB05N SW package provides a reference SW framework for the STM32U5 external microcontroller connected to a X-NUCLEO-WB05KN1 including a STM32WB05KN device, but it can be easily portable across different MCU families, thanks to STM32Cube. UART and SPI interfaces are supported.
The X-CUBE-WB05N provides the binary images required for configuring, respectively, the STM32WB05KN device as a
- network coprocessor host + controller device (location + essential images; UART, SPI interfaces)
- radio coprocessor (controller only images; UART, SPI interfaces).
These prebuilt images are provided within the X-CUBE-WB05N installation, Utilities folder with associated readme files.
The X-NUCLEO-WB05KN1 kit is preloaded with the location + essential prebuilt binary image, UART mode.
If user wants to load any of available binary images on the STM32WB05xN device mounted on the X-NUCLEO-WB05KN1 expansion board, the following procedure should be followed:
- Connect the X-NUCLEO-WB05KN1 CN8 pins and the ST-LINK/V3 pins as described on following figure:
- Download and unpack the X-CUBE-WB05N containing the STM32WB05xN firmware image.
- Download and install the STM32CubeProg (v2.17.0 or later only).
- Connect the ST-LINK/V3 debugger to your PC.
- Open the STM32CubeProgrammer (STM32CubeProg) and:
- Select the STlink-V3 SWD probe and select Connect icon.
- Erase the STM32WB05xN Flash memory from [Erase Flash Memory]>[Full Chip Erase].
- Load the selected firmware contained in the X-CUBE-WB05N/Utilities folder and press the [Start Programming] button.
- The image flashed on the STM32WB05xN device can be used with the X-CUBE-WB05N software package.
Refer to UM3406: Getting started with the X-CUBE-WB05N Bluetooth Low Energy software expansion for STM32Cube[1] document for detailed information about the X-CUBE-WB05N SW package.
3. HW configurations and HW parameters
The prebuilt BLE_TransparentMode binary images provided on X-CUBE-WB05N SW package, utilities folder are generated with following default HW configurations and HW parameters:
- LSI crystal and LSI sleep clock accuracy: 500 ppm
- SMPS ON and Inductor: 10uH (BOM3)
- HSE startup timeout: 781 us
- HSE capacitor tune: 32
When user is defining a specific application/PCB for targeting a STM32WB05N network or radio coprocessor framework, in order to achieve the maximum performance, user should select some specific HW configurations (LSE or LSI, SMPS on or off), and some procedures should be also carried out before finalizing and define the best HW parameters values which affect the device performance.
In below chapter we will describe
- HW requirements to achieve such measures
- which settings should be considered and how estimating them
- how generating back final network processor image with new settings value
3.1. HW requirements
Whatever using SPI or UART interface, please ensure having following interface and tests points on your PCB.
For SPI interface, you should implement:
- SPI interface with host MCU
- SWD access (test points or connector). PA10 access will allow to force bootloader but also to output LSE
- Test points for UART interface (this will ease to define HSE centering and start up time)
For UART interface, you should implement
- UART interface with host MCU. Some tests points should be added on UART lines to define HSE centering and start up time (we might force the host MCU in reset to set its IOs interface in HighZ during those tests).
- SWD access (test points or connector). PA10 access will allow to force bootloader but also to output LSE
3.2. Which settings and how to measure?
In this chapter, we will detail the parameters to be estimated (LSE centering, HSE centering and start up time) and how to measure them. You may also refer to AN5503 [2].
3.2.1. LSE centering
If LSE is used, we must ensure to define proper load caps to center it.
The idea is to output LSE on PA10 pin.
A dedicated function is available inside STM32CubeWB0 SW package.
void HAL_RCCEx_EnableLSCO(RCC_LSCO2, RCC_LSCOSOURCE_LSE);
How to?
- Flash any SW from STM32CubeWB0 SW package modified so that LSE is output on PA10.
- Note1: sleep mode should be deactivated
- Note2: See chapter 4 for SW modification details
- Measure LSE clock and modify 32kHz load caps so that
- If DUT frequency > 32.768 kHz → increases XTAL caps
- If DUT frequency < 32.768 kHz → decreases XTAL caps
3.2.2. HSE centering
32 MHz crystal frequency must be centered and this has to be done by choosing the optimum load capacitors for a given circuit and layout. STM32WB0 has an integrated capacitor bank that can be set by software. How to?
- Flash BLE_TransparentMode_UART from STM32CubeWB0 SW package
- Note: See chapter 4 for SW modification details
- Connect STM32CubeMonRF PC tool through UART test points.
- Using “RF tests” panel, generate a carrier wave tone at Ch0 (freq. 2.402 GHz).
- If DUT frequency > 2402.05 MHz → internal capacitor bank must be increased
- If DUT frequency < 2401.95 MHz→ internal capacitor bank must be increased
You should then rebuild BLE_TransparentMode_UART FW with new internal capacitor (CFG_HW_RCC_HSE_CAPACITOR_TUNE) and repeat operation till you have define the best internal capacitor value. You may repeat this operation on multiple PCBs to define the average HSE TUNE value you will apply on all PCBs and final FW.
3.2.3. HSE start up time
A dedicated project is available inside STM32CubeWB0 SW package (Projects\NUCLEO-WB05KZ\Demonstrations\RADIO_TIMER\RADIO_TIMER_HSEStartupTime) You should then rebuild this FW (See chapter 4 for FW modification details) according HW configuration (LSE/LSI, SMPS usage) and HSE TUNE value defined in previous chapter. This application programs periodic wake-up of the system and it measures the start-up time of the HSE at each wake-up. The current and longer (worst) measure is reported on the UART interface. As explained in AN5503 [2]
- Set the device at min operating voltage
- HSE start up time value will be defined with below formula
HS_STARTUP_TIME = measured_value*1.1*1.3
4. Generate final network processor image
The references BLE_TransparentMode applications/projects to be used for the HW configurations parameters setting phase are available on STM32CubeWB0 SW package, Projects\NUCLEO-WB05KZ\Applications\BLE folder:
- BLE_TransparentMode_UART_for_Updater: Uart mode (location, essential configuration). It requires the BLE_TransparentMode_UART_Updater to be loaded as first step.
- BLE_TransparentMode_UART_for_Updater_C_O: Uart mode (controller only configuration). It requires the BLE_TransparentMode_UART_Updater to be loaded as first step.
- BLE_TransparentMode_SPI_for_Updater: SPI mode (location, essential configuration). It requires the BLE_TransparentMode_SPI_Updater to be loaded as first step.
- BLE_TransparentMode_SPI_for_Updater_C_O: SPI mode (controller only configuration). It requires the BLE_TransparentMode_SPI_Updater to be loaded as first step.
CAUTION: When building a specific BLE_TransparentMode application, user must also apply the related settings in terms of Bluetooth LE stack modular options, initialization parameters and number of supported radio tasks as described within the readme files associated to the related default BLE_TransparentMode binary image available on the X-CUBE-WB05N installation, Utilities folder.
- User should select LSE (external 32kHz Xtal) or internal RO when initializing the system clock configuration on the BLE_TransparentMode application to be loaded on STM32WB05N device.
- The selection is done through the standard RCC IP initialization procedure:
- If LSE is selected, on BLE_TransparentMode, main.c the following configuration is used:
void void SystemClock_Config(void)
{
....
InitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
....
}
static void MX_RADIO_TIMER_Init(void)
{
....
RADIO_TIMER_InitStruct.XTAL_StartupTime = 320;
RADIO_TIMER_InitStruct.enableInitialCalibration = FALSE;
RADIO_TIMER_InitStruct.periodicCalibrationInterval = 0;
HAL_RADIO_TIMER_Init(&RADIO_TIMER_InitStruct);
....
}
On associated app_conf.h, the CFG_LSCLK_LSE is defined as follow:
- define CFG_LSCLK_LSE (1)
- If LSI is selected, on BLE_TransparentMode, main.c the following configuration is used:
void void SystemClock_Config(void)
{
....
InitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSI;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
....
}
static void MX_RADIO_TIMER_Init(void)
{
....
RADIO_TIMER_InitStruct.XTAL_StartupTime = 320;
RADIO_TIMER_InitStruct.enableInitialCalibration = TRUE;
RADIO_TIMER_InitStruct.periodicCalibrationInterval = 10000;
HAL_RADIO_TIMER_Init(&RADIO_TIMER_InitStruct);
....
}
On associated app_conf.h, the CFG_LSCLK_LSE is defined as follow:
- define CFG_LSCLK_LSE (0)
If LSE is selected, user should follow the steps described on "AN5503, Section 7 LSOSC centering test oscillator", to center the oscillator frequency by changing the crystal capacitance. This procedure allows to define the best value of CFG_BLE_SLEEP_CLOCK_ACCURACY value on file app_conf.h associated to the final BLE_TransparentMode application to be rebuilt and loaded on STM32WB05N device.
4.2. HSE capacitor parameter
- User should define the correct value of HSE capacitor as described on "AN5503, Section 6 HSOSC centering testing" to center the HSE frequency. This procedure allows to define the best value of CFG_HW_RCC_HSE_CAPACITOR_TUNE value on file stm32wb0x_hal_conf.h associated to the final BLE_TransparentMode application to be rebuilt and loaded on STM32WB05N device (following the programming procedure previously described).
4.3. HSE start up time parameter
- User should define the best HSE start up time as described on "AN5503, Section 5 HS_Startup_Time" to optimize current consumption. This procedure allows to define the best value of HSE start up time value assigned to the RADIO_TIMER_InitStruct.XTAL_StartupTime parameter on MX_RADIO_TIMER_Init() function, on file main.c associated to the final BLE_TransparentMode application to be rebuilt and loaded on STM32WB05N device (following the programming procedure previously described).
4.4. SMPS configuration and parameters
- Configure SMPS according to the user selected SMPS HW configuration using specific preprocessor options on file system_stm32wb0x.c associated to the final BLE_TransparentMode application to be rebuilt and loaded on STM32WB05N device (following the programming procedure previously described):
- SMPS HW configuration (on, off, bypass) through the preprocessor option CFG_HW_SMPS (possible values: SMPS_ON, SMPS_OFF, SMPS_BYPAPSS)
- SMPS BOM/inductor value through the preprocessor option CFG_HW_SMPS_BOM (SMPS_BOM1, SMPS_BOM2, SMPS_BOM3)
- SMPS Low power configuration through the preprocessor option CFG_HW_SMPS_LOW_POWER (possible values: SMPS_LOW_POWER_OPEN, SMPS_LOW_POWER_NO_OPEN)
- NOTE: The default SMPS preprocessor options values for CFG_HW_SMPS, CFG_HW_SMPS_BOM and CFG_HW_SMPS_LOW_POWER are, respectively, SMPS_ON, SMPS_BOM3 and SMPS_LOW_POWER_OPEN.
5. References