System OFF not entered automatically

I see in examples like here: 

https://github.com/nrfconnect/sdk-nrf/blob/f68bcdf5b3ea479268593459aa4770059058780e/samples/nfc/system_off/src/main.c#L228

System OFF is actually prevented explicitly so I assume that without such `pm_policy_state_lock_get` call, system off would be entered automatically.

I my case it does not and I wonder why:

https://github.com/fgervais/project-nrf-leak-detector/blob/66910a41d7a4ec0a7ff41cc5973df204df552757/app/src/main.c#L146

This code only enter System ON unless I explicitly enter System OFF through `pm_state_force`.

Is it one of the peripheral I use that prevents System OFF?

  • Hi,

    System OFF is actually prevented explicitly so I assume that without such `pm_policy_state_lock_get` call, system off would be entered automatically.

    I agree, the implementation does suggest that the system will enter "System OFF" mode automatically unless you block the 'PM_STATE_SOFT_OFF' state with pm_policy_state_lock_get(). However, because we do not define any 'cpu-power-states' for our CPUs, the pm_system_suspend() call in the idle thread will always end up returning false here: link and cause the system to enter sleep with k_cpu_idle() instead. And k_cpu_idle() will make the system enter System ON mode.

    I think the 'cpu-power-states' property makes more sense for other CPU architectures where there are more than 2 sleep states available. When the nRF is in system OFF, it can only be woken up through an external input, and this will prevent the scheduler from scheduling the next wakeup.  

    Best regards,

    Vidar

Related