cancel
Showing results for 
Search instead for 
Did you mean: 

Current Consumption in STOP MODE ON STM32L100C Discovery Board

sanctified
Associate II

Hi,

I am working with the STM32L100C Discovery Board and trying to implement the stop mode to reduce current consumption. According to the data sheet, in stop mode the current can be reduced up to µA but I am still having about 26mA.

This is my stop_mode function:

void Stop_Mode_Enable(void){
  
GPIO_InitTypeDef GPIO_InitStruct;
 
  /* Configure all GPIO as analog to reduce current consumption on non used IOs */
  /* Enable GPIOs clock */
   __HAL_RCC_GPIOA_CLK_ENABLE();
   __HAL_RCC_GPIOB_CLK_ENABLE();
   __HAL_RCC_GPIOC_CLK_ENABLE();
   __HAL_RCC_GPIOD_CLK_ENABLE();
   __HAL_RCC_GPIOH_CLK_ENABLE();
 
  GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  GPIO_InitStruct.Pin = GPIO_PIN_All;
  HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
  HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
  HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
  
  //GPIO_InitStruct.Pin = GPIO_PIN_All & (~(GPIO_PIN_14 | GPIO_PIN_13));
  HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 
  /* Disable GPIOs clock */
  __HAL_RCC_GPIOA_CLK_DISABLE();
  __HAL_RCC_GPIOB_CLK_DISABLE();
  __HAL_RCC_GPIOC_CLK_DISABLE();
  __HAL_RCC_GPIOD_CLK_DISABLE();
  __HAL_RCC_GPIOH_CLK_DISABLE();
 
  HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);
  HAL_RTCEx_SetWakeUpTimer_IT(&hrtc,0x242B,RTC_WAKEUPCLOCK_RTCCLK_DIV16);
 
  HAL_PWREx_DisableFastWakeUp();
  HAL_PWREx_EnableUltraLowPower();
 
  //HAL_PWREx_EnableFastWakeUp();
  HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON,PWR_STOPENTRY_WFI);
  HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);
  SYSCLKConfig_STOP();
  
  MX_GPIO_Init(); 
  HAL_GPIO_WritePin(GPIOA,GPIO_PIN_2,GPIO_PIN_SET);
  HAL_Delay(2000);
}

Any advice on how to further reduce the current or what I could be doing wrong will be great.

1 REPLY 1
Mohamed Aymen HZAMI
ST Employee

Hello,

Try to configure the MCU in STOP mode without using RTC and see if the consumption is always high or not.

Best Regards,

Mohamed Aymen.