Embedded Calculators & Part Finder
Size a value with 64 free calculators, then find the real component that fits — in stock, at the best price. For MCU, power, RF & firmware. No account.
Watchdog Timer Calculator
Calculate timeout and window constraints for STM32 IWDG and WWDG.
Watchdog Timers prevent system lockups by resetting the MCU if the firmware fails to "kick" or reload the timer before it expires.
Formulas:
- IWDG Timeout:
Timeout = (4 * 2^PR * RLR) / LSI_Clock - WWDG Timeout:
Timeout = (4096 * 2^WDGTB * (T - 63)) / PCLK1
Usage: Choose your watchdog type. Set the prescaler and reload values to find the exact timing constraints for refreshing your watchdog safely.
When you need it: Recovering an embedded system from firmware hangs — stuck loops, deadlocks, corrupted state — out in the field where nobody can press reset. The watchdog resets the MCU automatically unless your code "kicks" (reloads) it within the timeout window.
Worked example: STM32 IWDG with LSI ≈ 32 kHz, prescaler PR = 4 (÷64) and reload RLR = 1000 → Timeout = (4 × 2⁴ × 1000) / 32000 = 2.0 s. Kick it at least every ~1.5 s to leave margin against jitter.
Tips & gotchas:
- Set the timeout to roughly 1.5–2× your longest legitimate loop: too short causes false resets, too long slows recovery.
- Kick the watchdog from one place in your main loop — never scatter kicks across interrupts, or a hung main loop still gets refreshed and the watchdog is useless.
- STM32 IWDG runs off the independent LSI oscillator (survives a main-clock failure); WWDG runs off PCLK1 and adds a window — kicking too early also triggers a reset.
- The LSI frequency has a wide tolerance (≈ ±5–10%); design your kick interval with that margin in mind.