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  ,

    It sounds like the app_timer interrupt is not allowed to access the CPU until you are done with your FDS events. They are probably running on the same interrupt priority.

    I don't know whether you are using the softdevice, but you can take a look at the interrupt priority levels for the nRF52810 here.

    Try to increase the interrupt priority (lower number = higher priority) on the app_timer.

    Look for APP_TIMER_CONFIG_IRQ_PRIORITY in sdk_config.h. Try to set it to 3, and see if that helps.

    Best regards,

    Edvin

Reply
  • Hi  ,

    It sounds like the app_timer interrupt is not allowed to access the CPU until you are done with your FDS events. They are probably running on the same interrupt priority.

    I don't know whether you are using the softdevice, but you can take a look at the interrupt priority levels for the nRF52810 here.

    Try to increase the interrupt priority (lower number = higher priority) on the app_timer.

    Look for APP_TIMER_CONFIG_IRQ_PRIORITY in sdk_config.h. Try to set it to 3, and see if that helps.

    Best regards,

    Edvin

Children
Related