Independent watchdog IWDG

Since the single-chip microcomputer may be disturbed during the working process, causing the program to run away and fall into an endless loop, so out of the consideration of real-time monitoring of the single-chip microcomputer running status, a module or chip specially used to detect the running status of the single-chip microcomputer program has been produced. Commonly known as "watchdog".

The independent watchdog works outside the main program and can work completely independently. Its clock is a dedicated low-speed clock (LSI), powered by VDD, and can still work in stop mode and standby mode. It is necessary to feed the dog before the time overflows, otherwise the MCU will always reset

The clock of the independent watchdog is provided by an independent RC oscillator LSI , even if the main clock fails, it is still valid and very independent. enable
After IWDG , the LSI clock is automatically turned on. LSI clock frequency is not precise, F1 uses 40kHz .
LSI gets the counter clock through an 8 -bit prescaler.
Frequency division coefficient algorithm:
                                PSC=4*2^take
*prer is the value of IWDG_PR .
Independent watchdog overflow time formula:
                                

 For example, to set the overflow time to 1s, you can set PSC=64, RLR=625 in CubeMX.

 HAL_IWDG_Refresh(&hiwdg); Use this function to feed the dog.

Guess you like

Origin blog.csdn.net/weixin_62599865/article/details/131198285