Hi,
I am generating an asymmetric pwm (better frequency adjustment resolution) waveform using the ePWM module. I use the following steps to configure my ePWM module (TRCTR counts up):
1. set TBPRD
2. set TBCTL_CTRMODE = 0 (up count mode)
3. set CMPA
4. set AQCTL_CAU = 2 (set output high) so that when TBCTR > CMPA, output is high
5. set AQCTL_PRD = 1 (set output low) so that the output is set to low
6. CMPA varies between 0 to TBPRD to accomplish 0% to 100% duty cycle
However, I found when I set duty cycle to 100%, it generates periodic glitches at the exact PWM frequency. Further looking into it shows that I need to clear AQCTL_PRD when my duty cycle is 100% since it sets output to low when TBCTR == TBPRD, so I have to add extra logic in duty cycle setting:
6.1. if ( duty == 100 ) AQCTL_PRD = 2; // set output high
Is this what's expected or is there a better solution to deal with it?
Thank you very much!
Shuozhi