DCC Module¶
The dual clock comparator (DCC) API provides a set of functions for configuring and using the DCC module. The functions provided allow for setting up the module including the operating modes, configuring the clock sources, enabling interrupt signals, and reading the various clock counters.
-
group
dcc_api
Defines
-
DCC_VALIDSEED_MIN
4U¶
-
DCC_VALIDSEED_MAX
0xFFFFU¶
-
DCC_COUNTSEED_MIN
1U¶
-
DCC_COUNTSEED_MAX
0xFFFFFU¶
-
DCC_ENABLE_VALUE
(0xAU)¶
-
DCC_DISABLE_VALUE
(0x5U)¶
-
DCC_REG_WORD_MASK
(0xFFFFU)¶
-
DCC_REG_BYTE_MASK
(0x7FU)¶
-
DCC_SEED_REG_MASK
(0xFFF0U)¶
-
DCC_SEED_CNT_MASK
(0xF0000U)¶
Enums
-
enum
DCC_SingleShotMode
¶ The following are defines for the mode parameter of the DCC_enableSingleShotMode() function.
Values:
-
enumerator
DCC_MODE_COUNTER_ZERO
= 0xA00U¶ Use to stop counting when counter0 and valid0 both reach zero.
-
enumerator
DCC_MODE_COUNTER_ONE
= 0xB00U¶ Use to stop counting when counter1 reaches zero.
-
enumerator
-
enum
DCC_Count1ClockSource
¶ The following are defines for the source parameter of the DCC_setCounter1ClkSource() function.
Values:
-
enumerator
DCC_COUNT1SRC_PLL
= 0x0U¶ PLL021SSP Clock Out Source.
-
enumerator
DCC_COUNT1SRC_INTOSC1
= 0x2U¶ Internal Oscillator1 Clock Source.
-
enumerator
DCC_COUNT1SRC_INTOSC2
= 0x3U¶ Internal Oscillator2 Clock Source.
-
enumerator
DCC_COUNT1SRC_SYSCLK
= 0x6U¶ System Clock Source.
-
enumerator
DCC_COUNT1SRC_AUXCLKIN
= 0xAU¶ AUX Clock input Source.
-
enumerator
DCC_COUNT1SRC_EPWM
= 0xBU¶ EPWM Clock Source.
-
enumerator
DCC_COUNT1SRC_ADCCLK
= 0xDU¶ ADC Clock Source.
-
enumerator
DCC_COUNT1SRC_WDCLK
= 0xEU¶ Watch Dog Clock Source.
-
enumerator
DCC_COUNT1SRC_CANX
= 0xFU¶ CANxBIT Clock Source.
-
enumerator
DCC_COUNT1SRC_SYSAPLL_CLK_AUX
= 0x16U¶ System APLL Aux Clk.
-
enumerator
-
enum
DCC_Count0ClockSource
¶ The following are defines for the source parameter of the DCC_setCounter0ClkSource() function.
Values:
-
enumerator
DCC_COUNT0SRC_XTAL
= 0x0U¶ Accurate Clock Source.
-
enumerator
DCC_COUNT0SRC_INTOSC1
= 0x1U¶ Internal Oscillator1 Clock Source.
-
enumerator
DCC_COUNT0SRC_INTOSC2
= 0x2U¶ Internal Oscillator2 Clock Source.
-
enumerator
DCC_COUNT0SRC_TCK
= 0x4U¶ Preliminary Clock Source.
-
enumerator
DCC_COUNT0SRC_SYSCLK
= 0x5U¶ System Clock Source.
-
enumerator
DCC_COUNT0SRC_AUXCLK
= 0x8U¶ AUX Clock Source.
-
enumerator
Functions
-
void
DCC_enableModule
(uint32_t base)¶ Enables the DCC module.
This function starts the DCC counter operation.
- Parameters
base
: is the DCC module base address
- Return
None.
-
void
DCC_disableModule
(uint32_t base)¶ Disable the DCC module.
This function stops the DCC counter operation.
- Parameters
base
: is the DCC module base address
- Return
None.
-
void
DCC_enableErrorSignal
(uint32_t base)¶ Enable DCC Error Signal
This function enables the error signal interrupt.
- Parameters
base
: is the DCC module base address
- Return
None.
-
void
DCC_enableDoneSignal
(uint32_t base)¶ Enable DCC Done Signal
This function enables the done signal interrupt.
- Parameters
base
: is the DCC module base address
- Return
None.
-
void
DCC_disableErrorSignal
(uint32_t base)¶ Disable DCC Error Signal
This function disables the error signal interrupt.
- Parameters
base
: is the DCC module base address
- Return
None.
-
void
DCC_disableDoneSignal
(uint32_t base)¶ Disable DCC Done Signal
This function disables the done signal interrupt.
- Parameters
base
: is the DCC module base address
- Return
None.
-
void
DCC_enableSingleShotMode
(uint32_t base, DCC_SingleShotMode mode)¶ Enable DCC Single-Shot Mode
This function enables the single-shot mode and sets the operation mode.
- Parameters
base
: is the DCC module base addressmode
: is the selected Single-Shot operation mode
The mode parameter can have one of two values:
DCC_MODE_COUNTER_ZERO - Stops counting when counter0 and valid0 both reach zero
DCC_MODE_COUNTER_ONE - Stops counting when counter1 reaches zero
- Return
None.
-
void
DCC_disableSingleShotMode
(uint32_t base)¶ Disable DCC Single-Shot Mode
This function disables the DCC Single-Shot operation mode
- Parameters
base
: is the DCC module base address
- Return
None.
-
bool
DCC_getErrorStatus
(uint32_t base)¶ Get Error Flag Status
This function gets the error flag status.
- Parameters
base
: is the DCC module base address
- Return
Returns true if an error has occurred, false if no errors have occurred.
-
bool
DCC_getSingleShotStatus
(uint32_t base)¶ Get Single-Shot Done Flag Status
This function gets the single-shot done flag status.
- Parameters
base
: is the DCC module base address
- Return
Returns true if single-shot mode has completed, false if single-shot mode has not completed.
-
void
DCC_clearErrorFlag
(uint32_t base)¶ Clear Error Status Flag
This function clears the DCC error status flag.
- Parameters
base
: is the DCC module base address
- Return
None.
-
void
DCC_clearDoneFlag
(uint32_t base)¶ Clear Single-Shot Done Status Flag
This function clears the DCC single-shot done status flag.
- Parameters
base
: is the DCC module base address
- Return
None.
-
uint32_t
DCC_getCounter0Value
(uint32_t base)¶ Get Current Value of Counter 0
This function gets current value of counter 0.
- Parameters
base
: is the DCC module base address
- Note
Reads of the counter value may not be exact since the read operation is synchronized to the vbus clock.
- Return
Returns the current value of counter 0.
-
uint16_t
DCC_getValidCounter0Value
(uint32_t base)¶ Get Current Value of the Valid Duration Counter for Counter 0
This function gets current value of the valid duration counter for counter 0.
- Parameters
base
: is the DCC module base address
- Note
Reads of the counter value may not be exact since the read operation is synchronized to the vbus clock.
- Return
Returns the current value of the valid duration counter.
-
uint32_t
DCC_getCounter1Value
(uint32_t base)¶ Get Current Value of Counter 1
This function gets current value of counter 1.
- Parameters
base
: is the DCC module base address
- Note
Reads of the counter value may not be exact since the read operation is synchronized to the vbus clock.
- Return
Returns the current value of counter 1.
-
void
DCC_setCounter1ClkSource
(uint32_t base, DCC_Count1ClockSource source)¶ Set Counter 1 Clock Source
This function sets the counter 1 clock source.
- Parameters
base
: is the DCC module base addresssource
: is the selected clock source for counter 1
The source parameter can have one of following values:
DCC_COUNT1SRC_PLL - PLL021SSP Clock Out Source
DCC_COUNT1SRC_INTOSC1 - Internal Oscillator1 Clock Source
DCC_COUNT1SRC_INTOSC2 - Internal Oscillator2 Clock Source
DCC_COUNT1SRC_SYSCLK - System Clock Source
DCC_COUNT1SRC_AUXCLKIN - AUX Clock input Source
DCC_COUNT1SRC_EPWM - EPWM Clock Source
DCC_COUNT1SRC_ADCCLK - ADC Clock Source
DCC_COUNT1SRC_WDCLK - Watch Dog Clock Source
DCC_COUNT1SRC_CANX - CANxBIT Clock Source
DCC_COUNT1SRC_SYSAPLL_CLK_AUX - System APLL Aux Clk
- Return
None.
-
void
DCC_setCounter0ClkSource
(uint32_t base, DCC_Count0ClockSource source)¶ Set Counter 0 Clock Source
This function sets the counter 0 clock source.
- Parameters
base
: is the DCC module base addresssource
: is the selected clock source for counter 0
The source parameter can have one of following values:
DCC_COUNT0SRC_XTAL - Accurate Clock Source
DCC_COUNT0SRC_INTOSC1 - Internal Oscillator1 Clock Source
DCC_COUNT0SRC_INTOSC2 - Internal Oscillator2 Clock Source
DCC_COUNT0SRC_TCK - Preliminary Clock Source
DCC_COUNT0SRC_SYSCLK - System Clock Source
DCC_COUNT0SRC_AUXCLK - AUX Clock Source
- Return
None.
-
uint16_t
DCC_getCounter1ClkSource
(uint32_t base)¶ Get Counter 1 Clock Source
This function gets the counter 1 clock source.
- Parameters
base
: is the DCC module base address
- Return
Returns one of the following enumerated source values:
DCC_COUNT1SRC_PLL - PLL021SSP Clock Out Source
DCC_COUNT1SRC_INTOSC1 - Internal Oscillator1 Clock Source
DCC_COUNT1SRC_INTOSC2 - Internal Oscillator2 Clock Source
DCC_COUNT1SRC_SYSCLK - System Clock Source
DCC_COUNT1SRC_AUXCLKIN - AUX Clock input Source
DCC_COUNT1SRC_EPWM - EPWM Clock Source
DCC_COUNT1SRC_ADCCLK - ADC Clock Source
DCC_COUNT1SRC_WDCLK - Watch Dog Clock Source
DCC_COUNT1SRC_CANX - CANxBIT Clock Source
DCC_COUNT1SRC_SYSAPLL_CLK_AUX - System APLL Aux Clk
-
uint16_t
DCC_getCounter0ClkSource
(uint32_t base)¶ Get Counter 0 Clock Source
This function gets the counter 0 clock source.
- Parameters
base
: is the DCC module base address
- Return
Returns one of the following enumerated source values:
DCC_COUNT0SRC_XTAL - Accurate Clock Source
DCC_COUNT0SRC_INTOSC1 - Internal Oscillator1 Clock Source
DCC_COUNT0SRC_INTOSC2 - Internal Oscillator2 Clock Source
DCC_COUNT0SRC_TCK - Preliminary Clock Source
DCC_COUNT0SRC_SYSCLK - System Clock Source
DCC_COUNT0SRC_AUXCLK - AUX Clock Source
-
void
DCC_setCounterSeeds
(uint32_t base, uint32_t counter0, uint32_t validCounter0, uint32_t counter1)¶ Set the seed values
This function sets the seed values for Counter 0, Valid Duration Counter 0, and Counter 1.
- Parameters
base
: is the DCC module base addresscounter0
: sets the seed value that gets loaded into Counter 0validCounter0
: sets the seed value that gets loaded into the valid duration counter for Counter 0counter1
: sets the seed value that gets loaded into Counter 1
- Note
Operating DCC with ‘0’ set as the seed value for Counter 0, Valid Duration Counter 0, and/or Counter 1 will result in undefined operation.
The Valid Duration Counter 0 is designed to be at least four cycles wide and shouldn’t be programmed with a value less than ‘4’.
- Return
None.
-
bool
DCC_verifyClockFrequency
(uint32_t base, DCC_Count1ClockSource clock1, float32_t freq1, DCC_Count0ClockSource clock0, float32_t freq0, float32_t tolerance, float32_t freqerr, float32_t freq_sysclk)¶ Verify the frequency of a clock source using a reference clock
This function verifies the frequency of the specified clock using a reference clock.
- Parameters
base
: is the DCC module base addressclock1
: is the clock source to be verifiedfreq1
: is the frequency of the clock source to be verifiedclock0
: is the reference clockfreq0
: is the frequency of the reference clocktolerance
: is the DCC error tolerance in percentagefreqerr
: is the allowable Frequency Tolerance in percentagefreq_sysclk
: is the frequency of the system clock
- Note
Make sure that the frequency of all the clocks are in the same unit
- Return
Returns true if the actual frequency of clock1 is matching freq1, false otherwise
-
float32_t
DCC_measureClockFrequency
(uint32_t base, DCC_Count1ClockSource clock1, DCC_Count0ClockSource clock0, float32_t freq0, float32_t tolerance, float32_t freqerr, float32_t freq_sysclk)¶ Measure the frequency of a clock source using a reference clock
This function measures the frequency of the specified clock using a reference clock.
- Parameters
base
: is the DCC module base addressclock1
: is the clock source to be measuredclock0
: is the reference clockfreq0
: is the frequency of the reference clocktolerance
: is the DCC error tolerance in percentagefreqerr
: is the allowable Frequency Tolerance in percentagefreq_sysclk
: is the frequency of the system clock
- Note
Make sure that the frequency of all the clocks are in the same unit
- Return
Measured clock frequency
-
void
DCC_continuousMonitor
(uint32_t base, DCC_Count1ClockSource clock1, float32_t freq1, DCC_Count0ClockSource clock0, float32_t freq0, float32_t tolerance, float32_t freqerr, float32_t freq_sysclk)¶ Continuously monitor the frequency of a clock source using a reference clock
This function continuously monitors the frequency of the specified clock using a reference clock. An error signal is generated if the frequency ratio is altered.
- Parameters
base
: is the DCC module base addressclock1
: is the clock source to be verifiedfreq1
: is the frequency of the clock source to be verifiedclock0
: is the reference clockfreq0
: is the frequency of the reference clocktolerance
: is the DCC error tolerance in percentagefreqerr
: is the allowable Frequency Tolerance in percentagefreq_sysclk
: is the frequency of the system clock
- Note
Make sure that the frequency of all the clocks are in the same unit
- Note
This function does not enable the DCC interrupt. The user application must enable it to trigger an intetrupt when an error is detected.
- Return
Returns None
-
The code for this module is contained in driverlib/dcc.c, with driverlib/dcc.h contcaining the API declarations for use by applications.