历史上的今天
今天是:2025年01月14日(星期二)
2019年01月14日 | STM32F4的窗口看门狗WWDG
2019-01-14 来源:eefocus
不管是开发指南,中英文参考手册,还是其他啥!讲来讲去就讲些废话,不就是下面这个东西嘛,理解了下面这个根本,其他的理解都是水到渠成……

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!
史海拾趣
|
我在.net下面开发PPC程序,在Pocket PC 2002模拟器调试的时候,中文输入非常 困难,经常想输入的文字找不到啊。有没有比较适合在模拟器环境下使用的输入 法呢?… 查看全部问答> |
|
用lanuchpad进行步进输出,调试可以进中断,却不能步进,求高手!!!!! 思路: 初始化——变量i(每中断一次i加一)——选择输出——循环代码:#include <msp430g2553.h>unsigned char i=3;void main(void){ WDTCTL = WDTPW+WDTHOLD;// Stop WDT P1DIR |= BIT7+BIT6+BIT5+BIT4 ...… 查看全部问答> |
|
看到这篇文章是讲关于苹果产品的充电器问题,给大家推荐, 网上有许多关于充电器能否互换的问题。例如,2A的充电器能否给1A的手机充电?(ipad的充电器能否给iphone充电),1A的充电器能否给2A的设备充电。这里我来谈谈我的见解,如有不妥,请指正 ...… 查看全部问答> |




