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.

Need code snippet

Other Parts Discussed in Thread: CONTROLSUITE

Hi,

I need to to generate sine modulated PWM and I intend to use C2000 F28027

Parameters

PWM frequency: 1 Mhz

Sine frequency: 100 Khz

I am very new to this microcontroller and this is just part of my project so I would be greatful if i can find a code snippet. Otherwise please suggest me resources so that I will be able to write code for this.Also please do specify the algorithm that I can use. I did acheive it in MSP430(lower frequency) and I had used a Sine look up table.I think I should approach in the same way.But I am open to other approaches also.Please help me its very important.

Regards,

Vishnu

  • Hi Vishnu,

    You can find the signal generator library and respective documents here:
    C:\ti\controlSUITE\libs\dsp\SGEN\v101

    Regards,
    Gautam
  • Hi Gautam,
    Thanks for that but do you think that above mentioned frequency is possible?
    Regards,
    Vishnnu
  • Vishnu, I've personally not used the library. You need to to check it yourself.

    Regards,
    Gautam
  • Hi Vishnu,

    The SGEN library that Gautam has suggested should help you.  The second part of this is learning the ePWM module.  An example of this can be found in controlSUITE:
    \controlSUITE\device_support\f2802x\v220\f2802x_examples_structs\hrpwm_prdupdown_sfo_v6\

    You'll probably want to have a PWM (with HR enabled) running in up-down count mode and have CMPA up and down events toggle the PWM output.  The PWM will then generate an ISR each PWM period and you'll update the sine value that you'll send to the C2000 each ISR. 

    At a 1MHz PWM frequency, you'll have an ISR frequency of 1MHz.  Since you'll be running on a 60MHz device this means that you have 60 cycles for your ISR to trigger, do context save, run through your ISR and do a context restore (and do other code until the next ISR arrives).  This should be doable.


    Thank you,
    Brett