0

我不太了解看门狗定时器在嵌入式环境中的工作原理,而且我面临与看门狗定时器相关的问题

在其中一个宏中定义的最大超时值为 55,当我们尝试从 watchdog_set_period 函数设置此值时,我们的电路板正在重新启动

#define Max_time_out 55

watchdog_set_period(int period) // 设置看门狗超时计数器

其中期间 = 55

现在是预期的还是重启的原因是什么

我们正在将此周期值写入通过文件描述符访问的某个驱动程序。

4

2 回答 2

1

链接在看门狗计时器上说明了此描述。

A watchdog timer is a piece of hardware that can be used to automatically detect software anomalies and reset the processor if any occur. Generally speaking, a watchdog timer is based on a counter that counts down from some initial value to zero. The embedded software selects the counter's initial value and periodically restarts it. If the counter ever reaches zero before the software restarts it, the software is presumed to be malfunctioning and the processor's reset signal is asserted. The processor (and the embedded software it's running) will be restarted as if a human operator had cycled the power.

您还没有发布代码,所以我们无法判断究竟是什么问题。如果您编写了代码,请检查您的代码是否导致任何导致看门狗计时器重置的问题。

于 2013-08-23T10:28:01.033 回答
1

看门狗定时器是一种特殊的定时器,通常出现在嵌入式系统上,用于检测正在运行的软件/固件何时挂起某些任务。看门狗定时器基本上是一个倒数定时器,它从某个初始值倒数到零。当达到零时,看门狗定时器了解系统已挂起并将其重置。

因此,正在运行的软件必须定期用新值更新看门狗定时器(在无限循环中),以防止其达到零并导致复位。当正在运行的软件被锁定执行某项任务并且无法更新(刷新失败)看门狗定时器时,定时器最终将归零并发生重置/重启。

所以总而言之,如果你启用看门狗定时器,那么你需要定期刷新看门狗定时器。否则,当看门狗定时器到期时,电路板会重新启动。

于 2013-08-23T10:28:23.587 回答