当前位置:网站首页>STM32 Personal Notes - Watchdog
STM32 Personal Notes - Watchdog
2022-08-01 09:48:00 【Couvrir wild beast】
Part of the notes are from the public account of "STM32 Embedded Development".
Watchdog
Early MCUs did not have a watchdog, which could easily cause some products to crash and fail to restart.To avoid this problem, later MCUs inherit the function of watchdog internally.
There are two kinds of watchdogs, which are used in different fields.Two watchdogs: independent watchdog and window watchdog.
Independent Watchdog
It is known from the RCC clock tree that the LSI drives the independent watchdog.Remains active even in the event of a master clock transmission failure.
IWDG is most suitable for those occasions where the watchdog needs to be used as an outside of the main program, can work completely independently, and requires less time precision.
Features:
Free running down counter.
Clocked by independent RC oscillator (can operate in standby and stop modes).
A reset occurs when the down counter value reaches 0x000 (if the watchdog is activated).
Window watchdog
The reason why it is called a window is because the dog feeding time is within a range with upper and lower limits. You can set the upper limit time and lower limit time by setting the time register: the dog feeding time cannot be too early or too late..
Features:
A programmable down counter.
Conditions to trigger chip reset:
The down counter has not been updated for a certain period of time -- commonly known as feeding the dog.
Not updated within the specified time frame---------------It's too early to feed the dog, the dog is not hungry yet.
Watchdog Reset Early Warning Interrupt -- Gives the application a chance to update the down counter (feed the dog) before the chip resets.

The upper limit window of the window watchdog is the configuration register WWDG_CFG: W[6:0], and the lower limit window is fixed 0x40.
A reset occurs when the window watchdog counter is outside the upper limit window or outside the lower limit window.

The upper limit window is set by WWDG_CFG:W[6:0], the maximum is 0x7F, which is 127.The minimum is 0x40, which is 64.So the value range is 0x40~0x7F, that is, 64~127.
Configuration register WWDG_CFG: WDGTB[1:0] sets the clock frequency division factor for the counter, determines the time range that the counter can time, and thus determines the time range of the window.
The clock of the window watchdog comes from PCLK1, and its frequency is 36M in the clock configuration.Then, the WWDG timeout period can be calculated by the above timeout formula.
Difference
Condition comparison:

Characteristic comparison:
Similar points

Different points
The difference between the two:
The independent watchdog has no interrupts, and the windowed watchdog has interrupts.
The independent watchdog is divided into hardware and software, and the window watchdog can only be controlled by software.
Independent watchdog has only lower limit, window watchdog has lower limit and upper limit.
The independent watchdog is 12-bit decremented, and the windowed watchdog is 7-bit decremented.
The independent watchdog uses the internal RC oscillator of about 40kHz, and the window watchdog uses the system clock APB1.
The independent watchdog has no interrupt function. As long as the value of the counter is reloaded before the counter decreases to 0 (lower limit), no reset will be generated.
Be careful when the watchdog and an external reset IC exist at the same time, the external circuit may prevent the watchdog from being reset.
The window watchdog has an interrupt. The function of this interrupt is to generate an interrupt when the counter reaches the lower limit of 0x40, allowing you to feed the dog.If the dog is not fed, the system reset will be generated when the value of the counter becomes 0x3f.Even if you feed the dog, you should feed the dog quickly in the interrupt, or the counter will decrease by 1 after a long time and it will become 0x3f to reset.
The window watchdog also has an upper limit value, the counter can only be loaded if the counter value is between the upper limit value and the lower limit value, otherwise a system reset will be generated.When the upper limit value is smaller than the lower limit value, it is meaningless.
边栏推荐
猜你喜欢

Analysis of High Availability Solution Based on MySql, Redis, Mq, ES

灵魂发问:MySQL是如何解决幻读的?

用OpenCV的边缘检测

Intensive reading of ACmix papers, and analysis of its model structure

How to implement deep copy in js?

周鸿祎称微软抄袭 360 安全模式后发文否认;英特尔CEO基辛格回应市值被AMD超越:股价下跌是咎由自取|极客头条

mysql在cmd的登录及数据库与表的基本操作

Idea common plugins
![[Dataset] Dataset summary of various insulators, bird's nests and anti-vibration hammers](/img/02/927f4e228eb3abbd76cade5be00352.png)
[Dataset] Dataset summary of various insulators, bird's nests and anti-vibration hammers

ACmix 论文精读,并解析其模型结构
随机推荐
杰理AD14N/AD15N---串口中断问题
notes....
C language game - minesweeper
How programmers learn open source projects, this article tells you
用OpenCV的边缘检测
notes....
ASP.NET Core 6 Framework Revealing Instance Demonstration [30]: Develop REST API with Routing
关于#SQL#的问题,如何解决?
ogg同步oracle到mysql,字段里面可能有需要转义的字符,怎么配置转义?
AC与瘦AP的WLAN组网实验
mysql在cmd的登录及数据库与表的基本操作
Optimal dazzle Oracle database support what kinds of type of the time and date
笔记。。。。
【面试:并发篇39:多线程:线程池】ThreadPoolExecutor类-提交、停止
SkiaSharp's WPF self-painted five-ring bouncing ball (case version)
redis
C语言小游戏——扫雷
如何保证数据库与缓存数据一致性?
如何在IntellJ IDEA中批量修改文件换行符
解析MySQL数据库:“SQL优化”与“索引优化”