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

Having watchdog timer timeout when advertising without timeout

Hi,

I am using nRF5_SDK_12.3.0 and based on \ble_peripheral\ble_app_uart ( with softdevice of s130) to build my application.

Recently, I tried to add the wdt to my nrf51822 firmware.

So I config the following in sdk_config.h as follows:

WDT_ENABLED 1

WDT_CONFIG_BEHAVIOUR 0

WDT_CONFIG_RELOAD_VALUE 2000

WDT_CONFIG_IRQ_PRIORITY 3

And initialize the wdt using the following 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()

The watchdog feeding is in main loop

            for (;;)
            {
                nrf_drv_wdt_channel_feed(m_channel_id);
                power_manage();
            }

However, when I trigger the ble advertising with APP_ADV_TIMEOUT_IN_SECONDS is 0 (disabling the timeout). The chip enter wdt_event_handler after about 1.5 mins. I don't know why  as the WDT_CONFIG_BEHAVIOUR is also set to 0 so that wdt pause at halt and sleep mode.

Please let me know your comment on this issue. Thanks.

Parents
  • Hello,

    I guess what you see is that even though your application doesn't get any interrupts (which would feed the watchdog), then you still have some softdevice interrupts, which will enable the CPU, and hence the WDT for a short amount of time. If the interrupt cause an application layer interrupt, your main loop (for (;;)) will not be called, and you will not feed it.

    A solution could be to enable radio notifications (old tutorial, but it still work with the current SDKs), to get an application layer interrupt before the radio events, which you can use to feed the watchdog.

    Best regards,

    Edvin

Reply
  • Hello,

    I guess what you see is that even though your application doesn't get any interrupts (which would feed the watchdog), then you still have some softdevice interrupts, which will enable the CPU, and hence the WDT for a short amount of time. If the interrupt cause an application layer interrupt, your main loop (for (;;)) will not be called, and you will not feed it.

    A solution could be to enable radio notifications (old tutorial, but it still work with the current SDKs), to get an application layer interrupt before the radio events, which you can use to feed the watchdog.

    Best regards,

    Edvin

Children
No Data
Related