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

WDT triggered too early

Hi everyone,

I'm using nrf52840 custom board (pca10056)

SDK version: 15.3

OS: Fedora

I work on a custom board and try to use WDT like so in the WTD project example:

int main(void)
{
    uint32_t err_code = NRF_SUCCESS;

    //BSP configuration for button support: button pushing will feed the dog.
    err_code = nrf_drv_clock_init();
    APP_ERROR_CHECK(err_code);
    nrf_drv_clock_lfclk_request(NULL);

    err_code = app_timer_init();
    APP_ERROR_CHECK(err_code);

    // err_code = bsp_init(BSP_INIT_BUTTONS, bsp_event_callback);
    // APP_ERROR_CHECK(err_code);

    //Configure all LEDs on board.
    // bsp_board_init(BSP_INIT_LEDS);
    nrf_gpio_cfg_output(RLED);
    nrf_gpio_cfg_output(GLED);
    nrf_gpio_cfg_output(BLED);
    nrf_gpio_pin_set(RLED);
    nrf_gpio_pin_set(GLED);
    nrf_gpio_pin_set(BLED);

    //Configure WDT.
    nrf_drv_wdt_config_t config  = NRF_DRV_WDT_DEAFULT_CONFIG;
    config.behaviour = NRF_WDT_BEHAVIOUR_RUN_HALT;
    config.reload_value = 360000;
    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();

    //Indicate program start on LEDs.
    // for (uint32_t i = 0; i < LEDS_NUMBER; i++)
    // {   nrf_delay_ms(200);
    //     bsp_board_led_on(i);
    // }
    //  err_code = bsp_buttons_enable();
    //  APP_ERROR_CHECK(err_code);

    nrf_delay_ms(2000);

    led_on(GLED);

    while (1) {
        // __SEV();
        // __WFE();
        // __WFE();
    }
}

When I set the reload value to 10 000ms my WDT is triggered every 10s but when I try 360 000ms (6min) it's triggered approximately at 1min and 30s only...

What am I doing wrong?

Parents Reply Children
Related