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!

Parents
  • Hi ,

    I gave this some more thought after consulting with my colleague who handles this ticket.

    Maybe you shouldn't set the app_timer's priority so high. It may result in some unexpected behavior because other threads that possibly needs access faster can't get it.

    I suggest that you bump the priority on app_timer back to the default value (6?) and then rather skip the while(!fds_ready){}.

    I agree that sometimes you need to wait for _fds_ready, but I suggest that you do this update in your main context instead of in the FDS interrupt.

Reply
  • Hi ,

    I gave this some more thought after consulting with my colleague who handles this ticket.

    Maybe you shouldn't set the app_timer's priority so high. It may result in some unexpected behavior because other threads that possibly needs access faster can't get it.

    I suggest that you bump the priority on app_timer back to the default value (6?) and then rather skip the while(!fds_ready){}.

    I agree that sometimes you need to wait for _fds_ready, but I suggest that you do this update in your main context instead of in the FDS interrupt.

Children
Related