Working principle of DCC module, practical application and precautions of DCC module
Source: InternetPublisher:风向西瓜 Keywords: Frequency DCC Updated: 2025/01/16
In the MCU system, the accuracy and precision of the system clock are very important for the safe operation of the system. To ensure that the system can monitor the accuracy of the clock, starting from the F28004X series, C2000 products have added a new functional module Dual-Clock Comparator, referred to as DCC. DCC is a configurable, dual-clock comparison module used to determine the accuracy of the clock signal during the time execution of the application. DCC uses another input clock as a reference to measure the frequency of the optional clock source. The clock source and accuracy are programmed by the application. It can provide autonomous and real-time monitoring of the clock input frequency of the clock signal. When the input clock frequency range exceeds the set value, the DCC module will trigger an error, thereby completing the monitoring of the input clock frequency. Taking F280049 as an example, this article introduces the working principle and practical application of the DCC module and the corresponding precautions.
1. Introduction to DCC working principle and configuration method:
As the name implies, the DCC module provides two clock modules, clock0 and clock1, which can be checked against each other according to the set ratio and allowable error range. Users can freely select the input sources of the two clocks, as shown in the figure below, and also need to set the maximum allowable error.
The clock sources of Counter1 are:
PLLRAWCLK
INTOSC1
INTOSC2
The clock sources of Counter0 are:
XTAL
INTOSC1
INTOSC2
Note: F280049 is a Type 1 DCC, F28002x, F28003x, F280013x, F280015x, F2838x are all Type 2 DCC, clock0 and clock1 have more input sources, for details, please refer to the datasheet of the corresponding product.
In the DCC setting process, in addition to the two clocks selected to be detected, there are two important parameters: tolerance and frequency error.
1. Tolerance: Tolerance represents the granularity of the DCC module. The larger the Tolerance, the smaller the counter of Clock0 and Clock1, similar to the smaller sampling bit of ADC. However, when the frequency is abnormal, it can also react faster. We usually set this value to 1%.
2. Frequency error: The acceptability of clock error. Since the asynchrony and quantization of the two clocks will introduce errors, there is a minimum error. At the same time, a certain degree of clock deviation is also acceptable. It can be input according to the system requirements. The time deviation of +/- total error is acceptable.
According to the system requirements, Tolerance and frequency error are given. The calculation method can be seen in the library function:
count0 = window - total_error;
valid = 2 * total_error;
count1 = window * freq1 / freq0;
After configuration, once DCC is enabled, counter0 and Valid0 will be decremented by 1 at each clock0 signal. Similarly, counter1 will be decremented by 1 at each clock1 signal.
We first assume that clock0 is a reliable clock. When the accuracy of clock1 is within the maximum allowable error, the three counters should reach 0 in the following order:
Counter0 -> Counter1 -> Valid0
If the error of clock1 is too large, there are two possibilities of failure:
One is that clock1 is faster, then counter1 of clock1 will reach 0 first.
One is that clock1 is slow, then after clock0 and valid0 have reached 0, counter1 has not yet reached 0.
2. Practical application:
In actual applications, we can use Clock0 to monitor the accuracy of Clock1, or use clock1 to monitor the loss of Clock0 (set Clock0 to XTAL) (because Clock1 input can only select the internal clock). The calculation of the DCC value is relatively complicated. You can use the driverlib function DCC_continuousMonitor() provided by TI to complete the calculation, or you can refer to the routines in C2000Ware to quickly implement the function. The path of the DCC related routines is as follows: C: tic2000C2000Ware_4_03_00_00driverlibf28004xexamplesdcc
It should be noted that:
The DCC can also be configured to run in one-shot or continuous mode. In one-shot mode, the DCC performs a one-time countdown and stops when the counter reaches 0. A completion interrupt is raised and the status can be checked.
In continuous mode, because it is necessary to lock the moment when the error occurs (i.e. the value of counter0 or counter1), the counter will stop working after the DCC module reports an error. You may encounter a situation where you can only enter the DCC interrupt once. If the customer wants to enter the DCC interrupt multiple times, you need to re-enable the DCC module in the DCC interrupt, which can be achieved by calling this function: DCC_enableModule (DCC0_BASE).
3. Summary:
The DCC module can be used to easily and quickly realize autonomous, real-time monitoring of the input frequencies of two clock signals. By comparing the two clock counters, reliable monitoring of the clock system can be achieved, thereby ensuring the safe and reliable operation of the entire system.
- Application circuit of CSJ-R05B and single chip microcomputer
- Interface circuit composed of 74LS164 and 8051 microcontroller
- Interface circuit between 51 single chip microcomputer and MAX7219
- Interface circuit between MMA1220D and microcontroller
- How to make a super solar tracker using ESP8266
- Improvement of microcontroller-driven piezoelectric buzzer
- Use PC’s RS232 port to control LED lights
- Circuit diagram: AT88RF
- usb to 232 circuit
- Communication conversion circuit diagram of RS232 and RS485