iwdg: START and UNLOCK values before polling Busy
With code that uses IWDG and these operations: - user code initializes iwdg - user code jumps to USB-DFU - USB host triggers a USB exit (e.g. after reflashing, or even just a dummy dfu-util Reset/Exit command) - user code will hang in iwdg_prescaler_busy() called from iwdg_set_period_ms()
This commit is contained in:
committed by
Piotr Esden-Tempski
parent
9624f92d81
commit
a7632df7f4
@@ -102,11 +102,11 @@ void iwdg_set_period_ms(uint32_t period)
|
|||||||
prescale = PRESCALER_MAX;
|
prescale = PRESCALER_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (iwdg_prescaler_busy());
|
IWDG_KR = IWDG_KR_START;
|
||||||
IWDG_KR = IWDG_KR_UNLOCK;
|
IWDG_KR = IWDG_KR_UNLOCK;
|
||||||
|
while (iwdg_prescaler_busy());
|
||||||
IWDG_PR = prescale;
|
IWDG_PR = prescale;
|
||||||
while (iwdg_reload_busy());
|
while (iwdg_reload_busy());
|
||||||
IWDG_KR = IWDG_KR_UNLOCK;
|
|
||||||
IWDG_RLR = count & COUNT_MASK;
|
IWDG_RLR = count & COUNT_MASK;
|
||||||
|
|
||||||
/* Refresh counter after configuration is complete */
|
/* Refresh counter after configuration is complete */
|
||||||
|
|||||||
Reference in New Issue
Block a user