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.
Dear team:
I used two methods to update the CMPA value in CLA, but none succeeded:
Method 1:
interrupt void Cla1Task1 (void) { //Local Variables //i=fGridVoltRatio; //Code __mdebugstop(); //int i; Num = 100.0; Den = 10.0; //i++; GpioDataRegs.GPATOGGLE.bit.GPIO20 = 1; __meallow(); EPwm12Regs.CMPB.bit.CMPB = 10; EPwm1Regs.CMPA.bit.CMPA = 100; __medis(); // /*if(EPwm1Regs.CMPA.bit.CMPA >= 400) { EPwm1Regs.CMPA.bit.CMPA--; } if(EPwm1Regs.CMPA.bit.CMPA <= 40) { EPwm1Regs.CMPA.bit.CMPA++; }*/ // Res = CLAdiv(Num,Den); Res = Num/Den; }
It can be sure that the program has entered the CLA task, because the GPIO20 has been inverted and the RES value has been calculated. But when single step debugging, register“ EPwm1Regs.CMPA.bit.CMPA ”The value in is always the value I initialized, not 100
Method 2:
interrupt void Cla1Task1 (void) { //Local Variables //i=fGridVoltRatio; //Code __mdebugstop(); //int i; Num = 100.0; Den = 10.0; //i++; GpioDataRegs.GPATOGGLE.bit.GPIO20 = 1; __meallow(); EPwm12Regs.CMPB.bit.CMPB = 10; EPwm1Regs.CMPA.bit.CMPA = Num; __medis(); // /*if(EPwm1Regs.CMPA.bit.CMPA >= 400) { EPwm1Regs.CMPA.bit.CMPA--; } if(EPwm1Regs.CMPA.bit.CMPA <= 40) { EPwm1Regs.CMPA.bit.CMPA++; }*/ // Res = CLAdiv(Num,Den); Res = Num/Den; }
I use Num to assign a value to EPwm1Regs.CMPA.bit.CMPA. when single step debugging, Num becomes 10.0 , but the value of EPwm1Regs.CMPA.bit.CMPA has not changed. It's still the value of my initialization.
Is there anything else I need to pay attention to when I update the value of CMPA register in CLA?
Best regards
Hi,
How did you verify the CMPA register not getting updated ? Did you look at the EPWM output waveform or you just observed the register value in CCS expression window because the updated value in expression window can only be observed from the C28x Debug scope and not CLA debug scope. Please let me know the method of your validation so that I can do further analysis of the issue.
Also you can refer to a similar example "cla_ex4_pwm_control" available as part of F28004x CLA driverlib examples under C2000Ware which also updates CMPA register of EPWM inside a CLA task to update the duty of PWM output.
If my reply answers your question please click on "This resolved my issue" button located at the bottom of my post.
Regards
Himanshu