Jane summary: watchdog wdt summary

When using the watchdog, pay attention to:

1. The projects I usually do are small and medium-sized projects, so I set the watchdog timer interval to 1s. If the watchdog timer interval is set very short because of the chip system clock and resource constraints, for example, c8051f410 When the system clock is 24.5MHZ, the maximum interval of the watchdog timer is 32.1ms. At this time, the simple method is to make the frequency of feeding the dog more frequent in the main program. Try to feed the dog within 32.1ms. A slightly more complicated method, change the wdt clock source to timer 0, or change the frequency of the system clock, such as dividing the system clock. At this time, it will affect some other peripherals, such as timer or uart baud rate settings .

2. Where do you need to feed dogs?

Answer: Where there is a delay, you need to feed the dog, such as a delay function, such as a large for loop, flash operation, encryption algorithm. Where the logic is complex, a large amount of code needs to be executed.

3. Can I feed the dog in the interrupt function?

Answer: No,

The role of feeding dogs is to detect whether the main program is running off. If we feed the dog on the timer and feed the dog regularly, then the main program will run away, and the watchdog will not reset the program.

Published 105 original articles · Like 30 · Visits 160,000+

Guess you like

Origin blog.csdn.net/happygrilclh/article/details/105034462