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.

Phase shift and synchronization for different frequency

Dear Guys!

I am working on multiple LED control. 

My topology includes half-bridge LLC for power and time-division multiplexer(TDM) for 5 LED channel. 

The frequency for LLC mosfets is 100 khz, and the frequency for TDM  mosfet is 40 khz. 

The problem is that the signal control for mosfet of LLC is not synchronized counted timer with those of TDM mosfet. 

So I would like to question to you: 

1. How to set synchronization for multiple channel with different frequencies.

2. How to set phase shift for multiple frequency case

My code and link of my measured signal for creating ePWM is below, 

void InitEPwmTimer()
{
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0; // Stop all the TB clocks
EDIS;

// Set 100khz square waveform for half bridge LLC converter

EPwm1Regs.TBPRD = PERIOD; // Set period for ePWM2
// EPwm1Regs.TBPHS.half.TBPHS = 0; // Set Phase register to zero
EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Up-down-count mode and start
EPwm1Regs.TBCTL.bit.PHSEN = 0; // Master pwm
EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW;
// EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN; // sync flow-through
EPwm1Regs.TBCTL.bit.SYNCOSEL = 1;
//EPwm1Regs.TBPHS = 0; // Set Phase register to zero
EPwm1Regs.TBCTR = 0;

EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // load on CTR=Zero
EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; // load on CTR=Zero
EPwm1Regs.AQCTLA.all = 0x0006; // set actions for EPWM2A (active high)

EPwm1Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE; // enable dead-band
EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC;
EPwm1Regs.DBCTL.bit.IN_MODE = DBA_ALL;
EPwm1Regs.DBRED = 26; // Register the desire dead-time between the high side and low side PWM
EPwm1Regs.DBFED = 26;

// Configs for 5 LED channel (using Time division multiplex)

EPwm4Regs.TBCTL.all = 0; // default status
EPwm4Regs.TBCTL.bit.CLKDIV = 0; // CLKDIV = 1
//EPwm4Regs.TBCTL.bit.HSPCLKDIV = 0; // HSPCLKDIV = 1
EPwm4Regs.TBCTL.bit.CTRMODE = 0; // up count mode

EPwm4Regs.AQCTLA.all = 0x0012; // ZRO = set, PRD = clear
EPwm4Regs.AQCTLB.all = 0x0120; // ZRO = set, PRD = clear
EPwm4Regs.TBPRD = PERIOD*10; // 40KHz - PWM signal
EPwm4Regs.CMPA.half.CMPA = EPwm4Regs.TBPRD/5; // 20% duty cycle first
EPwm4Regs.CMPB = EPwm4Regs.TBPRD*2/5;

EPwm4Regs.DBRED = 15; // Register the desire dead-time between the high side and low side PWM
EPwm4Regs.DBFED = 15;

EPwm5Regs.TBCTL.all = 0; // default status
EPwm5Regs.TBCTL.bit.CLKDIV = 0; // CLKDIV = 1
EPwm5Regs.TBCTL.bit.HSPCLKDIV = 0; // HSPCLKDIV = 1
EPwm5Regs.TBCTL.bit.CTRMODE = 0; // up  mode

EPwm5Regs.AQCTLA.all = 0x0012; // ZRO = set, PRD = clear
EPwm5Regs.AQCTLB.all = 0x0120; // ZRO = set, PRD = clear
EPwm5Regs.TBPRD = PERIOD*10; // 1KHz - PWM signal
EPwm5Regs.CMPA.half.CMPA = EPwm5Regs.TBPRD *1/5; // 20% duty cycle first
EPwm5Regs.CMPB = EPwm5Regs.TBPRD *2/5;

EPwm5Regs.DBRED = 15; // Register the desire dead-time between the high side and low side PWM
EPwm5Regs.DBFED = 15;

EPwm6Regs.TBCTL.all = 0; // default status
EPwm6Regs.TBCTL.bit.CLKDIV = 0; // CLKDIV = 1
EPwm6Regs.TBCTL.bit.HSPCLKDIV = 0; // HSPCLKDIV = 1
EPwm6Regs.TBCTL.bit.CTRMODE = 0; // up - down mode

EPwm6Regs.AQCTLA.all = 0x0012; // ZRO = set, PRD = clear
EPwm6Regs.TBPRD = PERIOD*10; // 40KHz - PWM signal
EPwm6Regs.CMPA.half.CMPA = 740; // 

//EPwm4Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE; // enable dead-band

//EPwm4Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC;
//EPwm4Regs.DBCTL.bit.IN_MODE = DBA_ALL;
EPwm6Regs.DBRED = 15; // Register the desire dead-time between the high side and low side PWM
EPwm6Regs.DBFED = 15;


EPwm4Regs.TBCTL.bit.PHSEN = 0;
EPwm4Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO;

EPwm5Regs.TBCTL.bit.PHSEN = 1; // enable phase shift for ePWM2
//EPwm5Regs.TBCTL.bit.SYNCOSEL = 1; // syncin = syncout
EPwm5Regs.TBPHS.half.TBPHS = EPwm5Regs.TBPRD*3/5; // 1/3 phase shift

EPwm6Regs.TBCTL.bit.PHSEN = 1; // enable phase shift for ePWM2
//EPwm5Regs.TBCTL.bit.SYNCOSEL = 1; // syncin = syncout
EPwm6Regs.TBPHS.half.TBPHS = 740; // 1/3 phase shift

EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1; // Start all the timers synced
EDIS;
}

Video of measured waveforms

www.youtube.com/edit

The green signal is the primary side waveform

The blue one is the 40 khz TDM mosfet waveforms

Thanks you for your supports

  • Hi,

    The key question I'd ask is, "what does synchronization mean in your system?". 

    It appears your C2000 will be controlling an LLC resonant converter at around 100kHz.  My guess is that it you'll vary the frequency some based on the amount of load (to keep the voltage/current output constant).

    Your LEDs are controlled at 40kHz.

    Assuming I understand correctly, then I do NOT believe the idea of synchronization really makes sense, with respect to the LLC stage and the LED stages. The control of this may require some thoughts about timing, but the PWM themselves would be synchronized.

    ===

    If instead all you're looking to do is synchronize ePWM4 to ePWM1, please note that you are setting up ePWM4 to be its own synchronization master.  ePWM4 should have its PHSEN set to 1 and SYNCOSEL set to TB_SYNC_IN - so that PWM1 can affect ePWM4.


    Thank you,
    Brett