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.

TMS320F280049: CLA task runs only one time

Part Number: TMS320F280049
Other Parts Discussed in Thread: C2000WARE

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

  • Hi Uchikoshi,

    Do you have the debugger connected to the CLA? If so, the CLA will hit the MDEBUSTOP and halt the CLA and not allow it to progress.

    Have you tried the examples in C2000Ware which have similar example behavior? Also, please search the forum for similar questions.

    Also, are you clearing the PIE for the EPWM interrupt? Are you sure you are getting the PWM interrupt continuously?

    Regards,
    sal
  • Hi sal,
    At the last step for CLA Task1, ePWM1 interrupt flag is cleared as below.

    (*ePWM[PWM1]).ETCLR.bit.INT = 1; // Clear interrupt bit

    I modified as below and now it is working.

    EPwm1Regs.ETCLR.bit.INT = 1;

    No error or warning was appeared when CLA code was compiled, I guess there might be some missing.

    Regards,
    Uchikoshi
  • Hi Uchikoshi,

    Thank you for posting your solution. The compiler would not issue a warning for this if it is valid C code.

    Glad you got it working.

    Regards,
    sal