How Watchdog Protection Works?

In order to make the transmission of networking devices such as industrial routers, DTUs, serial servers, etc. more stable, these devices come with anti-surge, anti-static, anti-pulse, and watchdog protection. Among these hardware protections, there is one that can keep the internal processes of the device from going down for 24 hours – the watchdog technology. How does a watchdog work and calculate?

The watchdog chip, also known as the watchdog timer. It is a piece of hardware in a microcontroller. The watchdog timer is used to generate a system reset if the system is stuck somewhere, and if the system enters an infinite loop of execution, the watchdog timer resets the system to get out of the infinite loop. The watchdog is a safety mechanism in embedded systems that makes your system reliable, but it depends on how the watchdog timer is used.

1617068278600167

How watchdogs work

A watchdog is basically a counter that starts counting zero and reaches a certain value. If the counter reaches a certain value, the watchdog hardware generates a watchdog reset. To avoid a system reset, the software needs to start the watchdog, i.e. it needs to reset the counter to zero. In case the software gets into an endless loop, the system will not be able to kick the watchdog, so the counter reaches a certain value and resets the system.

The watchdog is initially loaded with some value. This value is calculated based on the watchdog’s timeout (further instructions are given on how to calculate the counter value based on the timeout value). Before the timeout, the system should reset the counter.

For example, if your system regularly executes 3 tasks and it takes 500 ms to execute the 3 tasks. Then consider the timeout as 600 ms (consider the worst case), calculate the counter value for 600 ms and load it into the watchdog.

Watchdog calculation

Consider that the system in the watchdog is operating at a 4 kHz clock. The system completes its work in 450 ms, and in the worst case, completes its work in 500 ms. Let us take 500 milliseconds as the timeout.

1/4 kHz = 0.25 milliseconds

1 clock beat = 0.25 milliseconds.

500 milliseconds = 2000 ticks.

When the clock ticks 2000 times, 500 milliseconds are completed. The technician value associated with the timeout is 2000.

If the watchdog counter reaches 2000, it will generate a reset signal. The system needs to reset the counter to 0 before it reaches 2000.

1617068382495589

Advanced use cases for watchdog timers

In the case of operating systems (multitasking systems), watchdogs play an important role. The watchdog can monitor the program flow and how often tasks are executed (activity supervision). A watchdog reset is generated if the watchdog detects a program flow conflict or a task being executed too often or not so often. In the case of online supervision, a flag is set for each task to indicate that the task is online, i.e., executed. The watchdog monitor function will check that each task is reporting an active indication. If the task is not set to an active indication, the Watchdog Monitor function will never kick the watchdog and eventually the watchdog will reset the system.

Advantages of Dual Watchdogs in Edge Computing Gateways

Dual watchdog system is used in the design of edge computing gateway of IOTRouter. It offers major advantages in improving system reliability and security.

First, dual watchdogs provide enhanced reliability and redundant design. When one watchdog fails, the other can still be monitored and controlled, ensuring continuous system operation. This redundancy design greatly reduces the risk of failure, allowing the edge computing gateway to perform better in critical applications.

Second, dual watchdogs improve fault detection. Through multiple monitoring of different system parts, dual watchdogs can detect potential problems in a timely manner, thus reducing the likelihood of overall system failure. This cross-validation mechanism not only reduces the false alarm rate, but also improves the fault response speed.

In addition, the flexible configuration of dual watchdogs supports the complex needs of edge computing gateways. Different watchdogs can be set up for specific tasks, providing a more flexible monitoring solution that adapts to diverse application scenarios.

Finally, the real-time data monitoring capability of the dual-watchdog system should not be overlooked. Two watchdogs collect data simultaneously, providing comprehensive system status information that helps subsequent analysis and optimization. This enables the edge computing gateway to respond more effectively to various real-time data processing needs.

 

Recent Articles

Contact Us