cancel
Showing results for 
Search instead for 
Did you mean: 

Current consumption in STM32L072 very high

MrDiamond
Associate

Hi guys!

A have a problem with power consumption, when I try to put the microcontroller in low power sleep, the current consumption is around 8.5mA, when I expect around 20uA.

I'm using a custom board, but only a single LED is connected, capacitors and a 32kHz (P/N recomended by ST).

I tested in Sleep and Stop mode (with low power regulator), changed the clock to MSI in 100kHz, without the ST-Link connected, Serial Wire Debug deactivated, and nothing :(

Only in standby mode i get 2uA of current. Please a need hekp around this situation 🙂

Below I will post a print of clock configutarion and a snap of code, peripherals enable os only de TIM7 for the SysTick. (I don't know why, if I use the default Systick, i get hardfault when try to enter in sleep mode).

Code to reconfigure the Clock:

void configClock_MSI120k(){
	  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
 
	  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
	  RCC_OscInitStruct.MSIState = RCC_MSI_ON;
	  RCC_OscInitStruct.MSICalibrationValue = 0;
	  RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_2;
	  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
 
	  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
	  {
		Error_Handler();
	  }
 
	  /** Configure the main internal regulator output voltage
	  	  */
}

Main code

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  /* USER CODE BEGIN 2 */
  SET_LEDBAT(GPIO_PIN_RESET);
  HAL_Delay(250);
 
  /*
   * Enable RCC Power Clock
   */
  __HAL_RCC_PWR_CLK_ENABLE();
  /*
   * Enable Flash Power Down
   */
  FLASH->ACR |= FLASH_ACR_SLEEP_PD;
 
  HAL_SuspendTick();
  configClock_MSI120k();
  
  /*
   * Clear flags
   */
  __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
	__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
	
	/*
	 * Turnoff red led
	 */
	SET_LEDBAT(GPIO_PIN_SET);
 
	HAL_PWR_EnterSLEEPMode(PWR_LOWPOWERREGULATOR_ON, PWR_SLEEPENTRY_WFI);
	//HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
	//HAL_PWR_EnterSTANDBYMode();
 
	SET_LEDBAT(GPIO_PIN_RESET);

0693W000008z03dQAA.png0693W000008z03YQAQ.png 

Thank guys.

0 REPLIES 0