Skip to main content
Visitor II
July 15, 2025
Question

Looking for library to help debugging power used

  • July 15, 2025
  • 2 replies
  • 326 views

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,

    This topic has been closed for replies.

    2 replies

    Super User
    July 15, 2025

    STM32CubeMX has a power consumption calculation tool which shows the nuts and bolts:

    KnarfB_0-1752566274569.png

    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

    FrogAuthor
    Visitor II
    July 15, 2025

    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.

    Super User
    July 15, 2025

    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

    FrogAuthor
    Visitor II
    July 15, 2025

    yep, it could be cool that stm32 ide do it and link with the database to give full information about that.