Skip to main content
Visitor II
August 23, 2025
Question

Low power run mode on Zephyr

  • August 23, 2025
  • 2 replies
  • 308 views

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.

    This topic has been closed for replies.

    2 replies

    Visitor II
    August 25, 2025

    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.

    ST Employee
    August 25, 2025

    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!