Part Number: TMS320F28075
Hi team,
I am supporting my customer to test their housekeeping code to handle CLA and ADC overflow. This is a question related to both CLA and compliler, please feel free to involve some experts.
1. To create overflow condition:
How they produce overflow by purpose is to repeat some simple code in CLA task. However have some interesting findings:
1) Repeat EPwm1Regs.CMPA.bit.CMPA = 1;
With level 4 optimization, we noticed if repeat this code for <18 times, the CLA task execution time does not change. However, if repeat it for 19 times, the overflow would occur.
2) Do the same thing with address pointer:
This time, the overflow would occur when they repeat the code for 2 times.
3) Turn off the optimazing:
The same code could be repeat for 50 times, and no overflow happens
Customer would like to know what is the optimizating principle behind this?
2. Handing overflow:
1) In order to clear ADC and CLA overflow, customer have the following code in CLA:
AdcdRegs.ADCINTOVFCLR.bit.ADCINT1 = 1;
AdcdRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
__meallow();
Cla1Regs.MICLROVF.bit. INT1 = 1;
__medis();
But we noticed the related flag is not cleared, and CLA task cannot be entered anymore.
2) If we try to clear the overflow flag in PWM. Both flag can be cleared, but CLA task cannot be entered.
Why we cannot clear oveflow flag in CLA and CLA task cannot be enter? Commets are welcomed.
Regards,
Brian