Showing results for 
Search instead for 
Did you mean: 

STM32WB in sleep/standby mode?

Associate III



I am using STM32WB as a MCU for a custom pcb. I am using the BLE Sensor firmware but slightly altered for our application. 


The question I have is - If I want to perform data acquisition intermittently (let's say every 5 mins) and transmit data over BLE, is there some sort of power consumption features within the MCU/firmware that will put the MCU into standby/sleep but stay connected to BLE (to an app let's say)? If not, is there a still way to keep the MCU on in lower power mode when measurements are not being taken? 


Trying to prolong battery life is the main objective here. 



Mahmoud Ben Romdhane
ST Employee

Hello @od805,

First let me thank you for posting.

I suggest that you notice the 4.6 section of the Application note AN5289. You can also take a look at AN5071 and AN5292.

This Post can be useful.








Associate III

Thanks for this. Looking at the Main.c file of the STM32WB BLE_Sensor code. 


I see very similar attributes already pre determined but have a some questions.


1. Does GPIO Mode AF_PP or AF_OD have negative effects on power consumption vs mode ANALOG? Keep in mind that the Pull on all of these is set to NOPULL. (See photo for reference). 

2. Adding the line below gives a fatal error stating there is "too few arguments to function". Any suggestions? 

/* FLASH Deep Power Down Mode enabled */

 3. At the end of the last post you linked the power consumption came out to be 17 uA which is great. Is that what I should be expecting to see too? (I'm using the stm32wb55). 





Hello @od805,

Push-pull output is generally used for unidirectional line communication; open-drain output is usually used for bidirectional line communication. Due to the presence of pull-up resistors, open-drain output has relatively higher power consumption.

The AN4899 (STM32 GPIO configuration for hardware settings and low-power consumption) provides a detailed description of the various GPIO modes and you will find some guidelines for power optimization.

The arguments of this function HAL_PWREx_EnableFlashPowerDown() can be PWR_FLASHPD_LPRUN or PWR_FLASHPD_LPSLEEP.
It allows to enable flash power down capabilities in low power run and low power sleep modes.

The UM2442 describes the STM32WB HAL and low-layer drivers.

This power consumption optimization Method can be applied for different boards working on different modes.




Associate III

Hi again, 


I tried following the optimization method and I have some feedback. Thanks for your help thus far.

1. One of the steps is to clear all of the pinouts. I should most likely avoid this step because I am using quite a few of the pin outs on the stm mcu right? 

2. Another find I have is that whenver I alter the BLE_Sensor.ioc whether it's setting all the free pins as analog or reconfiguring GPIO's, some files (highlighted but sometimes others) getting deleted. Why does that happen? Luckily I have a backup copy of this firmware and can drag and drop the missing .c, but seems strange. 

3. Do you think there is any utility to lowering the power consumption by altering (lowering) the clock frequency. Our application requires sampling no more than 1 Hz at the moment. I included a screenshot of the clock config. 


I am learning power consumption optimization is a tricky endeavor. Any help would be greatly appreciated. THANKS!





Associate III

Hi again - Following up on my latest post. 

Any insights into changing the clock frequency to lower the power consumption as much as possible?