硬汉嵌入式论坛

 找回密码
 立即注册
查看: 9618|回复: 2
收起左侧

[客户分享] STM32F4学习笔记一(F1和F4的窗口看门狗)

[复制链接]

20

主题

55

回帖

20

积分

初级会员

积分
20
发表于 2012-12-23 18:01:23 | 显示全部楼层 |阅读模式
窗口看门狗也比较的好理解,举一个简单的例子。
(1)比如计数范围0x00-0xff,如果到了0x40以下,肯定的发生复位,
        在0xff到设置的数值CFR之间发生重载,也会复位,要想不复位需要在CFR和0x40之间重载。
(2)窗口看门狗还有一个重要的特性就是支持中断。

1.jpg
天天向上
回复

使用道具 举报

20

主题

55

回帖

20

积分

初级会员

积分
20
 楼主| 发表于 2012-12-23 18:02:06 | 显示全部楼层
*          ===================================================================
  *                                     WWDG features
  *          ===================================================================
  *                                       
  *          Once enabled the WWDG generates a system reset on expiry of a programmed
  *          time period, unless the program refreshes the counter (downcounter)
  *          before to reach 0x3F value (i.e. a reset is generated when the counter
  *          value rolls over from 0x40 to 0x3F).
  *          An MCU reset is also generated if the counter value is refreshed
  *          before the counter has reached the refresh window value. This
  *          implies that the counter must be refreshed in a limited window.
  *            
  *          Once enabled the WWDG cannot be disabled except by a system reset.                          
  *         
  *          WWDGRST flag in RCC_CSR register can be used to inform when a WWDG
  *          reset occurs.
  *            
  *          The WWDG counter input clock is derived from the APB clock divided
  *          by a programmable prescaler.
  *              
  *          WWDG counter clock = PCLK1 / Prescaler
  *          WWDG timeout = (WWDG counter clock) * (counter value)
  *                     
  *          Min-max timeout value @42 MHz(PCLK1): ~97.5 us / ~49.9 ms
天天向上
回复

使用道具 举报

20

主题

55

回帖

20

积分

初级会员

积分
20
 楼主| 发表于 2012-12-23 18:02:30 | 显示全部楼层
*          ===================================================================
  *                                 How to use this driver
  *          ===================================================================
  *          1. Enable WWDG clock using RCC_APB1PeriphClockCmd(RCC_APB1Periph_WWDG, ENABLE) function
  *            
  *          2. Configure the WWDG prescaler using WWDG_SetPrescaler() function
  *                           
  *          3. Configure the WWDG refresh window using WWDG_SetWindowValue() function
  *            
  *          4. Set the WWDG counter value and start it using WWDG_Enable() function.
  *             When the WWDG is enabled the counter value should be configured to
  *             a value greater than 0x40 to prevent generating an immediate reset.     
  *            
  *          5. Optionally you can enable the Early wakeup interrupt which is
  *             generated when the counter reach 0x40.
  *             Once enabled this interrupt cannot be disabled except by a system reset.
  *                 
  *          6. Then the application program must refresh the WWDG counter at regular
  *             intervals during normal operation to prevent an MCU reset, using
  *             WWDG_SetCounter() function. This operation must occur only when
  *             the counter value is lower than the refresh window value,
  *             programmed using WWDG_SetWindowValue().
天天向上
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-5-16 03:28 , Processed in 0.198556 second(s), 27 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表