NRF5340 - Unable to enter PM_STATE_SOFT_OFF using Zephyr PM and LittleFS without a debugger.

Hello,

I am currently working on a project where I need to be able to put the device in low power mode (PM_STATE_SOFT_OFF), but I am also using the LittleFS filesystem for the configuration files. 

When I use the function `fs_mount()` before `pm_state_force()` the program won't enter the low power state.
This problem only occurs when there is no debugger or logger connected.
When I connect a debugger or logger (using JLink RTT, not UART), the code works as expected.

I am using nrf version v2.1.0, zephyr 3.1.99-ncs1, the same thing happens on earlier versions

Thank you.

Parents
  • Hi JarniV,

    When I connect a debugger or logger (using JLink RTT, not UART), the code works as expected.

    The only way I can imagine this has an impact is that the processing of the J-Link RTT slows down processing enough so the system can enter a state where it can go into PM_STATE_SOFT_OFF. However, given your later comment that you put the device into low power mode minutes after fs_mount(), that is probably not the case.

    Do you mean that if you physically connect a debugger it works? As in, when it doesn't work, RTT actually is still running, logging still happens?

    On the other hand, the description of pm_state_force() says:

    This function overrides decision made by PM policy forcing usage of given power state upon next entry of the idle thread

    Without digging much deeper, I think the mounting of the File System is preventing the entry of the idle thread from happening somehow.

    Could you please try to call fs_unmount() first before forcing the SOFT_OFF state? Given that PM_STATE_SOFT_OFF is basically just "one step away" from turning the device off, it is a good idea to unmount before entering that state anyway.

    Hieu

Reply
  • Hi JarniV,

    When I connect a debugger or logger (using JLink RTT, not UART), the code works as expected.

    The only way I can imagine this has an impact is that the processing of the J-Link RTT slows down processing enough so the system can enter a state where it can go into PM_STATE_SOFT_OFF. However, given your later comment that you put the device into low power mode minutes after fs_mount(), that is probably not the case.

    Do you mean that if you physically connect a debugger it works? As in, when it doesn't work, RTT actually is still running, logging still happens?

    On the other hand, the description of pm_state_force() says:

    This function overrides decision made by PM policy forcing usage of given power state upon next entry of the idle thread

    Without digging much deeper, I think the mounting of the File System is preventing the entry of the idle thread from happening somehow.

    Could you please try to call fs_unmount() first before forcing the SOFT_OFF state? Given that PM_STATE_SOFT_OFF is basically just "one step away" from turning the device off, it is a good idea to unmount before entering that state anyway.

    Hieu

Children
No Data
Related