stm32:iwdg: reset counter after changing period.
Fix the bug that the iwdg counter is not refreshed after the configurationis complete, if this counter is not refreshed after the configuration is completed, the first iwdg counting period will be as long as 26 seconds. Fixes: https://github.com/libopencm3/libopencm3/pull/1333 Reviewed-by: Karl Palsson <karlp@tweak.net.au>
This commit is contained in:
@@ -108,6 +108,9 @@ void iwdg_set_period_ms(uint32_t period)
|
||||
while (iwdg_reload_busy());
|
||||
IWDG_KR = IWDG_KR_UNLOCK;
|
||||
IWDG_RLR = count & COUNT_MASK;
|
||||
|
||||
/* Refresh counter after configuration is complete */
|
||||
iwdg_reset();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user