Fix overflow calculation for reload_value.

Please,  note that this patch fixes upstream bug. See:

https://devzone.nordicsemi.com/f/nordic-q-a/51674/maximum-reload-time-for-wdt
pull/11894/head
Giampaolo Mancini 2019-10-15 17:36:40 +02:00 committed by adbridge
parent 688e436bd9
commit a42ff3212c
2 changed files with 2 additions and 2 deletions

View File

@ -69,7 +69,7 @@ watchdog_status_t hal_watchdog_stop(void)
uint32_t hal_watchdog_get_reload_value(void)
{
// Convert to milliseconds from 32768 Hz clock ticks.
return nrf_wdt_reload_value_get() / 32768U * 1000;
return (uint64_t)nrf_wdt_reload_value_get() / 32768U * 1000;
}
watchdog_features_t hal_watchdog_get_platform_features(void)

View File

@ -90,7 +90,7 @@ nrfx_err_t nrfx_wdt_init(nrfx_wdt_config_t const * p_config,
nrf_wdt_behaviour_set(p_config->behaviour);
nrf_wdt_reload_value_set((p_config->reload_value * 32768) / 1000);
nrf_wdt_reload_value_set(((uint64_t)p_config->reload_value * 32768) / 1000);
NRFX_IRQ_PRIORITY_SET(WDT_IRQn, p_config->interrupt_priority);
NRFX_IRQ_ENABLE(WDT_IRQn);