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

I have problem with SDK13 wdt when central mode

SDK 13 nRF52, S132, central mode

code init:

void wdt_init (void) //Configure WDT.

{ uint32_t err_code; nrf_drv_wdt_config_t config = NRF_DRV_WDT_DEAFULT_CONFIG; err_code = nrf_drv_wdt_init(&config, wdt_event_handler); APP_ERROR_CHECK(err_code); err_code = nrf_drv_wdt_channel_alloc(&m_channel_id); APP_ERROR_CHECK(err_code); nrf_drv_wdt_enable(); }

when I made infinit loop:

while(1)
{
		uint32_t err_code = sd_app_evt_wait();
		APP_ERROR_CHECK(err_code);
        nrf_drv_wdt_channel_feed(m_channel_id);
}

I never passed

nrf_drv_wdt_channel_feed(m_channel_id);

But if connect to the peripherial device, I have enter to this loop. Is it normal behavior? How can I reset wdt flag, when I in scan mode for my bounded device?

Parents
  • As in the description of the sd_app_evt_wait() function says, the function will wait for application event. If you don't have application event, you will stay in that function. This explain why you can't get to nrf_drv_wdt_channel_feed(). And why you get there when you connect to a peripheral.

    Our suggestion is either using a timer to do wdt feeding, or you replace sd_app_evt_wait() with

    __WFE();
    __SEV(); 
    __WFE();
    

    This way you will wake up when there is any BLE event (when softdevice is active), not just application event.

Reply
  • As in the description of the sd_app_evt_wait() function says, the function will wait for application event. If you don't have application event, you will stay in that function. This explain why you can't get to nrf_drv_wdt_channel_feed(). And why you get there when you connect to a peripheral.

    Our suggestion is either using a timer to do wdt feeding, or you replace sd_app_evt_wait() with

    __WFE();
    __SEV(); 
    __WFE();
    

    This way you will wake up when there is any BLE event (when softdevice is active), not just application event.

Children
Related