TC1796
System Units (Vol. 1 of 2)
Watchdog Timer
User’s Manual
16-10
V2.0, 2007-07
WDT, V2.0
16.4.3
Password Access to WDT_CON0
A correct password must be written to register WDT_CON0 in order to unlock it for
modifications. Software must either know the correct password in advance, or it can
compute it at runtime. The password required to unlock the register is formed by a
combination of bits in registers WDT_CON0 and WDT_CON1, plus a number of guard
bits.
summarizes the requirements for the password.
When reading register WDT_CON0, bit positions [7:4] always return 0s. As can be seen
from
, the password is designed such that it is not possible to just read the
contents of a register and use this as the password. The password is never identical to
the contents of WDT_CON0 or WDT_CON1, it is always required to modify the read
value (at least bits 1 and [7:4]) to get the correct password. This prevents a malfunction
from accidentally reading a WDT register’s contents and writing it to WDT_CON0 as an
unlocking password.
If the password matches the requirements, WDT_CON0 will be unlocked as soon as the
Password Access has finished. The unlocked condition will be indicated by
WDT_CON0.WDTLCK = 0.
If WDT_CON0 is successfully unlocked, a subsequent write access can modify it, as
described on
If an improper password value is written to WDT_CON0 during the Password Access, a
Watchdog Access Error condition exists. Bit WDTAE is set and the Prewarning Mode is
entered.
The user-definable password, WDTPW, provides additional options for adjusting the
password requirements to the application’s needs. It can be used, for instance, to detect
unexpected software loops, or to monitor the execution sequence of routines. See
Table 16-2
Password Access Bit Pattern Requirements
Bit Position Required Value
0
Current state of the ENDINIT bit, WDT_CON0.ENDINIT
1
Fixed; must be written with 0
2
Current state of the input frequency request bit, WDT_CON1.WDTIR
3
Current state of the input frequency request bit, WDT_CON1.WDTDR
[7:4]
Fixed; must be written to 1111
B
[15:8]
Current value of user-definable password field, WDT_CON0.WDTPW
[31:16]
Current value of user-definable reload value, WDT_CON0.WDTREL