您的位置:首页 > 其它

STM32F4的窗口看门狗WWDG

2017-06-11 20:10 176 查看
不管是开发指南,中英文参考手册,还是其他啥!讲来讲去就讲些废话,不就是下面这个东西嘛,理解了下面这个根本,其他的理解都是水到渠成……



Figure 214. Watchdog blockdiagram
把这个图看懂,其他一切都搞定!
喜欢原汁原味的,不喜欢把人家(所谓英语专业翻译家们)咀嚼的再拿来嚼一嚼,不光苍白无味,而且可能还会中毒(翻译者本人可能都没理解,误导人!),所以下面直接上English!!

研究思路:
上面是解决方案啊,就是问题的答案,那么这个答案的问题是什么?就是这个东西是怎么产生的?为什么要产生这个东西?咱们放一放,后来再讲!

1解决方案,答案,解说:
1.1理解两句话:《STM32F4xx英文参考手册》中22.1的WWDG
introduction
1.1.1先来看第一句话:
The watchdog circuit generatesan MCU reset on expiry of a programmed time period, unless the programrefreshes the contents of the downcounter before the T6 bit becomes
cleared.

先看懂俩符号:





上面的logic gates来自《Digital Design and Computer Architecture》
再看下面窗口看门狗的数字电路:



Figure 214. Watchdog blockdiagram
只要T6位(注意这个T6位是7-bit downcounter最高位)为0,而且在窗口看门狗WWDG的WDGA位使能情况下,Reset输出为1

1.1.2好,再看第二句话:
An MCU reset is also generatedif the 7-bit downcounter value (in the control register) is refreshed beforethe downcounter has reached the window register value.

再看下面数字电路:



                                                       Figure 214. Watchdog block diagram
the downcounter has reached thewindow register value
the comparator输出为1
WDGA为1
自然RESET输出为1
 
1.2使能WWDG后,Programmable
free-running downcounter
 
1.3Early wakeup interrupt (EWI): triggered (if enabled and the watchdogactivated) when the downcounter
is equal to 0x40.
在T6位马上要减少到0时,果断early出发中断去“喂狗”:
 
1.4程序的思路就是按照上面“Figure 214. Watchdog block diagram”,理解了整个“解决方案”的运行过程了。根本不需要死记硬背!说不定还能提出自己的解决方案!自己设计数字电路!!!这就是创新那!!
 
2解决的问题解说:
         The window watchdog is used to detect the occurrenceof a software fault, usually generated by external interference or byunforeseen
logical conditions, which causes the application program to abandonits normal sequence.
         总之,一句话,程序如果是正常运行的,就可以定期去报到:我很正常。除非除了什么意外:被别人揍晕(external interference)或者自己把自己搞晕(unforeseen
logical conditions),在规定时间没能去报到,那就复位reset!

感觉不错文章:
STM32菜鸟成长记录---窗口看门狗点击打开链接
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: