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.

TMS320F28388D: Can I achieve PWM Pulse width of 0.5 second with EPWM4

Part Number: TMS320F28388D

Hi,

We have a requirement to create PWM with Period of 1 second using EPWM4. So I have configured GPIOs for EPWM4 and Peripheral clock also enabled for EPWM4.

 To generate 0.5 sec pulse width, I configured parameters such as :

System Clock EPWMCLKDIV HSPCLKDIV CLKDIV EPWMCLK TBCLK T ( TBCLK ) TPWM FPWM TBPRD Counter Type
200,000,000 2 14 128 100000000 55803.57143 0.00001792 1 1 27901.78571 UP Down Method
200,000,000 2 12 64 100000000 130208.3333 0.00000768 1 1 65104.16667 UP Down Method

EALLOW;
gstrEPwm4Regs.TBCTL.bit.CTRMODE = 2;

gstrEPwm4Regs.AQCTLA.bit.CAD = 1;
gstrEPwm4Regs.AQCTLA.bit.CAU = 2;

gstrEPwm4Regs.TBCTL.bit.HSPCLKDIV = 6;
gstrEPwm4Regs.TBCTL.bit.CLKDIV = 6;
gstrEPwm4Regs.TBPRD = 65104U;

gstrEPwm4Regs.CMPA.bit.CMPA = 32552U;

EDIS;

But I am getting PWM waveform, I am getting spikes in wave form. As shown below. 

Please help me, whether can I get 1 sec PWM Period. 

Thanks,

Yamini

  • Hello Yamini,

    The second row of the configuration setting values looks correct to me from calculations standpoint and the code also looks correct.

    I will try to replicate with the same settings at my bench and get back to you. One thing to confirm from your end is that the PLLSYSCLK(System Clock) is set to 200Mhz correctly ?

    Thanks,
    Prarthan.