Author:Jens Wallmann
Abstract:This article introduces the ultra-low power STM32WBA52 MCU series from STMicroelectronics, demonstrating how developers can quickly complete and run BLE 5.3 wireless designs using BLE evaluation boards, development tools, and application examples. Additionally, this article briefly discusses programming and MCU wiring.
Intense competition puts pressure on Internet of Things (IoT) device developers, who must rapidly launch new innovative products while also reducing costs and ensuring stable, low-power, and secure communication. Traditional smart IoT endpoints include microcontroller units (MCUs) for edge processing and wireless integrated circuits for connectivity. Problems arise when design teams lack the necessary radio frequency (RF) skills to develop effective solutions.
To complete and certify wireless IoT designs on time and bring them to mass production, developers must enhance the efficiency of the development process. One way to improve development process efficiency is to use low-power MCUs equipped with integrated low-power Bluetooth (BLE) wireless interfaces.
This article introduces the ultra-low power STM32WBA52 MCU series from STMicroelectronics, demonstrating how developers can quickly complete and run BLE 5.3 wireless designs using BLE evaluation boards, development tools, and application examples. Additionally, this article briefly discusses programming and MCU wiring.
Energy-Efficient Wireless MCU with High Security Levels
The STM32WBA52CEU6 wireless MCU features 512 KB of flash memory and 96 KB of static RAM (SRAM), while the STM32WBA52CGU6 model features 1 MB of flash memory and 128 KB of SRAM. Figure 1 shows the functional range of the integrated circuit in a 48 UFQFN package. Additionally, up to 20 capacitive touch channels support the operation of sealed devices (without mechanical buttons).
Figure 1: Functional block diagram of the STM32WBA52 showing the integrated BLE 5.3 radio, flash memory, and SRAM, along with security support. (Image source: STMicroelectronics)
The rich STM32Cube ecosystem supports the implementation and programming of BLE applications. This ecosystem includes the STM32CubeIDE development environment and various tools, such as the STM32CubeMX peripheral configurator and code generator, STM32CubeMonitorRF performance tester, and the desktop and cloud versions of STM32Cube.AI for artificial intelligence (AI). The matching evaluation board NUCLEO-WBA52CG simplifies prototyping and provides numerous BLE instance applications and free source code to accelerate validation.
Device and Data Security
Integrated Radio Minimizing Material Costs
The electrical performance characteristics of the radio module include:
· Integrated balun
Smaller Battery Size Due to Efficient Energy Management
The electrical performance characteristics of FlexPowerControl include:
· Radio: Rx 7.4 mA/Tx, 0 dBm, 10.6 mA
Bluetooth Stack Architecture and Packets
Figure 2: The MCU handles data flow from the radio PHY to GATT and GAP. (Image source: STMicroelectronics)
Packets sent via BLE are defined as a fixed frame structure of a bit sequence. The length of the user data area dynamically varies between 27 to 251 bytes.
BLE Application Examples
· Firmware Over-the-Air Upgrade: BLE_Fuota
Running the BLE Instance “Health Thermometer Sensor”
Figure 3: BLE communication between the NUCLEO development board acting as a sensor/server and a smartphone acting as a collector/client. (Image source: STMicroelectronics)
Health thermometer sensor:
· Acts as a GATT server
· Acts as a GATT client
Using Smartphone Application
1. Install the ST BLE Toolbox on the smartphone. This application is used to interact with and debug ST BLE devices.
3. Open Bluetooth on the smartphone (BT), scan for available Bluetooth devices in the application. Select the health thermometer and connect.
Using Web Browser Interface
6. Click on the health thermometer to display the interface.
Service |
Characteristic |
Property |
UUID |
Size |
Health Thermometer Service |
0X1809 |
|||
Temperature Measurement |
Indicate |
0x2A1C |
13 |
|
Temperature Type |
Read |
0x2A1D |
1 |
|
Intermediate Temperature |
Notify |
0x2A1E |
13 |
|
Measurement Interval |
Read, Write, Indicate |
0x2A21 |
2 |
|
Device Information Service |
0X180A |
|||
Manufacturer Name String |
Read |
0x2A29 |
32 |
|
Model Number String |
Read |
0x2A24 |
32 |
|
System ID |
Read |
0x2A23 |
8 |
Table 1: GATT services of the “Health Thermometer Sensor” and their UUIDs. (Image source: STMicroelectronics)
The following JavaScript sequence from GitHub shows how the web browser interface filters different GATT data throughput characteristics (Listing 1).
Copy[…]// Filtering the different datathroughput characteristics props.allCharacteristics.map(element => { switch (element.characteristic.uuid) { case “00002a1c-0000-1000-8000-00805f9b34fb”: IndicateCharacteristic = element; // Temperature Measurement (TEMM) IndicateCharacteristic.characteristic.startNotifications(); IndicateCharacteristic.characteristic.oncharacteristicvaluechanged = temperatureMeasurement; break; case “00002a1d-0000-1000-8000-00805f9b34fb”: ReadCharacteristic = element; // Temperature Type readTemperatureType(); break; case “00002a1e-0000-1000-8000-00805f9b34fb”: NotifyCharacteristic = element; //Immediate Temperature NotifyCharacteristic.characteristic.startNotifications(); NotifyCharacteristic.characteristic.oncharacteristicvaluechanged = notifHandler; break; case “00002a21-0000-1000-8000-00805f9b34fb”: ReadWriteIndicateCharacteristic = element; // Measurement Interval readMeasurementInterval(); break; default: console.log(“# No characteristics found..”); } });[…]
Listing 1: This JavaScript sequence filters different GATT data throughput characteristics in Table 1. (Listing source: GitHub, STMicroelectronics)
Tracking BLE Stack Processes
Tracking within the project requires enabling in the app_conf.h file
#define CFG_DEBUG_APP_TRACE (1)
Additionally, the smartphone application “SE BLE Toolbox” provides tracing capabilities under the <Application Log> tab.
BLE 5.3 Application Programming
Each NUCLEO-WBA52CG BLE application instance includes project structure setups suitable for all three development environments (IDE) such as IAR Embedded Workbench for Arm (EWARM), Keil MDK-ARM, and STM32CubeIDE.
In the health thermometer instance, only specific files in the project directory tree (Figure 4 left frame) will generate the GATT services. The two routines “Health Thermometer Service” (hts) and “Device Information Service” (dis) run in parallel (Figure 4 bottom right).
Figure 4: Programmers can add their GATT content in the framework code files (left); these files generate GATT services (right). (Image source: STMicroelectronics)
Programmers can use the source code for their own projects and extend the area marked USER CODE BEGIN/USER CODE END to add their GATT content (Listing 2). The initialization sequence in the file hts.c generates the GATT characteristic temperature measurement (TEMM), which has a UUID of 0x2A1C.
Copy[…] void HTS_Init(void) { […] /* TEMM, Temperature Measurement */ uuid.Char_UUID_16 = 0x2a1c; ret = aci_gatt_add_char(HTS_Context.HtsSvcHdle, UUID_TYPE_16, (Char_UUID_t *) &uuid, SizeTemm, CHAR_PROP_INDICATE, ATTR_PERMISSION_NONE, GATT_DONT_NOTIFY_EVENTS, 0x10, CHAR_VALUE_LEN_VARIABLE, &(HTS_Context.TemmCharHdle)); if (ret != BLE_STATUS_SUCCESS) { APP_DBG_MSG(” Fail : aci_gatt_add_char command : TEMM, error code: 0x%2X\n”, ret); } else { APP_DBG_MSG(” Success: aci_gatt_add_char command : TEMM\n”); } /* USER CODE BEGIN SVCCTL_InitService2Char1 */ /* USER CODE END SVCCTL_InitService2Char1 */ […] }[…]
Listing 2: The initialization sequence in the file hts.c generates the GATT characteristic TEMM. (Image source: GitHub, STMicroelectronics)
External Component Requirements
Figure 5: The RF terminals of the STM32WBA52 are connected to the impedance matching network, harmonic filter, and antenna to achieve Bluetooth functionality. (Image source: STMicroelectronics)
Conclusion
Editor’s Note
As the latest version of Bluetooth technology, BLE 5.3 faces a series of challenges in design and implementation, such as power optimization, connection management, security, handling multiplexing, and broadcasting. To address these challenges, system designers need to comprehensively consider hardware, software, and protocol stack designs to optimize the overall system performance and stability. The MCU series mentioned in this article provides an excellent choice to address these pain points. What challenges have you encountered in designing BLE 5.3 systems? What considerations do you have when selecting a wireless MCU? Feel free to leave comments and share!