![](http://datasheet.mmic.net.cn/100000/IF180C52TXXX-20R_datasheet_3493957/IF180C52TXXX-20R_282.png)
282
32099I–01/2012
AT32UC3L016/32/64
To change the clock for the WDT the following steps need to be taken. Note that the WDT
should always be disabled before changing the CLK_CNT source:
1. Write a zero to the Clock Enable (CEN) bit in the CTRL Register, leaving the other bits as they
are in the CTRL Register. This will stop CLK_CNT.
2. Read back the CTRL Register until the CEN bit reads zero. The clock has now been stopped.
3. Modify the Clock Source Select (CSSEL) bit in the CTRL Register with your new clock selec-
tion and write it to the CTRL Register.
4. Write a one to the CEN bit, leaving the other bits as they are in the CTRL Register. This will
enable the clock.
5. Read back the CTRL Register until the CEN bit reads one. The clock has now been enabled.
15.5.1.3
Configuring the WDT
If the MODE bit in the CTRL Register is zero, the WDT is in basic mode. The Time Out Prescale
Select (PSEL) field in the CTRL Register selects the WDT timeout period:
T
timeout = Tpsel = 2
(PSEL+1) / f
clk_cnt
15.5.1.4
Enabling the WDT
To enable the WDT write a one to the Enable (EN) bit in the CTRL Register. Due to internal syn-
chronization, it will take some time for the CTRL.EN bit to read back as one.
15.5.1.5
Clearing the WDT Counter
The WDT counter is cleared by writing a one to the Watchdog Clear (WDTCLR) bit in the Clear
(CLR) Register, at any correct write to the CTRL Register, or when the counter reaches T
timeout
and the device is reset. In basic mode the CLR.WDTCLR can be written at any time when the
WDT Counter Cleared (CLEARED) bit in the Status Register (SR) is one. Due to internal syn-
chronization, clearing the WDT counter takes some time. The SR.CLEARED bit is cleared when
writing to CLR.WDTCLR bit and set when the clearing is done. Any write to the CLR.WDTCLR
bit while SR.CLEARED is zero will not clear the counter.
Writing to the CLR.WDTCLR bit has to be done in a particular sequence to be valid. The CLR
Register must be written twice, first with the KEY field set to 0x55 and WDTCLR set to one, then
a second write with the KEY set to 0xAA without changing the WDTCLR bit. Writing to the CLR
Register without the correct sequence has no effect.
If the WDT counter is periodically cleared within T
psel no watchdog reset will be issued, see Fig-