cancel
Showing results for 
Search instead for 
Did you mean: 

How to enter low-power run mode?

Florian Moser
Senior

Hi!

I'm using a STM32L433V and have to deal with that whole energy-saving topic.

My use-case is the following:

I've to count and debounce pulses from an external sensor with an 78Ah battery for about 5 years without charging. The pulses do come with about 10Hz average and there are no significant delays between pulses, so I think standy- and stop-modes are not suitable for this specific case (correct me if I'm wrong).

There are a save- and a send-interval. Usually the save-interval is about 1min. In this interval the count of the pulses is getting saved to an SD card. In the send-interval (usually 12 hours) the stored count gets sent via an lpwa module.

In both the save- and send-interval I need the HCKL to be as high as possible (80MHz) to make these intervals most efficient. (I've done some measurements on that and compared them with 16MHz).

Arithmetically, I need the current-consumption of the µC to be below 600µA in average in the "pulse measuring"-mode.

I took a look at the datasheet of the µC (https://www.st.com/en/microcontrollers-microprocessors/stm32l433vc.html) and think the most suitable mode for this would be the low-power run mode. That brang up a lot of questions I couldn't find the answers to, as I didn't find usefull information myself.

In the HAL drivers I found this function:

/**
  * @brief Enter Low-power Run mode
  * @note  In Low-power Run mode, all I/O pins keep the same state as in Run mode.
  * @note  When Regulator is set to PWR_LOWPOWERREGULATOR_ON, the user can optionally configure the
  *        Flash in power-down monde in setting the RUN_PD bit in FLASH_ACR register.
  *        Additionally, the clock frequency must be reduced below 2 MHz.
  *        Setting RUN_PD in FLASH_ACR then appropriately reducing the clock frequency must
  *        be done before calling HAL_PWREx_EnableLowPowerRunMode() API.
  * @retval None
  */
void HAL_PWREx_EnableLowPowerRunMode(void)
{
  /* Set Regulator parameter */
  SET_BIT(PWR->CR1, PWR_CR1_LPR);
}

Honestly I've no clue which "clock frequency" is actually ment by that and how to reduce it to <2MHz while running.

I tried to set the SYSCLK and HCLK to <2MHZ but CubeMX says "HCLK Clock frequency must be >=14.2MHZ and <=80MHZ".

What do I have to do here exactly?

Do I have to use MSI, HSI or HSE to generate a "clock frequency" of > 2MHZ?

Do I have to disable the other sources?

Are there any additional things to do before entering this mode? (timers, SPI, I2C, USB, SDMMC, USART, EXTI and ADC have to be enabled before and after this mode and 1 timer (debouncing) + EXTI have to be enabled in this mode).

Thank you in advance!

1 REPLY 1
TDK
Guru

The reference manual describes in detail how to enter each mode.

If you want to use HAL instead, follow an example from the CubeL4 repository. To find them search for the usage of the function you want to use:

https://github.com/STMicroelectronics/STM32CubeL4/search?q=HAL_PWREx_EnableLowPowerRunMode

Here's an example:

https://github.com/STMicroelectronics/STM32CubeL4/blob/5e1553e07706491bd11f4edd304e093b6e4b83a4/Projects/NUCLEO-L432KC/Examples/PWR/PWR_ModesSelection/Src/lprun_test.c

If you disagree with what CubeMX is saying, attach your IOC file with an explanation and I will take a look.

If you feel a post has answered your question, please click "Accept as Solution".