Part Number: TMS320F28379D
Tool/software:
Dear Experts,
I am trying to generate a PWM using PWM module while the counter is in synch with an external trigger. TO achieve this, I'm triggering a pulse on GPIO10 which is associated with INPUT5SELECT. Furthermore, I also initialized TBCTL's bit PHSEN as 1 to make CTR to ZERO when triggered externally.
Here is the snippet of the initialzations sections of the code.
void PWM0_Init(void)
{
EALLOW;
EPwm1Regs.TBCTL.bit.CTRMODE = 0; // Count up
EPwm1Regs.TBPRD = 10000; // Set timer period
EPwm1Regs.TBCTL.bit.PHSEN = 1; // Enable phase loading
EPwm1Regs.TBPHS.bit.TBPHS = 0x0000; // Phase is 0
EPwm1Regs.TBCTR = 0x0000; // Clear counter
EPwm1Regs.TBCTL.bit.HSPCLKDIV = 0; // Clock ratio to SYSCLKOUT
EPwm1Regs.TBCTL.bit.CLKDIV = 0;
EPwm1Regs.TBCTL.bit.SYNCOSEL = 1; // SYNC output on CTR = 0
// Setup shadow register load on ZERO
EPwm1Regs.CMPCTL.bit.SHDWAMODE = 0;
EPwm1Regs.CMPCTL.bit.SHDWBMODE = 0;
EPwm1Regs.CMPCTL.bit.LOADAMODE = 0;
EPwm1Regs.CMPCTL.bit.LOADBMODE = 0;
// Set Compare values
// Set compare A value
// Set actions
EPwm1Regs.AQCTLA.bit.ZRO = 2; // Set PWM1A on Zero
EPwm1Regs.AQCTLA.bit.CAU = 1; // Clear PWM1A on event A, up count
//SOCA to ADC
EPwm1Regs.ETSEL.bit.SOCAEN=1;
EPwm1Regs.ETSEL.bit.SOCASEL=1;
EPwm1Regs.ETPS.bit.SOCAPRD = 1;
EPwm1Regs.ETCLR.bit.SOCA = 1;
EDIS;
}
void X_bar(void)
{
EALLOW;
InputXbarRegs.INPUT5SELECT = 10;
EDIS;
}
Despite of these initializations, I don't see any changes in PWM frequency while I keep altering the external trigger frequency.
THanks in advance.
Regards,
Rajesh,

