Other Parts Discussed in Thread: TMS320F28035
Guys,
I need your help...
I am using TMS320F28035 MCU for a Motor Control Application.
In my implementation, I have 3 PWM A/B channels are configured and center aligned using up down counting mode. ADC is configured to trigger at the center of the center aligned PWMs. To verify it i have output the ADSSOCA signal on GPIO8. PWM is configured for carrier freq of 2.5KHz (T = 400us)
My observation : ADC trigger is not perfectly happening at the center of the PWM when PWM ON Time is 3-4us. Even for a 12 us ON time the ADC trigger is not center aligned. As the PWM width increase the trigger gets closer to the Center of the PWM. See the attached waveform Zoom Out & Zoom In. Channel 0,1,2 is the HIGH side (A) switching of the PWM 1,2,3. Signal in blue is the ADCSOCA trigger on GPIO8(Configured to output the SOC trigger instance)
In my application i want the ADC trigger to happen at the center starting from 3us wide PWM pulse.
I have attached my PWM and ADC configuration files for reference.
I would appreciate someone can help me out with this.
//****************************************************************************
// Function Name: ADC_init
// returns: void
// arg1: void
// Description: Function needs to be called during board
// initialization, in order to configure the ADC operation on the device.
//
//****************************************************************************
adcSetup_e ADC_init(void)
{
AdcOffsetSelfCal();
// Zero out the internal trim value. This was a source of persistent
// error.
EALLOW;
// Testing accuracy.
AdcRegs.ADCOFFTRIM.all = 0x0000;
EDIS;
ADC_MACRO_INIT(m_ADC_chSelStd, m_ADC_trigSel, ACQPS)
EALLOW;
/* Set up Event Trigger with period enable for Time-base of EPWM1 */
EPwm1Regs.ETSEL.bit.SOCAEN = 1; // Enable SOCA
EPwm1Regs.ETSEL.bit.SOCASEL = 1; // Set to trigger on PWM prd counter = 0
EPwm1Regs.ETPS.bit.SOCAPRD = 1; // Generate SOCA on the 1st event
EPwm1Regs.ETCLR.bit.SOCA = 1; // Clear SOCA flag
// Enable CNT_zero interrupt using EPWM1 Time-base
EPwm1Regs.ETSEL.bit.INTEN = 1; // Enable EPWM1INT generation
EPwm1Regs.ETSEL.bit.INTSEL = ET_CTR_ZERO; // Enable interrupt CNT_zero event
EPwm1Regs.ETPS.bit.INTPRD = ET_1ST; // Generate interrupt on the 1st event
EPwm1Regs.ETCLR.bit.INT = 1; // Enable more interrupts
// PIE group 3
PieCtrlRegs.PIEIER3.bit.INTx1 = 1; //EPWM1_INT
#endif
// Testing accuracy.
AdcRegs.ADCOFFTRIM.all = 0x0000;
EDIS;
return m_ADC_channelConfig;
}



