2025-08-23 6:35 AM
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.
2025-08-25 12:37 AM
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.
2025-08-25 3:00 AM
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:
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.