×
单片机 > 单片机程序设计 > 详情

s3c6410硬件WATCHDOG TIMER看门狗定时器

发布时间:2020-06-20 发布时间:
|
  先简述看门狗的工作过程,看门狗实际是一个定时器,内部有个计数器,每当时钟信号到来时,计数器寄存器减一。如果减到0,则重新启动系统;如果在减到0之前,系统又设置计数器为一个较大的值,则系统不会重启。系统正常时,就不会重启;当系统发生故障时,不能设置计数寄存器,系统重新启动。

1、OVERVIEW  概述

The 6410 RISC microprocessor watchdog timer is used to resume the controller operation whenever it is disturbed by malfunctions such as noise and system errors. The watchdog timer generates the reset signal. It can beused as a normal 16-bit interval timer to request interrupt service.Advantage in using WDT instead of PWM timer is that WDT generates the reset signal.

当控制器操作被噪音或系统错误等故障打断时,S3C6410 RISC 微处理器的看门狗定时器恢复控制器的操作。它可以产生复位信号。它可以用于16位的间隔定时器来要求中断服务。。用WDT 代替PWM 定时器的优点是WDT 产生复位信号。

2、FEATURES  特性

The Watchdog Timer includes the following features:
• Normal interval timer mode with interrupt request.具有中断请求的正常间隔定时器模式。
• Internal reset signal is activated when the timer count value reaches 0 (time-out).

当定时器计数值达到0(超时),内部复位信号有效。
• Level-triggered Interrupt mechanism.电平触发器中断机制。

3、FUNCTIONAL DESCRIPTION 功能说明

3.1、WATCHDOG TIMER OPERATION 时钟控制


 


 

 

The watchdog timer uses only PCLK as its source clock. The prescaler value and the frequency division factor are specified in the watchdog timer control (WTCON) register. Valid prescaler values range from 0 to 28-1. The frequency division factor can be selected as 16, 32, 64,or 128.

Use the following equation to calculate the watchdog timer clock frequency and the duration of each timer clock cycle:

t_watchdog = 1/( PCLK / (Prescaler value + 1) / Division_factor )

看门狗定时器用PCLK为时钟源,通过一个8位预分频器,预分频系数有寄存器WTCON的(8~15)位决定。分频后的频率就相当于PCLK/(WTCON[8-15]+1)。然后,通过一个4项分频器,分频系数分别是16、32、64、128.通过WTCON[4-3]位控制。

控制寄存器的WTCON的第二位为1,则发出一个中断信号;第0位为1,则发出一个复位信号。

3.2、WTDAT & WTCNT

Once the watchdog timer is enabled, the value of watchdog timer data (WTDAT) register cannot be automatically reloaded into the timer counter (WTCNT). For this reason, an initial value must be written to the watchdog timer count (WTCNT) register, before the watchdog timer starts.

一旦看门狗定时器有效,看门狗定时器数据(WTDAT)寄存器的值将不能被自动重新载入定时器数(WTCNT)。在看门狗定时器开始前,一个初始值必须写入看门狗定时器计数(WTDAT)寄存器。

3.3、CONSIDERATION OF DEBUGGING ENVIRONMENT

When the 6410 is in debug mode using Embedded ICE, the watchdog timer must not operate.

当S3C6410在调试模式(使用嵌入的ICE)时,看门狗定时器不能进行操作。

4、寄存器:


 


 

(1)、WTCON 寄存器允许用户启动/禁止看门狗定时器,从四个不同的时钟源选择时钟信号,启动/禁止看门狗定时器输出。

(2)、WTDAT寄存器用于指定超时时间。当看门狗作为定时器使用时,当计数器WTCNT的值到0时,WTDAT寄存器的值会被自动装入WTCNT,并不会发出复位信号。

(3)、正常操作情况下,WTCNT 寄存器包含看门狗定时器的当前计数值。

(4)、WTCLRINT 寄存器用于清除中断。中断服务完成后,中断服务程序清除相关中断。

注:我的理解,其实看门狗定时器,包含两个功能,一个是看门狗,另一个是定时器。

当不用于系统复位,只用于定时器功能,这时它的WTDAT寄存器才是有用的。

当它作为看门狗使用时,WTDAT寄存器没意义,你想一下,当不能喂狗,系统复位时,以前设置的参数还有意义吗?所以只有用于定时器时,发生中断后,WTDAT寄存器的值自动装入WTCNT,开始下一轮的定时。 

s3c6410在linux下的WATCHDOG TIMER(看门狗定时器)驱动(1)的链接地址

关键字:s3c6410  硬件WATCHDOG  TIMER  看门狗定时器

『本文转载自网络,版权归原作者所有,如有侵权请联系删除』

热门文章 更多
8051单片机的函数发生器的设计