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 triangle pwm

I'm using ti's ezdsp f28335 dsp and have read the epwm manuals (great btw) but still having trouble figuring out how to generate a sine triangle pwm. I've gone through the example code snippets but the epwm manual doesn't suggest any method of coding for a sine pwm for the single phase inverter.

It would be a great help if any one of you could provide a generic code  for generating a sine triangle pwm signal using ezdsp f28335 . Thanx

  • Hello

    PWM output is generated by comparing the counter with compare value. The counter can operate in up count mode and also in up/down mode and this is a digital implementation of a tradition analog sine traingle method. If you want to generate a sine voltage then your compare values should be modulated by a sine table so that the PWM output generates a sine voltage. For a detail description on how to generate a sine voltage for a motor drive application a better reference will be any one of those drive projects. You can also down load the signal generation library for examples of sine waveform generation.

  • Shoaib,

    http://focus.ti.com/docs/toolsw/folders/print/sprc083.html

     

  • Hi

    Thanks for the reply, I've downloaded the signal generator library and installed the software however I'm still facing bit of a problem. To generate a sine pwm, I'm modifying the examples provided with the code composer studio such as the up count epwm example. I took the code for generating a sine function in the signal generator Docs and pasted it in the up-count example project but while compiling it I get an error which says "sgen.h not found" (the error points at the statement   "#include sgen.h") . 

    The problem is that I dont have much of an experience programming the ezdsp f28335. I'll appreciate if you ca provide me with a C code snippet to generate a sine-triangle pwm.
    PS - what did you mean by " If you want to generate a sine voltage then your compare values should be modulated by a sine table", did you mean that CMPA  = sin(x) ??

  • Hi

    Thanks for the reply Arefeen, I've downloaded the signal generator library and installed the software however I'm still facing bit of a problem. To generate a sine pwm, I'm modifying the examples provided with the code composer studio such as the up count epwm example. I took the code for generating a sine function in the signal generator Docs and pasted it in the up-count example project but while compiling it I get an error which says "sgen.h not found" (the error points at the statement   "#include sgen.h") . 

    The problem is that I dont have much of an experience programming the ezdsp f28335. I'll appreciate if you ca provide me with a C code snippet to generate a sine-triangle pwm.
    PS - what did you mean by " If you want to generate a sine voltage then your compare values should be modulated by a sine table", did you mean that CMPA  = sin(x) ??

  • hello

    Here is a quick idea you can try - note out of many possible ways this is just one suggestion.

    In this case

    xx1 = sine table value in Q15 format and x1 is the compare value (CMPA).

    After completing multiplication in Q format, you will use the integer protion to modify your compare register.

    x1 = _IQint(_IQmpy(_IQ15toIQ(xx1),_IQ(EPWM1_TIMER_TBPRD/2 ))) + EPWM1_TIMER_TBPRD/2 ;

    In the above case, compare value is modulated using the sine value. Note the compare value will vary from 0 to timer period.

    By the way, if you are missing files after download then you will be better off contacting TI help line.

  • Hi, there's this problem of the function generator library getting in  the way, how do i you use this library with the code composer  and where can i get more info on the 'Q format'.

    Here's what i'm trying to do:

                                                           from Brian Burk,   (http://e2e.ti.com/forums/p/12421/49298.aspx#49298)

    Now how can i implement this process with my dsp ( its getting a little frustrating) and what is the Q-format that you were talking about?

    Any other method that you can suggest to achieve this ?

     

  • Please go through the introductory material to make yourself familiar with C2000 platform, CCS, code etc. There are example projects showing how to setup CCS, PWM modules. There are downloads for IQ-format material as well.