AM261x MCU+ SDK: DCC

| AM261x MCU+ SDK 26.00.00 |

DCC

The Dual Clock Comparator (DCC) is used to determine the accuracy of a clock signal during the time executaion of an application. The DCC measure the frequency of a selectable clock sources using another input clock as a reference. The clock sources as well as the accuracy are programmed by the application.

The DCC can also be configured to operate in single-shot or continuous mode. In single-shot mode, DCC performs a one-time countdown where DCC stops operation when the counters reach 0. A completion interrupt is raised and the status can be checked. In continuous mode, DCC reloads both counts with the seed value upon completion without error. In case of an error, an ESM error event is raised.

# Features Supported

The DCC module provides the following functionality:

- Ability to configure a DCC instance
- Ability to verify the configuration of the DCC instance
- Ability to enable a DCC instance
- Ability to disable a DCC instance
- Ability to query the status of a DCC instance including current configuration, error information, interrupt status, and counter values
- Ability to clear the pending interrupt(s)
- Ability to readback the DCC static registers

Errors detected by the DCC module during operation are reported via ESM error (application will receive via ESM application callback).

# SysConfig Features

- None

# Features NOT Supported

- None

# Important Usage Guidelines

- The Input Source clock mapping for each DCC instance can be found in the DCC section of the TRM

# Example Usage

The following shows an example of SDL DCC API usage by the application.

Include the below file to access the APIs

#include <sdl/sdl_dcc.h>

Initialize the ESM to report DCC errors

SDL_ESM_config DCC_Test_esmInitConfig_MAIN =
{
.esmErrorConfig = {1u, 8u}, /* Self test error config */
.enableBitmap = {0x01E00000u, 0x00000000u, 0x00000000, 0x00000000u,
},
/* CCM_1_SELFTEST_ERR and _R5FSS1_COMPARE_ERR_PULSE_0 */
.priorityBitmap = {0x01E00000u, 0x00000000u, 0x00000000, 0x00000000u,
},
.errorpinBitmap = {0x01E00000u, 0x00000000u, 0x00000000, 0x00000000u,
},
};
SDL_ESM_init(SDL_ESM_INST_MAIN_ESM0, &DCC_Test_esmInitConfig_MAIN, SDL_ESM_applicationCallbackFunction, NULL);

Configure MAIN DCC Instance 0 seed values and clocks

SDL_DCC_Config configParams;
/* Select Input0 to be CLOCK0[2] */
configParams.clk0Src = SDL_DCC_CLK0_SRC_CLOCK0_2;
/* Select Input1 to be CLKSRC2 */
configParams.clk1Src = SDL_DCC_CLK1_SRC_CLOCKSRC2;
/* Not shown:
* Determine the clock frequencies for the sources
* Figure out the seed values for successful completion
* Check DCC example code for reference
*/
/* Assign the seed values for the clock selections */
configParams->clk0Seed = clk0_seed_value;
configParams->clk1Seed = clk1_seed_value;
configParams->clk0ValidSeed = clk0_valid_seed_value;
retVal = SDL_DCC_configure(SDL_DCC_INST_MSS_DCCA, &configParams);
Configure MAIN DCC Instance 0 for continuous mode
\code{.c}
/* Select continuous mode */
configParams.mode = SDL_DCC_MODE_CONTINUOUS;

Or, configure the MCU DCC Instance 0 for single-shot mode.

/* Select continuous mode */
configParams.mode = SDL_DCC_MODE_SINGLE_SHOT;
retVal = SDL_DCC_configure(SDL_DCC_INST_MSS_DCCA, &configParams);

If configuring single-shot mode, also register and enablei the done interrupt. In single-shot mode, the completion (Done) interrupt will happen at the end of the test if there are no errors. If error happens, then ESM interrupt will occur as well as the DCC error interrupt.

