Other Parts Discussed in Thread: TMS320F28335, CONTROLSUITE
Friends,
I need to work on TMS320f28335 controller to genertate a PWM signal! Anybody has a template to work on?
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.
Other Parts Discussed in Thread: TMS320F28335, CONTROLSUITE
Friends,
I need to work on TMS320f28335 controller to genertate a PWM signal! Anybody has a template to work on?
Hi,
You can use this code:
//--------------- Configuration pin as PWM ---------------
EALLOW;
// Enable pull-up on GPIO0 (EPWM1A)
GpioCtrlRegs.GPAPUD.bit.GPIO0 = 0;
// Configure GPIO0 as EPWM1A
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1;
EDIS;
//--------------- Configuration for PWM module ---------------
EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading
EPwm1Regs.TBPHS.half.TBPHS = 0x0000; // Phase is 0
// Counter mode
EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP; // Count up
// Configuration clock for PWM1
EPwm1Regs.TBCTL.bit.HSPCLKDIV = TB_DIV2;
EPwm1Regs.TBCTL.bit.CLKDIV = TB_DIV2; // TBCLK = SYSCLKOUT / (HSPCLKDIV × CLKDIV) = 37.5MHz
// Set up period
EPwm1Regs.TBPRD = 1874; // PWM period (frequency) = TBCLK / (TBPRD + 1 ) = 20KHz
// Setup shadow register load on ZERO
EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO;
// Set actions
EPwm1Regs.AQCTLA.bit.ZRO = AQ_SET; // Set PWM1A on Zero
EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR; // Clear PWM1A on event A, up count
// Set initial compare values
EPwm1Regs.CMPA.half.CMPA = 0;
But I think you should read reference guide to understand. They are very clear.
Thanks
Thank you Phien Nguyen !!! this code generates a normal pwm wave.. can you suggest one for generating sinusoidal pwm?
Hi Gautam,
Thanks.,
I have installed control suite and working on it! i would like to generate a sinusoidal pwm wave (spwm) .
Regards,
Hari
Hari, I guess you're looking for Sine wave generation. I would like you to look into this section of controlSuite:
C:\ti\controlSUITE\libs\dsp\SGEN\v101
Read the pdf present in doc folder.
Regards,
Gautam