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.

TMS320F280025C: Question about the ePWM setting

Part Number: TMS320F280025C


Hello,

I'm making ePWM module for 0% to 100% duty cycle control at Up-Count mode.

I was able to make it almost exactly as I wanted, but there is one part I don't understand the behavior of.

The following is an excerpt.

When I set up the following program, the duty cycle becomes 100% only the first time after the microcontroller starts.


init_func()

EPwm1Regs.TBCTL.bit.CTRMODE = 3; /* stop */

EPwm1Regs.TBPRD = 1000;  /* 100kHz */

EPwm1Regs.AQCTL.bit.SHDWAQAMODE = 1;  /* shadow ON */

EPwm1Regs.AQCTL.bit.LDAQAMODE = 0;  /* reload  =zero*/

EPwm1Regs.CMPA.bit.CMPA = 700;  /* initial duty 70% */

~~~~~~~~~~~~~~~

start_func()

EPwm1Regs.AQCTLA.bit.CAU = 1;  /* clear */

EPwm1Regs.AQCTLA.bit.ZRO = 2;  /* set */

EPwm1Regs.TBCTL.bit.CTRMODE = 0;  /* start */


My expectation is that the first waveform will output about 70% duty.

However, the behavior was different from my expectation.

"EPwm1Regs.AQCTLA.bit.CAU" seems to be ignored the first time, what is the cause?

Is it the shadow mode of the AQ sub-module that is causing the problem, or is it the priority of "EPwm1Regs.TBCTL.bit.CTRMODE = 3" that is affecting it?

<supplement>

I understood I can get around this by "turning off the shadow mode of AQ sub-module" or "starting the TBCTL counter before setting the AQCTLA".

However, I would like to know the true cause mentioned above.

Best regards,

Masaru Maeda,