cancel
Showing results for 
Search instead for 
Did you mean: 

Reduce power consumption STM32L4

Hello there,

I am developing a FreeRTOS based application using STM32L452 MCU. I am looking for a way, to reduce the power consumption in the idle intervals of the processors work. When reviewing the sleep modes, it occured to me that the MCU might be unresponsive to external events or even lose context (MCU reset), which is not fit in this RTOS running application.

I thought then that I could simply reduce the HCLK frequency by playing with the PLL registers. The problem here is that the systick timer will get altered, and I really need it to stay with its regular timebase (1 ms). I checked either it is possible to clock the Systick timer from other sources, but it seems like its only HCLK and HCLK / 8. The datasheet says it is calibrated for this value.

I would appreciate some suggestions on this topic.

Lukasz.

22 REPLIES 22
Thank you for answer Jack,
In general I am looking for any options to reduce power consumption with freertos now. In my application I am going idle for intervals of around from 30 seconds to 5 minutes. Even though the mcu doesnt do anything specific in that dormant petiod, the systick time has to be kept- the whole system bases on that systic variable value. Thats why I thought reducing the clock speed, wgile maintaining the systick frequency of 1k would be least "invasive".
Geoffrey1
Associate III

It might be easier to use ChibiOS which is designed to support "tickless" operation. As a point of reference, using an stm32l432 with an external RTC from microcrystal (rv-8803-c7) as a 1khz input to the stm32l432 RTC. I measured 430nA in standby at 2.4 v (520nA at 3v). Stop2 would be more like 1.7uA, but has some advantages. "Wakeup" from standby is more complicated because it looks like a reset, which requires a somewhat more complex system architecture.

It wasn't clear from your notes what your timing needs are. If you need a precise high speed oscillator, when in "run" mode, then you might consider powering it down in your long sleep periods.

Hi Geoffrey, thabks for answer.
The point is here that in my idle periods I dont really want to be asleep. I will still need to have systick running and react to external event. I just dont need the full blown 80 Mhz computing power. I think 1 Mhz would be enough without powering the peripherals off.
Also I cant really go ChibiOs bow from FreeRtos, the project is in way to advanced stage.

Fair enough. It was a little hard to be sure what your requirements are, for example interrupt latency. Best of luck in your quest to save power -- always a rocky and interesting road.

Thanks, As soon as I get the time I will try to reduve HSE crystal to 2-4 MHz and try source switching (HSE <-> PLL 80 Mhz) with systick time base adjustment.
S.Ma
Principal

On the stm32f437, it is possible in the clock tree to modulate syclk while keeping peripheral clock fixed IF it has been chosen to be the lowest possible.

This way you can even cranck-up the gearbox only in interrupts...

Hi, thanks for answer.
Could you elaborate a bit more what you have in mind?
Jack Peacock_2
Senior III

FreeRTOS tickless mode does exactly what you want. The SysTick timebase is preserved, any tasks delayed for specific periods or timeouts will still respond at the right time, and any external interrupt will exit low power sleep mode. Unlike stop and standby mode there are no limitations on wakeups and clocks.

Sleep mode halts the processor clock, far more power efficient than just slowing down the clock rate. The instruction clock, but not PCLK for peripherals, is halted. The core exits from sleep mode very quickly after any external interrupt occurs. Tickless mode updates the FreeRTOS tick count for total elapsed time while asleep.

What you save here is the power consumed by the core while executing instruction in idle mode, for the total length of the idle period, not just fragments between systick interrupts. Its far less complicated than frequency switching. Saves more power too...after all, zero Mhz will always consume less current.

The sleep mode core implementation is one thing ST does much better than most of its low power M class competitors, especially on the L4 series, and FreeRTOS takes full advantage of it. If you're using battery power don't ignore it.

Jack Peacock

Jack, thank you for in depth explanation.
This would seem to be a great feature, but I see one problem. In my application, the time for which the system is in idle state is calculated by FreeRtos delay function, which needs the counter values from ticks. If there are no ticks, I cannot wake up from idle. Do I understand correctly?

Jack,

I think I get the idea now. After turning on the configUSE_TICKLESS_IDLE flag, The processor will go to sleep each time it is idle. When should the system consider the application idle is set with configEXPECTED_IDLE_TIME_BEFORE_SLEEP. The last thing I am not sure I understand is how will an external event wake up the MCU? I have found the code for figuring out how much time did the MCU actually spent in idle state but I cant find how will the system know that some interrupt has placed an intem in a queue and it has to be handled?