
How to use the
Watchdog Timer of the TriCore
7 of 17
AP3219 Rel.02
Due to the requirements for some of the password bits, the password can never be
determined just by reading the contents of the Watchdog registers. A modifying step that
alters some of the bits is required in order to get the right password.
This password has to be written to the address location of WDTCON0 in order to unlock
this register for modifications. If the password matches the requirements, register
WDTCON0 is unlocked after this write operation has finished. This unlocked condition is
indicated by WDTCON0.WDTLCK=0.
Now, the following write access can modify register WDTCON0. After this write has
finished, WDTCON0 is automatically locked again. WDTLCK is set to 1 by hardware.
If the password value written to WDTCON0 during the password access does not match
the contents of WDTCON0, a Watchdog access error situation exists. The Watchdog error
situations are detailed in the section entitled “Watchdog Error Conditions" further below.
The following program in C-Code is an example how to unlock the register WDTCON0. It
can be included as a procedure in the mainfunction:
//Password Access to unlock WDTCON0 include this in your project
void WDT_Passwd(void)
{
#define
WDTCON0 *((volatile unsigned int*) 0xF0000020)
#define
WDTCON1 *((volatile unsigned int*) 0xF0000024)
unsigned int passwd;
passwd = WDTCON0;
passwd = passwd | 0x0f0;
passwd = (WDTCON1 & 0x00c)
//bit 2:3 from WDTCON1
| (passwd & 0xfffffff3);
//and bit 2:3 cleared from WDTCON0
passwd = (passwd ^ 0x00000002);
//invert bit 1
WDTCON0 = passwd;
//write password to WDTCON0
//load value from WDTCON0
//sets bit 7:4 to 1
}
//Procedure call
WDT_Passwd();
After this password sequence the WDTCON0 will be unlocked and you can change it by a
modify access.
3.2
During the modifying access, the only strict requirement is that bits 1 and 7:4 are written to
1’s, and bits 3:2 are written to 0’s. All other bits can be set to user-definable values.
If the value written to WDTCON0 during the modifying access does not match these
requirements, a Watchdog access error exists. The Watchdog error situations are detailed
in the section entitled “Watchdog Error Conditions" further below.
Modify Access