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

nRF52832 WDT sometimes not firing when using multiple channels

Hello,

I am trying to figure out a problem with the WDT module behavior

Running on an nrf52832 and using SDK 11 with softdevice s132 v2.0.0!

There are 3 WDT channels allocated (channel index 0,1,2) the 1st gets its feed from the while(1) loop, the other 2 suppose to make sure that I am entering a specific place in the SW and get their feed over there.

The problem is, that sometimes (and I am not sure under what circumstance exactly) the WDT is not triggering a RESET even if it does not feed! it happens only on channel 1,2 and never on channel 0

Test method:

Stopped the feed for channel 1/2 and wait for CRV time, and expected RESET sometimes happens & sometimes doesn't!

Again, when doing the same test to channel 0, it always RESETS

The WDT is configured to work also in SLEEP & HALT

As for now and only for a workaround, I am using the 1st channel only and created my own mechanism for multiple channels - in order to protect these other places of the code.

I want to understand the root cause of this issue as it is very disturbing to know that something is wrong with your WDT behavior.

Any thoughts? ideas?

#define NRF_WDT_TIMEOUT_MS (120000) 

typedef enum{
    AUGU_WD_CHAN_ID_FIRST = 0,
    AUGU_WD_CHAN_ID_MAIN = AUGU_WD_CHAN_ID_FIRST,
    AUGU_WD_CHAN_ID_COMM,
    AUGU_WD_CHAN_ID_ACTUAL_COMM,

    AUGU_WD_CHAN_ID_SIZE
} augu_wd_channel_id_t;

static nrf_drv_wdt_channel_id m_channel_ids[AUGU_WD_CHAN_ID_SIZE] = {AUGU_WD_CHAN_ID_MAIN};

uint32_t augu_watchdog_init(void)
{
    nrf_drv_wdt_config_t config;
    config.behaviour = NRF_WDT_BEHAVIOUR_RUN_SLEEP;
    config.reload_value = NRF_WDT_TIMEOUT_MS;
    uint32_t err_code = nrf_drv_wdt_init(&config, NULL);
    if(err_code == NRF_SUCCESS)
    {
        for (int i=0; i<AUGU_WD_CHAN_ID_SIZE; i++)
        {
            APP_ERROR_CHECK(nrf_drv_wdt_channel_alloc(&m_channel_ids[i]));
            NRF_LOG_PRINTF("%d: allocated channel %d",i,m_channel_ids[i]);
        }
        
        nrf_drv_wdt_enable();
    }
    return err_code;
}

void augu_watchdog_feed(augu_wd_channel_id_t channel_id)
{
    nrf_drv_wdt_channel_feed(m_channel_ids[channel_id]);
}

Parents Reply Children
No Data
Related