RTOS System Articles - Watchdog WatchDog [If you don't feed the dog, it will bite you]

RTOS System Articles - Watchdog WatchDog [If you don't feed the dog, it will bite you]

overview

After the program design is completed, it is time to consider the overall stability of the system.
After the device goes online, problems such as unreasonable program design, bugs in hardware design, electrical interference, static noise, power failure, etc. may cause the device to enter an infinite loop, run away, or crash. At this time, a role that monitors whether the system is normal is needed to detect system abnormalities.
As mentioned earlier, an RTOS is a multitasking operating system. But the CPU resource of a device is limited, how to ensure that multiple tasks can have the opportunity to apply for the right to use the CPU is the key to the system program design. Some important tasks, such as the idle task mentioned above, must obtain the right to use the CPU within the specified time, otherwise functions such as memory recovery that depend on the idle task will not be executed, posing a serious threat to the stability of the device. The watchdog mechanism is a mechanism to ensure that critical tasks are executed regularly.

Watchdog is essentially a timer that needs to be reset regularly. Once it is not reset in time, it will trigger a timeout. This timeout usually causes a system reset. In terms of implementation, when an object is added to the watchdog, it is equivalent to initializing a count timer. Before the count decreases to less than 0, the object must reset the word value at least once, otherwise the pending count value decreases to 0 , will trigger the watchdog.

insert image description here

In ESP32, there are two kinds of watchdogs: task watchdog and interrupt watchdog. Their principles and mechanisms are similar,

Guess you like

Origin blog.csdn.net/wangyx1234/article/details/129033543