Skip to main content
terryhansen
Associate II
February 5, 2013
Question

STM32L Stop Mode

  • February 5, 2013
  • 3 replies
  • 867 views
Posted on February 05, 2013 at 20:46

I cannot get stop mode current below 1.1 mA in the IAR STM32L152VB eval board. This is the code to prep and then go to stop mode:

lowPowerConfigGPIO();  (this configures all GPIO pins as ADC inputs)

PWR_FastWakeUpCmd(DISABLE);

PWR_PVDCmd(DISABLE);

PWR_UltraLowPowerCmd(ENABLE);

RCC->AHBENR = 0;

RCC->AHBLPENR = 0; 

RCC->APB1ENR =  RCC_APB1ENR_PWREN;

RCC->APB2ENR = 0;

SysTick->CTRL = 0;

PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);

while(1){

__no_operation();

}

The code is based on the STM32L Discovery firmware in STM32L_Discovery_Firmware_Pack_V1.0.2

Stop mode on the STM32L Discovery board is about 47 uA. But on the IAR board it does not go below 1.1 mA.

Any help seeing what I am doing wrong is much appreciated!

Terry

    This topic has been closed for replies.

    3 replies

    Tesla DeLorean
    Guru
    February 5, 2013
    Posted on February 05, 2013 at 22:01

    It could be whatever else is powered, are you looking at a board level current, or chip level current?

    Also I'd sleep in a loop lest it leave via interrupt or whatever.

    while(1)
    {
    PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
    }

    A WFI in a loop would be preferable to a NOP
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    terryhansen
    Associate II
    February 6, 2013
    Posted on February 06, 2013 at 02:11

    I am sure the measurement I am doing is processor current, not board current.  The IAR board is set up to make it easy to measure processor current.  You just remove a 2-pin jumper and read the current across the pins.  There is another location to measure board current.

    Thanks for the idea about the WFI loop.  I will give it a shot.

    Terry

    terryhansen
    Associate II
    February 6, 2013
    Posted on February 06, 2013 at 17:52

    Turns out it is my fault.  Having the J-Link loader/debugger connected to the board makes the micro consume right around 1 mA.  Not sure why this happens.  But when the J-Link is disconnected, processor current drops to under 100 uA.  That can be improved, but the big issue was the J-Link.

    Thanks for the help.