Hello, my name is Duck.
During my training on microcontrollers, I came across something called a watchdog timer.
The watchdog timer is the Guard dog of the CPU, which is the heart of the microcontroller. The watchdog timer is built into many microcontrollers.
Arm® systems have a watchdog timer, and Altera's Nios® II (soft core processor) also has a watchdog timer.
What is a Watchdog Timer?
A watchdog timer is a device that monitors the system to make sure it is working properly.
It checks to see if the CPU and other devices are working properly. Of course, if it finds something wrong, it will react accordingly.
Figure 1: What is a watchdog timer?
Monitoring System
So how does it check?
The watchdog timer counts a certain amount of time, during which the CPU periodically resets the counter.
If the counter is not reset and the count value exceeds a certain value, it signals an error.
Figure 2. How the Watchdog Timer Works
If no signal is received for a certain period of time and an abnormality is detected, the process to be followed is determined in advance. The watchdog timer is used to initiate that process.
It does not matter if the time is not always the same, as long as the timer can be reset within the time limit.
The operation of the watchdog timer during normal operation and when an error occurs is shown in Figure 3.
Figure 3: Operation under normal and abnormal conditions
In the example of the operation at the time of an error shown in Figure 3, the watchdog timer sends a signal to notify an error if no signal is received from the CPU for a certain period of time. The CPU receives the signal and initializes itself.
The CPU is the heart of the microcontroller; if the CPU does not function properly, the entire system will not operate properly.
The watchdog timer plays an important role in signaling that something is wrong with the CPU.
Important to remember +α
The watchdog timer should normally be stopped when debugging.
If you do not run at the normal speed, such as step execution, the watchdog timer will consider it as an anomaly and initialize the CPU.
If you look at the debugging source code, you may find the code to stop the watchdog timer at the beginning.
New Engineer's Blush Blog Articles