1. Registers of Watch dog Timer:
1. WDMOD (Watchdog Mode Register)
It is an 8-bit read-write register
It is used to control the operation of the
watchdog.
Bit 0 – WDEN (Watchdog Interrupt Enable)
Bit 1 – WDRESET (Watchdog Reset Enable)
Bit 2 – WDTOF (Watchdog Time-Out Flag)
This bit is set when the watchdog times out.It is
cleared by software.
Bit 3 – WDINT (Watchdog Interrupt Flag)
This bit is set when the watchdog times out. This
bit is cleared when any reset occurs.It is a read
only bit.
2. WDTV (Watchdog Timer Value Register)
It is a 32-bit read only register.
It is used to read the current value of watchdog
timer.
3. WDFEED (Watchdog Feed Register)
It is an 8-bit write only register.
Writing a 0xAA followed by 0x55 to this register
will reload the watchdog timer with the WDTC
value..
uilt watchdog timer of LPC2148:
he watchdog consists of a fixed divide by 4 prescalar
d a 32-bit counter. The clock is fed to the timer
rough the prescalar.
he counter can be loaded with any value between 0xFF
d 0xFFFFFFFF. If the counter is loaded with any value
ss than 0xFF, the counter is initialized with a value
FF.
he watchdog needs to be fed with a pre-determined
quence of 0xAA followed by 0x55 before watchdog
mer underflows to prevent reset/interrupt.
tures of WatchDog Timer:
chdog Timer (WDT) can be helpful to
matically reset the system whenever a
out occurs.
em reset is required for preventing failure of
ystem in a situation of a hardware fault or
ram error.
e are countless applications where the system
ot afford to get stuck at a point (not even for
all duration of time). For example, in a radar
m, if the system hangs for 5 minutes, it can
t in serious repercussions (an enemy plane or
ile may go undetected resulting in huge
es).
system should be robust enough to
matically detect the failures quickly and reset
in order to recover from the failures and
tion normally without errors.
t is not always feasible to manually reset the
m, especially once it has been deployed.
vercome such problems, a watchdog timer is
ssary to automatically reset the system
out human intervention.
Applications Of Watchdog Timer:
An application in mobile phone is that display is off in case no GUI interaction takes place within a
watched time interval. This will save good amount of battery power.
• An application in temperature controller is that if controller takes no action to switch off the
current within preset watched time interval, the current is switched off and warning signal is
raised as indication of controller failure. Failure to switch off current may burst a boiler in which
water is heated.
• If Software hangs due to some bug/issue, it helps to reset the system automatically without any
human interactions.
4. WDTC (Watchdog Timer Constant
Register)
It is a 32-bit read-write register.
Every time a sequence feed occurs, the
WDTC content is loaded into the
watchdog timer.
The 8 least significant bits (bits 7:0) of this
register are set to 1 on reset.
Any value below 0xFF will cause 0xFF to
be loaded in this register. Hence, the
minimum timeout interval is (TPCLK * 256
* 4).
How to use the Watchdog in
LPC2148?
• Set the watchdog timer constant
reload value in the WDTC register
• Select the mode using the
WDMOD register
• Start the watchdog by feeding it
with 0xAA followed by 0x55 in
WDFEED register
• Make sure to feed the watchdog
again before the timer counter
underflows in order to prevent
reset/interrupt
• WDTOF can be monitored to
determine if the watchdog has
caused reset condition. The
WDTOF flag must be cleared using
software.
Prepared By-
TETB310-Shubham Patil.
TETB132-Srishti Kakade.