Hi All,
I am using TMS320F28379D as controller for a DCDC converter, the ePWM modules in my hardware are assigned as: ePWM1 and ePWM2 are run at a variable frequency fsw1, ePWM3 to ePWM8 are run at another variable frequency fsw2.
The issue I encounter is that when I try to change the frequency of ePWM3~ePWM8, an unwanted phase shift between ePWM3 and ePWM4 happens , I believe that is caused by the synchronous scheme in TMS320F28379D, the ePWM3 and ePWM4 are in different sync group.
My solution is, sine the hardware cannot be modified, I am going to use the ePWM-XBar to feed the SYNCOUT signal from ePWM4 to synchronize ePWM3, and disable the EPWM2SYNCO signal. The detailed signal loop will be: EPWM4SYNCO -> ePWM
-Xbar -> Digital compare module of ePWM3 -> Time base module of ePWM3. The signal loop is showing in the figure below:
Fig.1 ePWM4 to Xbar
Fig.2 X-bar to Digital compare module of ePWM3
Fig.3 ePWM3 Digital compare module to TB module
The codes I have now is listed below:
// CHANGE XBAR inputs from using GPIO0
// if EPWM SYNCIN is enabled, EXTSYNCIN1 and EXTSYNCIN2 will use GPIO0 (which is the output of EPWM1).
// Pick any unused GPIO
//
XBAR_setInputPin(XBAR_INPUT5, 50);
// Modules SYNC
EPWM_setSyncOutPulseMode(EPWM1_BASE, EPWM_SYNC_OUT_PULSE_ON_COUNTER_ZERO); // ePWM1 SYNCO is generated on CTR=0
EPWM_setSyncOutPulseMode(EPWM2_BASE, EPWM_SYNC_OUT_PULSE_DISABLED); // ePWM2 SYNCO is disabled
// EPWM_setSyncOutPulseMode(EPWM3_BASE, EPWM_SYNC_OUT_PULSE_ON_EPWMxSYNCIN);
// EPWM_setSyncOutPulseMode(EPWM4_BASE, EPWM_SYNC_OUT_PULSE_ON_COUNTER_ZERO);
// EPWM_setSyncOutPulseMode(EPWM5_BASE, EPWM_SYNC_OUT_PULSE_ON_EPWMxSYNCIN);
// EPWM_setSyncOutPulseMode(EPWM6_BASE, EPWM_SYNC_OUT_PULSE_ON_EPWMxSYNCIN);
// EPWM_setSyncOutPulseMode(EPWM7_BASE, EPWM_SYNC_OUT_PULSE_ON_EPWMxSYNCIN);
// EPWM_setSyncOutPulseMode(EPWM8_BASE, EPWM_SYNC_OUT_PULSE_ON_EPWMxSYNCIN);
// Sync EPWM4 and EPWM7 with EPWM1.
SysCtl_setSyncInputConfig(SYSCTL_SYNC_IN_EPWM4, SYSCTL_SYNC_IN_SRC_EPWM1SYNCOUT);
SysCtl_setSyncInputConfig(SYSCTL_SYNC_IN_EPWM7, SYSCTL_SYNC_IN_SRC_EPWM1SYNCOUT);
// Enable all phase shifts.
EPWM_enablePhaseShiftLoad(EPWM2_BASE);
// EPWM_enablePhaseShiftLoad(EPWM3_BASE);
// EPWM_enablePhaseShiftLoad(EPWM4_BASE);
// EPWM_enablePhaseShiftLoad(EPWM5_BASE);
// EPWM_enablePhaseShiftLoad(EPWM6_BASE);
// EPWM_enablePhaseShiftLoad(EPWM7_BASE);
// EPWM_enablePhaseShiftLoad(EPWM8_BASE);
//****** Sync EPWM3 with EPWM4 though X-bar *******//
EALLOW;
//Select sync output
SyncSocRegs.SYNCSELECT.bit.SYNCOUT = 1; //Select EPWM4 SYNCOUT as EXTSYNCOUT
//Configure source of TRIP4
EPwmXbarRegs.TRIP4MUX0TO15CFG.bit.MUX14 = 3; //Configure TRIP4 to be EXTSYNCOUT
EPwmXbarRegs.TRIP4MUXENABLE.bit.MUX0 = 1; //Enable
EPwmXbarRegs.TRIPOUTINV.bit.TRIP4 = 0; //Non-invert, active high
//Configure DCA to be TRIP4
EPwm3Regs.TZDCSEL.bit.DCAEVT1 = TZ_DCBH_HI; // active high
EPwm3Regs.DCTRIPSEL.bit.DCAHCOMPSEL = 3; // 0b0011:TRIPIN4
// EPwm3Regs.DCAHTRIPSEL.bit.TRIPINPUT4 = 1;
//Configure DCA path to be unfiltered & sync
EPwm3Regs.DCACTL.bit.EVT1SRCSEL = DC_EVT1; //Unfiltered EVT1
EPwm3Regs.DCACTL.bit.EVT1SYNCE = 1; // Sync enabled
EDIS;
But my test result shows it doesn't works well, when I change the period in a epwm1 interrupt, ePWM3 and ePWM4 can only be synchronized when the changing step is small, for example EPWM_TBPRD changed from 500 to 510, and it fails when the step is large, for example EPWM_TBPRD changed from 500 to 600.
Anyone could help me figure out what's the problem with my solution? Or if you have any better idea? Many thanks!


