cancel
Showing results for 
Search instead for 
Did you mean: 

power consumption stm32l4 in lprun mode

alianvari
Associate III

Hi

I am using stm32l496 in lprun mode but the current consumption is equal to 1.2 mA while in run mode the current consumption is equal to 3 mA while in the datasheet, the current consumption in the lprun mode is about 220 uA.

how can I reduce the current?

i attached cube clock configuration and my code.

Thanks.

/*enable low power run mode*/

HAL_GPIO_WritePin(Temp_PWR_GPIO_Port,Temp_PWR_Pin,GPIO_PIN_SET);//power off Temp PWR

HAL_GPIO_WritePin(Press_PWR_GPIO_Port,Press_PWR_Pin,GPIO_PIN_SET);//power off Press PWR

HAL_SPI_MspDeInit(&hspi1);

HAL_GPIO_DeInit(TempAD_CS_GPIO_Port, TempAD_CS_Pin);

HAL_GPIO_DeInit(PressAD_CS_GPIO_Port,PressAD_CS_Pin);

SystemClock_Decrease();   

HAL_PWREx_EnableLowPowerRunMode();

void SystemClock_Decrease(void)

{

 RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

 RCC_OscInitTypeDef RCC_OscInitStruct = {0};

 /* MSI is enabled after System reset, activate PLL with MSI as source */

 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;

 RCC_OscInitStruct.HSEState = RCC_HSE_OFF;

 RCC_OscInitStruct.HSIState = RCC_HSI_ON;

 RCC_OscInitStruct.MSIState = RCC_MSI_ON;

 RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_0;

 RCC_OscInitStruct.MSICalibrationValue = RCC_MSICALIBRATION_DEFAULT;

 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;

 if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)

 {

  /* Initialization Error */

  Error_Handler();

 }

  

 /* Select MSI as system clock source and configure the HCLK, PCLK1 and PCLK2 

   clocks dividers */

 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;

 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI; 

 RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;

 RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;  

 RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;

 if(HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)

 {

  /* Initialization Error */

  Error_Handler();

 }

  

 /* Disable HSI to reduce power consumption since MSI is used from that point */

 __HAL_RCC_HSI_DISABLE();

  

}

0693W00000FAPmAQAX.jpg

2 REPLIES 2
Piranha
Chief II

Set DBGMCU_CR = 0; and disconnect the debugger physically.

thanks

I do not know this, please guide me.