int32_t status = SystemP_SUCCESS;
HwiP_Params hwiPrms;
/* Register interrupt */
HwiP_Params_init(&hwiPrms);
hwiPrms.intNum = APP_DCC_INTR_NUM;
hwiPrms.callback = &SDL_DCCAppDoneIntrISR;
status = HwiP_construct(&gDCCHwiObject, &hwiPrms);
/* Enable the Done interrupt for DCC instance */
SDL_DCC_enableIntr(SDL_DCC_INST_MSS_DCCA, SDL_DCC_INTERRUPT_DONE);

The done interrupt handler should clear the interrupt

static void SDL_DCCAppDoneIntrISR(void *arg)
{
SDL_DCC_clearIntr(SDL_DCC_INST_MSS_DCCA, SDL_DCC_INTERRUPT_DONE);
}

Enable DCC Instance

SDL_DCC_enable(SDL_DCC_INST_MSS_DCCA);

# API

APIs for SDL Dual Clock Comparator(DCC)

SDL_ESM_config
ESM init configuration.
Definition: esm/v2/sdl_esm.h:180
sdl_dcc.h
SDL_DCC_configure
int32_t SDL_DCC_configure(SDL_DCC_Inst instance, const SDL_DCC_config *pConfig)
This API is used to configure DCC module.
HwiP_Params
Parameters passed during HwiP_construct.
Definition: HwiP.h:127
SDL_ESM_INST_MAIN_ESM0
@ SDL_ESM_INST_MAIN_ESM0
Definition: sdl_esm_soc.h:66
HwiP_construct
int32_t HwiP_construct(HwiP_Object *obj, HwiP_Params *params)
Create a Hwi object.
SDL_DCC_enableIntr
int32_t SDL_DCC_enableIntr(SDL_DCC_Inst instance, SDL_DCC_intrType intr)
This API is used to Enable the interrupts.
HwiP_Params_init
void HwiP_Params_init(HwiP_Params *params)
Set default values to HwiP_Params.
SDL_DCC_INST_MSS_DCCA
@ SDL_DCC_INST_MSS_DCCA
Definition: sdl_soc_dcc.h:74
SDL_DCC_INTERRUPT_DONE
#define SDL_DCC_INTERRUPT_DONE
Definition: dcc/v1/sdl_dcc.h:212
SDL_DCC_CLK0_SRC_CLOCK0_2
#define SDL_DCC_CLK0_SRC_CLOCK0_2
Definition: dcc/v1/sdl_dcc.h:165
SDL_DCC_MODE_CONTINUOUS
#define SDL_DCC_MODE_CONTINUOUS
Definition: dcc/v1/sdl_dcc.h:147
SystemP_SUCCESS
#define SystemP_SUCCESS
Return status when the API execution was successful.
Definition: SystemP.h:56
HwiP_Params::callback
HwiP_FxnCallback callback
Definition: HwiP.h:130
SDL_ESM_config::esmErrorConfig
SDL_ESM_ErrorConfig_t esmErrorConfig
Definition: esm/v2/sdl_esm.h:181
SDL_ESM_init
int32_t SDL_ESM_init(SDL_ESM_Inst instance, const SDL_ESM_config *pConfig, SDL_ESM_applicationCallback applicationCallback, void *appArg)
SDL ESM API to initialize an ESM instance. The API initializes the specified ESM instance with the pr...
SDL_DCC_enable
int32_t SDL_DCC_enable(SDL_DCC_Inst instance)
This API is used to enable the DCC module.
SDL_DCC_MODE_SINGLE_SHOT
#define SDL_DCC_MODE_SINGLE_SHOT
Definition: dcc/v1/sdl_dcc.h:143
HwiP_Params::intNum
uint32_t intNum
Definition: HwiP.h:129
SDL_DCC_clearIntr
int32_t SDL_DCC_clearIntr(SDL_DCC_Inst instance, SDL_DCC_intrType intr)
This API is used to clear the interrupts.
SDL_DCC_CLK1_SRC_CLOCKSRC2
#define SDL_DCC_CLK1_SRC_CLOCKSRC2
Definition: dcc/v1/sdl_dcc.h:183