TC1796
System Units (Vol. 1 of 2)
Clock System and Control
User’s Manual
3-19
V2.0, 2007-07
Clock, V2.0
After this procedure, the device is operating on the PLL target frequency. The note in
is also valid for this procedure.
3.2.2.6
Lock Detection
The PLL has the capability to detect a failure of its input clock
f
P
and to bring the TC1796
into a safe state in such a case. This clock failure detection is done by the PLL lock
detection unit. This unit indicates whether the PLL has reached its target frequency
properly or not.
The lock detection unit operates as follows:
Two counters, A and B, count the clock pulses of the N-divider clock output
f
N
and the
PLL reference clock
f
P
. When the counter values differ by more than 2 during counting,
the counters are reset (meaning PLL is still unlocked). When the counter values reach
the end of a counting session (224 clock pulses) with a counting difference which is 2 or
less than 2, the PLL is locked (PLL_CLC.LOCK = 1).
When the PLL is locked, the two counters proceed to count clock pulses. After every
fourth clock pulse, the counter values are checked, and when the counter values differ
by more than 2, the unlocked state is entered (fast unlock check). If no unlock condition
is detected (counter difference less than or equal 2), the counters are further
incremented up to a maximum counter value of 232 clock pulses. After 232 clock pulses
with no unlock condition of the counter values, the two counters are reset (slow unlock
check).
The PLL may become unlocked, caused by a break of the crystal or the external clock
line. In such a case, an NMI trap is generated by setting the NMISR.PLLNMI flag.
Additionally, the PLL clock input
f
P
is disconnected from the PLL to avoid unstable
operation due to noise or sporadic clock pulses coming from the oscillator circuit. Without
a clock input
f
P
, the PLL gradually slows down to its VCO base frequency and remains
there. The TC1796 remains in this state until the next power-on reset through pin
PORST, after that the PLL tries to restart and lock to the external clock again. No other
reset cause can terminate this loss-of-clock state. This is done to avoid unstable
operation due to the PLL trying to lock again. The TC1796 remains in the PLL unlocked
state until the next power-on reset or a successful lock recovery occurs.
Note that the PLL unlock state can also be entered when the oscillator disconnect bit
PLL_CLC.DISC becomes set by software.
3.2.2.7
Loss-of-Lock Recovery
If PLL has lost the lock condition, user software can try to re-lock the PLL again by
executing the following sequence:
1. Restart the oscillator run detection by setting bit OSC_CON.ORDRES
2. Wait until OSCR is set