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.

sine pwm in TMS320F2812

Other Parts Discussed in Thread: TMS320F2812

Hi

I am using a TMS320F2812 DSP for generating sine PWM signals. I have a 1000 point sine wave in IQ format and the value in the CMPRx register is always less than the value in TxPRD register. I am getting the signal shown below.

Some points are missing in the wave and some outputs are less than logic 1. What could be the reason? How can I rectify it?

Thank you

  • Hi Murali,

    By any chance did you check the pure sine wave output when this SPWM is passed through the filter?

    Regards,
    Gautam
  • Hi Goutam
    I didn't understand this. Which filter are you referring to? I am new to embedded design and don't know much about it.
    Thank you
  • Murlali,

    I think what Gautam is saying is if you filter the PWM with a low-pass filter you will probably see a pure sine wave. The duty cycle modulation looks as if it might be sinusoidal, judging from the upper traces. Depending on the bandwidth of the scope it is possible some of the narrow pulses are being filtered out so it looks like they're either missing or have smaller amplitude.

    Regards,

    Richard
  • Hi Goutam and Richard,

    Sorry for the late reply. I passed the PWM through a low pass filter of cut off frequency 1kHz and obtained the waveform attached with this. My sine wave is with a DC offset value of 1. But there seems to be a problem with the peak of sine wave. I've made sure that the value in compare register never becomes greater than the value in period register. So I'm at a loss of ideas now. Please help.

    Regards,

    Murali

  • How do you generate your sine wave? I believe the issue lies in the sine generation. The complete code for that could maybe give some insight.

    cheers,
  • Murali, Alex is right. There seems to be an issue with your sine generation. Check with your sine table or function.
  • Murali,

    On C2000 the PWM time-base counter has to pass through the compare value to get a physical transition at the pin.  I think what's probably happening is your sine table contains one or more points equal to the timer-base period setting.  In that case the output will go low on the period event and not be reset high again (becaue there's no compare transition).  Try to reduce the sine table amplitude by a couple of points to remove zero and period values from the output - I think that will fix it.

    Regards,

    Richard