cancel
Showing results for 
Search instead for 
Did you mean: 

Low power run mode on Zephyr

mako542b
Associate

I'm working on entering and exiting low power run mode at runtime on Zephyr rtos. I can't find a way to change clock frequency to 2MHz (required by LPR) and back to 80MHz using zephyr  features at runtime. Is there any api to achieve this, or some similar example? I'm working on STM32L4S5 series.

2 REPLIES 2
davidclark292
Associate

I don’t think Zephyr has a direct API for runtime clock switching,, you’ll likely need to handle it through STM32’s clock control drivers or use the HAL directly. Might be worth checking Zephyr’s power management samples for reference.

Sarra.S
ST Employee

Hey @mako542b

As @davidclark292 said, I'm not aware of an existent API, however, when switching to a different frequency, you have to manage voltage scaling, clock source selection, and FLASH wait states.

For example, to switch between 2Mhz and and 80 MHz you need to:

  • Enter Range 2 mode for low-power run (max 26 MHz), configure the system clock to 2 MHz, and use the low-power regulator.
  • Adjust FLASH wait states and VCORE voltage scaling (via PWR_CR1 and PWR_SR2 registers).
  • For returning to 80 MHz, switch back to Range 1, adjust wait states, configure the PLL for 80 MHz, and switch the system clock source accordingly.

Hope that helps!

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.