Hi,
I have some doubts on how the "nrf_pwr_mgmt_run" function works. As far as I know this function enters in SystemOn Idle mode, so the CPU is in sleep.
I tested this using the "pwr_mgmt" example and placing some code. I created an app timer instance to wake-up the cpu in a 30 seconds interval to do some dummy stuff and then go back to sleep, and so on. This is the code of the main loop, after performing all the configurations and initializations:
The app timer instance activates the "m_do_some_work" varibale (I know it's not good practice but it serves me for my test) in the event handler, and I test this in the "if" statement to enter into a delay code of 5 seconds (dummy stuff).
What I expected to see were only the "Its time to do..." and "Go to sleep..." messages in a 30 seconds interval. But the output in the terminal (putty) streams rapidly and constantly the "Who's waking me up!" message, and after 30 seconds it output the "Its time to do..." and "Go to sleep..." messages, and goes again with the "Who's waking me up!" and so on.
This is a segment of the output:
<info> app: Who's waking me up!
<info> app: Who's waking me up!
<info> app: Who's waking me up!
<info> app: Who's waking me up!
<info> app: Who's waking me up!
<info> app: Its time to do some work
<info> app: Go to sleep, lazy bones.
<info> app: Who's waking me up!
<info> app: Who's waking me up!
<info> app: Who's waking me up!
<info> app: Who's waking me up!
<info> app: Who's waking me up!
When I comment the "nrf_pwr_mgmt_run" and uncomment the SEV, WFE functions it behaves as I expected (only once and at the beginning appears the "Who's waking me up!" message).
I have disabled the NRF_PWR_MGMT_CONFIG_CPU_USAGE_MONITOR_ENABLED and the NRF_PWR_MGMT_CONFIG_STANDBY_TIMEOUT_ENABLED defines.
I'm using nRF52840 SoC.
Why the "nrf_pwr_mgmt_run" is waking up the CPU all the time?
Best Regards
Jose Forno