How watchdog protection works

Among the hardware protection measures, there is one that can make the internal process of the device not paralyzed for 24 hours, which is the watchdog technology. In order to make the transmission of industrial routers, DTUs, and other network devices more stable. These devices will be equipped with anti-surge, anti-static, anti-pulse, and watchdog protection. How does the watchdog protection work and calculate?

Watchdog chip, also called watchdog timer. It is a piece of hardware in a microcontroller. If the system gets stuck somewhere, then the watchdog timer is used to generate a system reset, and if the system gets into an infinite loop of execution, then the watchdog timer will reset the system to get out of the infinite loop. Watchdog is a safety mechanism in embedded systems that makes your system reliable, but it depends on how the watchdog timer is used.

How watchdog protection works

How watchdog protection works

A watchdog is basically a counter that starts counting from zero and reaches a certain value. If the counter reaches a certain value, the watchdog hardware will generate a watchdog reset. To avoid system reset, the software needs to start the watchdog, which means the counter needs to be reset to zero. In case the software gets stuck in 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 protection is initially loaded with certain values. This value is calculated based on the watchdog’s timeout (further instructions on how to calculate the counter value based on the timeout value are provided). Before timing out, the system should reset the counter.

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

Watchdog computing

Consider the system in Watchdog is operating with a 4 kHz clock. The system completes the work in 450 milliseconds, and in the worst case, it takes 500 milliseconds to complete the work. Let’s use 500 milliseconds as the timeout.

1/4 kHz = 0.25 milliseconds

1 clock tick = 0.25 milliseconds.

500 milliseconds = 2000 ticks.

When the clock ticks 2000 times, it completes 500 milliseconds. The technical value associated with 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 reaching 2000.

How watchdog protection works

Advanced use cases for watchdog timers

In the case of operating systems (multitasking systems), watchdog plays an important role. Watchdogs can monitor program flow and monitor the frequency of task execution (activity supervision). A watchdog reset is generated if the watchdog detects a program flow conflict or if a task is executed too frequently or infrequently.

In the case of online supervision, each task has a flag set to indicate that the task is online, that is, executed. The watchdog monitor function will check whether each task has reported an active indication. If the task is not set to activate indication, the watchdog monitor function will never kick the watchdog and eventually the watchdog will reset the system.

Applications of Watchdog Protection

1. Embedded Systems

In embedded systems, watchdog protection is used to monitor the operation of microcontrollers. Since embedded devices often operate in unattended environments, any software failure or hardware error can lead to system crashes. The watchdog timer regularly checks the system’s responsiveness to ensure the device operates normally. If the device fails to send a signal on time, the watchdog will reset the system to restore functionality.

2. Industrial Automation

In industrial automation, equipment reliability is crucial, as downtime can result in significant financial losses. Watchdog protection ensures that devices on the production line can quickly recover from faults. For example, in robots and control systems, if software malfunctions occur, the watchdog can promptly restart the system, maintaining production efficiency and minimizing delays.

3. Telecommunications

In telecommunications networks, routers and switches need to operate continuously to ensure stable data flow. Watchdog protection can monitor the status of these devices and address potential failures in a timely manner. By resetting unresponsive devices, network administrators can reduce the risk of service interruptions and ensure high-quality connections for customers and overall network reliability.

4. Automotive Systems

Modern vehicles are equipped with numerous electronic control units (ECUs) responsible for critical functions such as braking, steering, and power systems. Watchdog protection is essential in these systems, ensuring that critical functions operate correctly under all circumstances. For instance, if the control software for the braking system malfunctions, the watchdog will immediately reset the control unit, ensuring the vehicle can continue to operate safely.

Summary

Watchdog protection demonstrates its importance across various industries, enhancing system reliability and safety. By promptly monitoring and addressing faults, it provides reliable support for many industrial devices and automotive systems.

Keywords: 4gdtu

Recent Articles

Contact Us