2025-07-15 12:40 AM - edited 2025-07-15 12:43 AM
Hi,
I'm using a STM32L0, the power consume under stop mode was ~50uA. After some search, i see that i forgot to stop the USART clock which permit a consume under stop mode around 20uA which is far from the datasheet <1uA.
Actually, i'm doing manual search for clock or GPIO which could drain useless power. I wondered if a library or function already exist which could scan all possibility option which drain power and give information about that. I'm not looking for exact number (it could be nice to have approximation) but more a list of all activate option like :
- ADC clock enable
- GPIOx under output state
- MSI clock at x Mhz
etc
So i can figure out what i forgot to disable.
Thanks in advance,
2025-07-15 1:03 AM
STM32CubeMX has a power consumption calculation tool which shows the nuts and bolts:
You may also check this app note: STM32L0xx ultra-low power features overview
and knowledge base article: Tips for using STM32 low-power modes - STMicroelectronics Community
hth
KnarfB
2025-07-15 1:37 AM
Thanks for your answer.
I saw that, but my asking is more about a listing at any instant of powered clock/gpio/... STM32 cube mx can help me about that, but can't show the reality at an instant if i make modification in the code.
Which is different with a specific function or library which could printf a result. For example, it could be :
MyProg.c
//Some code
ShowEnable();
//Some code
What i would like to have on serial :
Enable clock : USART SPI GPIOA | Output GPIO : GPIOA1 GPIOB5 | Prescaler = 1
So i can know that if i go on standby mode, i need to have USART/SPI/GPIOA disable, for example. It's not a big deal to write by my own, but maybe someone already works on it and made something better than i will ever do.
2025-07-15 1:40 AM
I see. Not aware of library code. You may check the peripheral register view in the debugger before actually entering a low power mode, especially the RCC registers.
hth
KnarfB
2025-07-15 1:55 AM
@KnarfB wrote:You may check the peripheral register view in the debugger before actually entering a low power mode, especially the RCC registers.
Indeed.
@Frog or you could have your code read those registers for you ...