English
Language : 

PXS20RM Datasheet, PDF (1310/1368 Pages) Freescale Semiconductor, Inc – PXS20 Microcontroller
Software Watchdog Timer (SWT)
When enabled, the SWT requires periodic execution of a servicing operation which consists of writing two
values to the SWT_SR. Writing the proper sequence of values loads the internal down counter with the
time-out period. There is no timing requirement between the two writes and the service sequence logic
ignores unlock sequence writes. If the SWT_CR[KEY] bit is zero, the fixed sequence 0xA602, 0xB480 is
written to the SWT_SR[WSC] field to service the watchdog. If the SWT_CR[KEY] bit is set, then two
pseudorandom keys are written to the SWT_SR[WSC] field to service the watchdog. The key values are
determined by the pseudorandom key generator defined in Figure 45-8. This algorithm will generate a
sequence of 216 different key values before repeating. The state of the key generator is held in the
SWT_SK register. For example, if SWT_SK[SK] is 0x0100 then the service sequence keys are 0x1103,
0x2136. In this mode, each time a valid key is written to the SWT_SR register, the SWT_SK register is
updated. So, after servicing the watchdog by writing 0x1103 and then 0x2136 to the SWT_SR[WSC] field,
SWT_SK[SK] is 0x2136 and the next key sequence is 0x3499, 0x7E2C.
SKn+1 = (17*SKn+3) mod 216
Figure 45-8. Pseudorandom Key Generator
Accesses to SWT registers occur with no peripheral bus wait states. (The peripheral bus bridge may add
one or more system wait states.) However, due to synchronization logic in the SWT design, recognition of
the service sequence or configuration changes may require up to three system plus seven counter clock
cycles.
If window mode is enabled (SWT_CR[WND] bit is set), the service sequence must be performed in the
last part of the time-out period defined by the window register. The window is open when the down counter
is less than the value in the SWT_WN register. Outside of this window, service sequence writes are invalid
accesses and generate a bus error or reset depending on the value of the SWT_CR[RIA] bit. For example,
if the SWT_TO register is set to 5000 and SWT_WN register is set to 1000 then the service sequence must
be performed in the last 20% of the time-out period. There is a short lag in the time it takes for the window
to open due to synchronization logic in the watchdog design. This delay could be up to three system plus
four counter clock cycles.
The interrupt then reset bit (SWT_CR[ITR]) controls the action taken when a time-out occurs. If the
SWT_CR[ITR] bit is not set, a reset is generated immediately on a time-out. If the SWT_CR[ITR] bit is
set, an initial time-out causes the SWT to generate an interrupt and load the down counter with the time-out
period. If the service sequence is not written before the second consecutive time-out, the SWT generates
a system reset. The interrupt is indicated by the time-out interrupt flag (SWT_IR[TIF]). The interrupt
request is cleared by writing a one to the SWT_IR[TIF] bit.
The SWT_CO register shows the value of the down counter when the watchdog is disabled. When the
watchdog is enabled this register is cleared. The value shown in this register can lag behind the value in
the internal counter for up to six system plus eight counter clock cycles.
The SWT_CO can be used during a software self test of the SWT. For example, the SWT can be enabled
and not serviced for a fixed period of time less than the time-out value. Then the SWT can be disabled
(SWT_CR[WEN] cleared) and the value of the SWT_CO read to determine if the internal down counter
is working properly.
45-8
PXS20 Microcontroller Reference Manual, Rev. 1
Freescale Semiconductor