AnsweredAssumed Answered

STM32L151xB Low Power Modes Current Consumption

Question asked by bausch.andy on Jan 26, 2015
Latest reply on Jan 27, 2015 by gonzalez.laurent
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){}

Outcomes