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

Watch dog and while statement

Based on nRF5_SDK_15.3.0_59ac345 at NRF52810 development board,
1. Enable the watchdog with reload value = 2000, and feed it per 1000ms by app_timer
2. Initialize the FDS and wait its ready

static void _on_fds_event(fds_evt_t const* evt)
{

switch(evt->id){

case FDS_EVT_INIT:
if(evt->result == FDS_SUCCESS){
_fds_ready = true;
}
break;

case FDS_EVT_WRITE:
break;

case FDS_EVT_UPDATE:
break;

default:
break;

}

}

_fds_ready = false;
fds_register(_on_fds_event);
if(fds_init() == NRF_SUCCESS){
while(!_fds_ready){};
}

Each time the power is turned on, a watchdog reset is triggered. The reason is while(!_fds_ready){};
It looks like the while statement affecting the watchdog app_timer.
How can I solve this problem? Thanks!

Related