Watchdog in Embedded Study Notes (11) Compilation

3.1.1 What is a watchdog?

Watchdog (watch dog timer watchdog timer). Let’s imagine a scene like this: There is a dog at the door of the house. The dog will be hungry at regular intervals (for example, once every 2 hours), and when it is hungry enough, it will kill people indiscriminately. To ensure safety when people come in and out, the dogs must be fed in advance (the dogs must be fed within 2 hours of the last feeding). If the dog is not fed within the time limit, it will be killed. It does not matter if the dog is fed in advance, but the feeding time of this time will be counted from here.

In reality, due to some external factors, electronic equipment often runs away or crashes (such as extreme heat, extreme cold, and industrial complex occasions). In this case we want the device to reset automatically without human intervention (unattended). The watchdog is used to do this job. The watchdog is actually a timer inside our SoC (similar to an alarm clock, similar to a dog at the door). After the time is set, the watchdog timer will count and must be reset before the time is up (before the dog is hungry). Watchdog timer (feed the dog), if the dog is not fed, the system will be forced to reset.

When the system is working normally, the system software will feed the dog by itself, so the watchdog timer will not be reset. But once the system malfunctions and runs away, the watchdog will not be fed, and then it will automatically reset in the next cycle, achieving our desired effect.

3.1.2 Analyze hardware physical characteristics, schematic diagrams, and data sheets

In terms of physical characteristics, the watchdog is actually a timer (similar to an alarm clock in reality), and in terms of hardware, it is an internal peripheral inside the SoC.

Schematic diagram: The watchdog does not need to analyze the schematic diagram, because the watchdog is an internal peripheral, and there are no external related components related to it, so schematic analysis is not required, and there is no watchdog-related information on the schematic diagram. place.

Data booklet: In Section 7.3 of the data booklet, you can read it in detail. If you can't read the data manual directly, you can Baidu Watchdog, and then read other people's blogs to learn.

3.1.3 Find the critical operation SFR

WTCON (0xE2700000), where bit5 is the switch of the watchdog: 0 means off, 1 means on

3.1.4 Summary of watchdog features in 210 (watchdog has been turned off in iROM)

Why turn off the watchdog?

In general CPU design, the watchdog works by default after the CPU is started (why does it work instead of being turned off by default? I guess it is because you are afraid that your program will crash or run away at the front end of the startup code and no one will care about it). The advantage is that There are no gaps and loopholes. The downside is that the watchdog will reset when it is inconvenient for us to feed the dog (or too lazy to feed the dog) in the startup code segment, so in order to be lazy, we first turn off the watchdog at the front end of the startup code, and then in the Later, after the system is started, it is decided whether to open the watchdog according to the needs (once it is opened, the dog must be fed at the same time).

In the iROM code (BL0) inside S5PV210, the watchdog has actually been turned off. So our startup code actually doesn’t need to be turned off, that is to say, there is no phenomenon after the code written today to turn off the watchdog runs (no phenomenon is normal).

Many CPUs do not have BL0 inside, so no one will turn off the watchdog for you. You have to write code to turn off the watchdog before starting the code, so this part of the learning content is also valuable.

 For more embedded study notes and practical projects, click here to get free

Guess you like

Origin blog.csdn.net/m0_70888041/article/details/132662431