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
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.