System OFF mode for system power management for nRF54L15

I would like to integrate System OFF mode of operation into idle system hooks in Zephyr (i.e. when the CPU is idle, it goes into OFF power state automatically). As it currently stands, I have a simple multithreaded application and have following power optimizations configured:
```

CONFIG_PM=y
CONFIG_POWEROFF=y
CONFIG_PM_DEVICE=y
```
I measure the consumption to be ~4uA with this configuration, so I'm assuming the MCU is only every getting to one of System ON IDLE states. I can get it to the desired consumption by calling `sys_poweroff` explicitly, but I would like this to be called automatically from the Idle thread(and ideally using the GRTC to wake the system up for appropriate OS scheduled events) so I don't need to manage this within my application code.
I can also see that the CONFIG_PM option isn't actually taking in the compiled image; when I step debug through the code, it's clear the code section is compiled out:
```
#ifdef CONFIG_PM
_kernel.idle = z_get_next_timeout_expiry();

/*
* Call the suspend hook function of the soc interface
* to allow entry into a low power state. The function
* returns false if low power state was not entered, in
* which case, kernel does normal idle processing.
*
* This function is entered with interrupts disabled.
* If a low power state was entered, then the hook
* function should enable interrupts before exiting.
* This is because the kernel does not do its own idle
* processing in those cases i.e. skips k_cpu_idle().
* The kernel's idle processing re-enables interrupts
* which is essential for the kernel's scheduling
* logic.
*/
if (k_is_pre_kernel() || !pm_system_suspend(_kernel.idle)) {
k_cpu_idle();
}
#else
k_cpu_idle();
#endif /* CONFIG_PM */
```
Any guidance would be appreciated!
Parents
  • Hi

    Okay, so I think the suggested thing to do here is to do what you're already doing, with calling the system OFF mode as needed, as we don't indeed have a good way of implementing this into the idle thread itself without modifying the kernel code itself. Why exactly do you need to implement this, as it's seemingly far from trivial I'm afraid (if possible at all). 

    The CONFIG_PM support was discontinued a while back and we're using CONFIG_PM_DEVICE to control peripherals for power management. 

    Best regards,

    Simon

Reply
  • Hi

    Okay, so I think the suggested thing to do here is to do what you're already doing, with calling the system OFF mode as needed, as we don't indeed have a good way of implementing this into the idle thread itself without modifying the kernel code itself. Why exactly do you need to implement this, as it's seemingly far from trivial I'm afraid (if possible at all). 

    The CONFIG_PM support was discontinued a while back and we're using CONFIG_PM_DEVICE to control peripherals for power management. 

    Best regards,

    Simon

Children
Related