This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi Experts,
I am writing CLA code. CLA is triggered by ePWM1 continuously. But I found that CLA code is executed only once. The procedure is below.
Initial routine on C28x:
(*ePWM[PWM1]).ETSEL.bit.INTSEL = 1; // Interrupt on counter zero match
(*ePWM[PWM1]).ETSEL.bit.INTEN = 1; // Enable peripheral interrupt
(*ePWM[PWM1]).ETPS.bit.INTPRD = 1; // Generate interrupt on every event
//
// Assign the task vectors and set the triggers for task 1 and 7
//
Cla1Regs.MVECT1 = (uint16_t)&Cla1Task1;
Cla1Regs.MVECT7 = (uint16_t)&Cla1Task7;
DmaClaSrcSelRegs.CLA1TASKSRCSEL1.bit.TASK1 = 36U; // $$$ EPWM1 1U; //ADCA1
DmaClaSrcSelRegs.CLA1TASKSRCSEL2.bit.TASK7 = 0U; //Software
//
// Force task 7, the one time initialization task
//
Cla1Regs.MIFRC.bit.INT7 = 1U;
task on CLA;
__attribute__((interrupt)) void Cla1Task1 ( void )
{
__mdebugstop();
count ++;
__meallow(); // EALLOW;
// Re-initialize for next PWM interrupt
//
PieCtrlRegs.PIEACK.all = 0x4; //PIEACK_GROUP3; // Acknowledge PIE interrupt
(*ePWM[PWM1]).ETCLR.bit.INT = 1; // Clear interrupt bit
__medis(); // EDIS;
}
__attribute__((interrupt)) void Cla1Task7 ( void )
{
count = 0;
}
When looking at "counter", it is always 1 which means CLA task 1 executes only once. Below is a partial of CLA register.
EPWM1 is generating interrupt every cycle. EPwm1Regs.ETFLG.INT is set to 1. When writing 1 to EPwm1Regs.ETCLR.INT to clear ETFLG on debug register window, the counter on CLA task1 is incremented.
Could you show me what is missing?
Regards,
Uchikoshi