This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Why is it wake-up from sleep mode?

Hi. 

I am testing sleep mode using nrf_pwr_mgmt_run().

When nrf_pwr_mgmt_run() is called, it is changed to sleep mode, but it wake-up up immediately and it is changed to sleep mode only when nrf_pwr_mgmt_run() is called again.

Why wake-up from the first sleep mode?

Can I know what event occurred??

int main( void )
{
	ret_code_t Err_code;
	
	SystemInit();
	Err_code = nrf_pwr_mgmt_init();
	APP_ERROR_CHECK(Err_code);
		
	while( 1 )
	{
		if (NRF_LOG_PROCESS() == false)
		{
			nrf_pwr_mgmt_run();
		}	
	}
}

Parents
  • Hello,

    There is no short description to the why, but it is this way by design. For instance the call to sd_app_evt_wait() will by itself generate an event due to the SVC call (sd_app_evt_wait()) generated an event when called and must be cleared, however it could be in parallel that an application also have generated an event at the same time and should be processed, so sd_app_evt_wait() might be called twice to avoid missing events before going to sleep. It is more important that all events are handled, than the potential risk of an event is missed. Thereby you can see that sd_app_evt_wait() sometimes must be called twice before going to sleep.

    Best regards,
    Kenneth

Reply
  • Hello,

    There is no short description to the why, but it is this way by design. For instance the call to sd_app_evt_wait() will by itself generate an event due to the SVC call (sd_app_evt_wait()) generated an event when called and must be cleared, however it could be in parallel that an application also have generated an event at the same time and should be processed, so sd_app_evt_wait() might be called twice to avoid missing events before going to sleep. It is more important that all events are handled, than the potential risk of an event is missed. Thereby you can see that sd_app_evt_wait() sometimes must be called twice before going to sleep.

    Best regards,
    Kenneth

Children
No Data
Related