Embedded Systems & Firmware
Why is it bad practice to kick (reset) the watchdog timer unconditionally inside a 1 ms timer interrupt handler?
- AThe watchdog may never be touched from inside an interrupt
- BEven if the main processing hangs in an endless loop, the interrupt keeps running, so the watchdog can no longer detect the fault
- CKicking every 1 ms damages the watchdog
Show answer and explanation
Answer: B. Even if the main processing hangs in an endless loop, the interrupt keeps running, so the watchdog can no longer detect the fault
A watchdog resets the microcontroller if it is not kicked within a set time, recovering from runaway code. But a timer interrupt keeps firing even when the main processing has hung, so kicking there unconditionally hides the hang. The basic practice is to confirm that the main loop and each task have completed a normal cycle and kick only when all have checked in.
- A. There is no such rule.
- B. Correct. Kick only after confirming normal operation.
- C. Frequent kicking does no damage.