cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L151xB Low Power Modes Current Consumption

andy23
Associate II
Posted on January 26, 2015 at 16:12

Dear folk,

I am not able getting the desired power consumption for STM32L151xB (48 Pins) using the predestined STM32L1xx_StdPeriph_Examples/PWR/CurrentConsumption.

More detailed, I need to use a Low Power mode which allows me to wake the controler over USART, which led me to Low Power sleep (Wakeup on any interrupt). As said, the problem is neither the code, nor the LPM itself, I am just not able to reach the desired current consumption of <10�A. With the attached code it is just possible to reach ~50�A.

FYI, during normal run, my clocks are using HSE on 8MHz (VCO range 2). This posted code is the ''reduced'' code of the Example which gets me 53�A, the least I can get with those examples.

I'm trying this for a while now, changing clocks and so on, but cannot reach my goal. Could you please take a look and give me some advice? Thanks in advance.

Best regards,

Andy

Code:

/* Configure the System Clock to MSI Range 0 (65KHz). ----------------------*/

      GPIO_InitTypeDef GPIO_InitStructure;

      /* RCC system reset */

      RCC_DeInit();

      

      /* Flash 0 wait state */

      FLASH_SetLatency(FLASH_Latency_0);

      

      /* Disable Prefetch Buffer */

      FLASH_PrefetchBufferCmd(DISABLE);    

      

      /* Disable 64-bit access */

      FLASH_ReadAccess64Cmd(DISABLE);

      

      /* Enable the PWR APB1 Clock */

      RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);

      

      /* Select the Voltage Range 2 (1.5V) */

      PWR_VoltageScalingConfig(PWR_VoltageScaling_Range2);

      

      /* Wait Until the Voltage Regulator is ready */

      while(PWR_GetFlagStatus(PWR_FLAG_VOS) != RESET)

      {

      }

      

      /* HCLK = SYSCLK/2 = ~32KHz */

      RCC_HCLKConfig(RCC_SYSCLK_Div2);

      

      /* PCLK2 = HCLK */

      RCC_PCLK2Config(RCC_HCLK_Div1);

      

      /* PCLK1 = HCLK */

      RCC_PCLK1Config(RCC_HCLK_Div1);

      

      /* Set MSI clock range to 65.536KHz */

      RCC_MSIRangeConfig(RCC_MSIRange_0);

      

      /* Select MSI as system clock source */

      RCC_SYSCLKConfig(RCC_SYSCLKSource_MSI);

      

      /* Wait till PLL is used as system clock source */

      while (RCC_GetSYSCLKSource() != 0x00)

      {}

      

      /* Configure all GPIO as analog to reduce current consumption on non used IOs */  

      /* Enable GPIOs clock */

      RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC |

                            RCC_AHBPeriph_GPIOD , ENABLE);

      

      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;

      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz;

      GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;

      GPIO_Init(GPIOC, &GPIO_InitStructure);

      GPIO_Init(GPIOD, &GPIO_InitStructure);

      GPIO_Init(GPIOA, &GPIO_InitStructure);

      GPIO_Init(GPIOB, &GPIO_InitStructure);

      

      /* Disable GPIOs clock */

      RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC |

                            RCC_AHBPeriph_GPIOD , DISABLE);

      

      

      /* Enable The ultra Low Power Mode */

      PWR_UltraLowPowerCmd(ENABLE);

      

      /* Enable the power down mode during Sleep mode */

      FLASH_SLEEPPowerDownCmd(ENABLE);

      

      /* Request to enter SLEEP mode with regulator in low power mode */

      PWR_EnterSleepMode(PWR_Regulator_LowPower, PWR_SLEEPEntry_WFI);

      

      /* Infinite loop */

      while (1){}

#low-power #stm32 #lpm #current
11 REPLIES 11
andy23
Associate II
Posted on January 27, 2015 at 11:32

I just tried your code. I get 59 µA with all GPIOs turned to analog input.

stm322399
Senior
Posted on January 27, 2015 at 11:46

Well, its maybe time to focus on your HW design. Do you have a resistor divider somewhere (~50KOhm suffice to leak tens of microamps) ? A leaking capacitor ?

On the software side I only encourage you to consider turning your I/O to output (at 0) wherever it is possible. On MCU that do not have all the wonderful low power stuff, this has proven to be a safe bet (if not electrical conflict of course.