TC377: service request line from timer CCU T13 to EVADC

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
IvanoBono
Level 3
Level 3
25 sign-ins 10 sign-ins 10 replies posted
I have configured a timer and it calls the interrupt correctly (see code). I would like to modify it to perform a ServiceRequest that starts the ADC for me.


/* Timer handle */
IfxCcu6_Timer g_timer;
volatile unsigned long IntTimer_counter=0;
IFX_INTERRUPT(IntTimer_int, 0, ISR_PRIORITY_CCU6_INT1);

void IntTimer_int(void) {
IntTimer_counter++;
}

void IntTimer_Init(float freq_hz,IntTimer_Callback callback) {
IfxCcu6_Timer_Config timerConfig;
IfxCcu6_Timer_initModuleConfig(&timerConfig, &MODULE_CCU60);

timerConfig.base.t13Frequency = CCU6_T13_TIMER_FREQ; /* Timer T13 frequency */
timerConfig.base.t13Period = CCU6_T13_TIMER_PERIOD; /* Timer T13 period */
timerConfig.timer = IfxCcu6_TimerId_t13; /* Select the timer, T13 is the master */
timerConfig.synchronousOperation = FALSE; /* Disable synchronous start of the timers */
timerConfig.trigger.t13InSyncWithT12 = FALSE; /* T12 timer starts the T13 timer */
timerConfig.interrupt1.source = IfxCcu6_InterruptSource_t13PeriodMatch; /* Set interrupt source */
timerConfig.interrupt1.priority = ISR_PRIORITY_CCU6_INT1; /* Set the priority of the ISR */
timerConfig.interrupt1.typeOfService = IfxSrc_Tos_cpu0; /* Set the type of service for the interrupt */
timerConfig.trigger.t13InSyncWithT12 = FALSE; /* Configure timers synchronization */

/* Configure the T13 timer start event */
//timerConfig.timer13.t12SyncEvent = IfxCcu6_T13TriggerEvent_onT12Period;
//timerConfig.timer13.t12SyncDirection = IfxCcu6_T13TriggerDirection_onT12CountingUp;

/* Apply the configuration to the CCU6 module */
IfxCcu6_Timer_initModule(&g_timer, &timerConfig);


/* Configure the T13 timer for single shot mode */
IfxCcu6_Timer_start(&g_timer);
}


from the examples I saw that you have to use the functions:


/* Activate the line ServiceRequest_3 to route the T13 period match event trigger to the EVADC module */
//IfxCcu6_enableInterrupt(&MODULE_CCU60, IfxCcu6_InterruptSource_t13PeriodMatch);
//IfxCcu6_routeInterruptNode(&MODULE_CCU60, IfxCcu6_InterruptSource_t13PeriodMatch, IfxCcu6_ServiceRequest_3);


it's correct? and how do i instruct the adc to be triggered by serviceRequest3?
0 Likes
2 Replies
teoBits
Employee
Employee
5 sign-ins 100 replies posted 50 replies posted
Hello,

take a look at the CCU6_ADC_1_KIT_TC375_LK training and its tutorial.

in the training the CCU6 timers are used to trigger the EVADC.

hope it helps,
teoBits
0 Likes
IvanoBono
Level 3
Level 3
25 sign-ins 10 sign-ins 10 replies posted
I answer myself:
in the timer Init function it is sufficient to remove the lines:

timerConfig.interrupt1.source = IfxCcu6_InterruptSource_t13PeriodMatch; /* Set interrupt source                */
timerConfig.interrupt1.priority = ISR_PRIORITY_CCU6_INT1; /* Set the priority of the ISR */
timerConfig.interrupt1.typeOfService = IfxSrc_Tos_cpu0; /* Set the type of service for the interrupt */


and add these lines:

IfxCcu6_enableInterrupt(&MODULE_CCU60, IfxCcu6_InterruptSource_t13PeriodMatch);
IfxCcu6_routeInterruptNode(&MODULE_CCU60, IfxCcu6_InterruptSource_t13PeriodMatch, IfxCcu6_ServiceRequest_3);


in EVADC i need to initialize all queues i want to use with functions (gr is group 0,1,2):
//            /* Configure the EVADC module to trigger a conversion based on CCU6 timer period match event */
/* Trigger 0 is connected to CCU6 ServiceRequest_3 line */ //REQTR TMEN
adcGroupConfig.queueRequest[gr].triggerConfig.triggerSource = IfxEvadc_TriggerSource_0;
/* Select the trigger event type */
adcGroupConfig.queueRequest[gr].triggerConfig.triggerMode = IfxEvadc_TriggerMode_uponRisingEdge;
/* Set that requests with higher priority cancel a running lower priority conversion */
adcGroupConfig.queueRequest[gr].requestSlotStartMode = IfxEvadc_RequestSlotStartMode_cancelInjectRepeat;
0 Likes