Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

There is an error in the WDT driver SDK15.2

nrfx_err_t nrfx_wdt_init(nrfx_wdt_config_t const * p_config,
                         nrfx_wdt_event_handler_t  wdt_event_handler)
{
    NRFX_ASSERT(p_config);
    NRFX_ASSERT(wdt_event_handler != NULL);
    nrfx_err_t err_code;
    m_wdt_event_handler = wdt_event_handler;

    if (m_state == NRFX_DRV_STATE_UNINITIALIZED)
    {
        m_state = NRFX_DRV_STATE_INITIALIZED;
    }
    else
    {
        err_code = NRFX_ERROR_INVALID_STATE;
        NRFX_LOG_WARNING("Function: %s, error code: %s.",
                         __func__,
                         NRFX_LOG_ERROR_STRING_GET(err_code));
        return err_code;
    }

    nrf_wdt_behaviour_set(p_config->behaviour);

    nrf_wdt_reload_value_set((p_config->reload_value * 32768) / 1000);

    NRFX_IRQ_PRIORITY_SET(WDT_IRQn, p_config->interrupt_priority);
    NRFX_IRQ_ENABLE(WDT_IRQn);

    err_code = NRFX_SUCCESS;
    NRFX_LOG_INFO("Function: %s, error code: %s.", __func__, NRFX_LOG_ERROR_STRING_GET(err_code));
    return err_code;
}

When the value of reload_value is too large, the calculation will exceed the maximum allowed by uint32_t。

Parents
  • This is not an error, it is not the intention that the reload value should be bigger than 4294967295 (largest number that a 32 bit variable can hold), see WDT_CONFIG_RELOAD_VALUE in the sdk_config.h:

    // <o> WDT_CONFIG_RELOAD_VALUE - Reload value  <15-4294967295> 
    
    
    #ifndef WDT_CONFIG_RELOAD_VALUE
    #define WDT_CONFIG_RELOAD_VALUE 2000
    #endif

    Best regards,

    Simon

Reply
  • This is not an error, it is not the intention that the reload value should be bigger than 4294967295 (largest number that a 32 bit variable can hold), see WDT_CONFIG_RELOAD_VALUE in the sdk_config.h:

    // <o> WDT_CONFIG_RELOAD_VALUE - Reload value  <15-4294967295> 
    
    
    #ifndef WDT_CONFIG_RELOAD_VALUE
    #define WDT_CONFIG_RELOAD_VALUE 2000
    #endif

    Best regards,

    Simon

Children
Related