The DCC module can be programmed to
count down one time by enabling the single-shot mode. In this mode, the DCC stops
operating when the down counter0 and the valid counter0 reach 0.
At the end of one sequence of counting
down in this single-shot mode, the DCC gets disabled automatically, which prevents
further counting. This mode is typically used for spot-checking the frequency of a
signal.
Example-1: Validating PLLRAWCLK
frequency
A practical example of the usage is to
validate the PLL output clock frequency using the XTAL as the reference clock.
Assume XTAL is 10MHz, PLL output frequency is 100MHz, SYSCLK is 100MHz, allowable
Frequency Tolerance is 0.1%, and DCC Tolerance required is 0.1%. The measurement
sequence proceeds as follows:
- Set Clock0 source for Counter0
and Valid0 as XTAL, and Clock1 source for Counter1 as PLL output clock.
- Based on the equations defined in
Section 10.2.1, calculated seed values for Counters can be Counter0 = 29940; Valid0 = 120;
Counter1 = 300000
- Once the DCC is enabled, the
counters Counter0 and Counter1 both start counting down from the seed
values.
- When Counter0 reaches zero,
Counter0 automatically triggers the Valid0 counter.
- When Valid0 reaches zero and
Counter1 is not zero, an ERROR status flag is set and a "DCC error" is sent to
the PIE. Counter1 is frozen so that the counter stops counting down any further.
The application can enable an interrupt to be generated from the PIE whenever
this DCC error is indicated. Refer to the PIE Channel Mapping table in the System Control and
Interrupts chapter to determine the channel mapping of the DCC
Interrupt.
- The application then needs to
clear the ERROR status flag and restart the DCC module so that the module is
ready for the next spot measurement.
If there is no error generated at the
end of the sequence, then the DONE status flag is set and a DONE interrupt is
generated. The application must clear the DONE flag before restarting the DCC.
Error Conditions:
An error condition is generated by any
one of the following:
- Counter1 counts down to 0 before
Counter0 reaches 0. This means that Clock1 is faster than expected, or Clock0 is
slower than expected. This error includes the case when Clock0 is stuck at 1 or
0.
- Counter1 does not reach 0 even
when Counter0 and Valid0 have both reached 0. This means that Clock1 is slower
than expected. This error includes the case when Clock1 is stuck at 1 or 0.
Any error freezes the counters from
counting. An application can then read out the counter values to help determine what
caused the error.
Example-2: Measuring AUXCLKIN frequency
Another example of
single-shot mode is to measure the frequency of AUXCLKIN (unknown frequency) using
INTOSC1 (10MHz) as the reference clock and SYSCLK is 10MHz. The measurement sequence
proceeds as follows:
- Set Clock0 source for
Counter0 and Valid0 as INTOSC1 (10MHz), and Clock1 source for Counter1 as
AUXCLKIN.
- Now configure counter values
using equations in Section 10.2.1. For tolerance = ±0.1%, Total Error = 10 clock0 cycles;
Window = 10000 clock0 cycles; Counter0 = 9990; Valid0 = 20. Since Clock1
frequency (Fclk1) is unknown, the Counter1 value can be set to the maximum
value, 1048575 (0xFFFFF).
- Once the DCC is enabled, the
counters Counter0 and Counter1 both start counting down from the seed
values.
- Since Counter1 is set to the
maximum value, 1048575, the counter does not expire when Counter0 and Valid0
have expired. This generates an error that is expected and the application
ignores this error and uses Counter1 values to compute the frequency of
Clock1 (Fclk1).
- Knowing the frequency of
Clock0 (INTOSC1), Fclk0 = 10MHz, and using Equation 1, the frequency of AUXCLKIN, Fclk1, can be measured:
Equation 1.