|
STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
|
WWDG driver: start, refresh and debug-freeze the window watchdog. More...
Go to the source code of this file.
Macros | |
| #define | WWDG_COUNTER_MIN (0x40U) |
| Lowest counter or window value: 0x3F is the reset point. | |
| #define | WWDG_COUNTER_MAX (0x7FU) |
| Highest counter or window value (7 bits). | |
Functions | |
| DRIVER_MUST_CHECK DriverStatus_e | wwdgStart (WwdgRegisters_t *wwdg, uint32_t prescaler, uint32_t window, uint32_t counter) |
Set the window and timer base, then start the watchdog counting from counter. | |
| DRIVER_MUST_CHECK DriverStatus_e | wwdgRefresh (WwdgRegisters_t *wwdg, uint32_t counter) |
Reload the counter with counter (CR = WDGA | counter). | |
| void | wwdgEnableEarlyWakeup (WwdgRegisters_t *wwdg) |
| Raise WWDG_IRQn when the counter reaches 0x40, one count before reset. | |
| void | wwdgClearEarlyWakeup (WwdgRegisters_t *wwdg) |
| Clear the early-wakeup flag (SR.EWIF, write 0 to clear). | |
| void | wwdgFreezeInDebug (DbgmcuRegisters_t *dbgmcu) |
| Stop the WWDG counter whenever the core is halted by a debugger. | |
WWDG driver: start, refresh and debug-freeze the window watchdog.
The 7-bit counter CR.T counts down at PCLK1 / 4096 / 2^WDGTB and resets the chip when it falls from 0x40 to 0x3F. A refresh also resets the chip if it comes while the counter is still above the window CFR.W, so the WWDG catches code that runs too fast as well as too slow. With PCLK1 at 45 MHz and /8, one count is 728 us, and 0x7F to 0x3F is about 46 ms.
The usual pattern refreshes from the early-wakeup interrupt, raised at 0x40, which is inside the window as long as W is above 0x40:
After a reset, rccResetFlags() reports whether the WWDG caused it.
Definition in file wwdg.h.