AnsweredAssumed Answered

Synchronous rectifier using SPC570S-DISP board

Question asked by Tran Hung on Oct 23, 2017
Latest reply on Oct 27, 2017 by Erwan Y

Hi ST experts!

 

I have worked on phase shift full-bridge converter projects. 

Recently, I get a trouble with synchronous rectifier PWM. The PWM duty, frequency, and deadtime parts work well, but they can't not shift properly. 

 

There is my code to configure PWM. 

- PWM0 is configured by Timer 3 channel 0 

 

ETIMER_3.CH[0].CNTR.R = pwmA.deadTime1;
ETIMER_3.CH[0].LOAD.R = 0U;//tung added

ETIMER_3.CH[0].CTRL1.B.CNTMODE = 1U; /* count rising edge of primary source */
ETIMER_3.CH[0].CTRL1.B.PRISRC = 0x18U; /* primary count source = IP bus clock/2 */
ETIMER_3.CH[0].CTRL1.B.ONCE = 0U; /* count repeatedly */
ETIMER_3.CH[0].CTRL1.B.LENGTH = 1U; /* count until compare and reinitialize */
ETIMER_3.CH[0].CTRL1.B.DIR = 0U; /* count up */
ETIMER_3.CH[0].CTRL2.B.OEN = 1U; /* output enable */
ETIMER_3.CH[0].CTRL2.B.RDNT = 0U; /* disable redundant channel */
ETIMER_3.CH[0].CTRL2.B.OPS = 0U; /* Inverted polarity */

ETIMER_3.CH[0].CTRL2.B.OUTMODE = 4U; /* Set on COMP1, clear on COMP2 */
ETIMER_3.CH[0].CTRL3.B.STPEN = 1U; /* output disabled in stop mode */
ETIMER_3.CH[0].CTRL3.B.DBGEN = 1U;
ETIMER_3.CH[0].CCCTRL.B.CMPMODE = 0U;
ETIMER_3.CH[0].CCCTRL.B.CLC2 = 5U; /* load CNTR with CMPLD2 on COMP2 match */
ETIMER_3.CH[0].CMPLD2.R = (pwmA.duty-pwmA.deadTime1);
ETIMER_3.CH[0].COMP1.R = (pwmA.period - (pwmA.duty-pwmA.deadTime1));
ETIMER_3.CH[0].COMP2.R = (pwmA.duty-pwmA.deadTime1);
ETIMER_3.CH[0].CCCTRL.B.CLC1 = 2U; /* load COMP1 with CMPLD1 on COMP2 match */
ETIMER_3.CH[0].CMPLD1.R = (pwmA.period - (pwmA.duty-pwmA.deadTime1));

 

 

- PWM2 (rectifier pwm)is configured by Timer 3 channel 2

ETIMER_3.CH[2].CNTR.R = pwmA.deadTime1;
ETIMER_3.CH[2].LOAD.R = 0U;//tung added

ETIMER_3.CH[2].CTRL1.B.CNTMODE = 1U; /* count rising edge of primary source */
ETIMER_3.CH[2].CTRL1.B.PRISRC = 0x18U; /* primary count source = IP bus clock/2 */
ETIMER_3.CH[2].CTRL1.B.ONCE = 0U; /* count repeatedly */
ETIMER_3.CH[2].CTRL1.B.LENGTH = 1U; /* count until compare and reinitialize */
ETIMER_3.CH[2].CTRL1.B.DIR = 0U; /* count up */
ETIMER_3.CH[2].CTRL2.B.OEN = 1U; /* output enable */
ETIMER_3.CH[2].CTRL2.B.RDNT = 0U; /* disable redundant channel */
ETIMER_3.CH[2].CTRL2.B.OPS = 0U; /* Inverted polarity */

ETIMER_3.CH[2].CTRL2.B.OUTMODE = 4U; /* Set on COMP1, clear on COMP2 */
ETIMER_3.CH[2].CTRL3.B.STPEN = 1U; /* output disabled in stop mode */
ETIMER_3.CH[2].CTRL3.B.DBGEN = 1U;
ETIMER_3.CH[2].CCCTRL.B.CMPMODE = 0U;
ETIMER_3.CH[2].CCCTRL.B.CLC2 = 5U; /* load CNTR with CMPLD2 on COMP2 match */
ETIMER_3.CH[2].CMPLD2.R = (pwmA.duty-pwmA.deadTime1);
ETIMER_3.CH[2].COMP1.R = (pwmA.period - (pwmA.duty-pwmA.deadTime1));
ETIMER_3.CH[2].COMP2.R = (pwmA.duty-pwmA.deadTime1);
ETIMER_3.CH[2].CCCTRL.B.CLC1 = 2U; /* load COMP1 with CMPLD1 on COMP2 match */
ETIMER_3.CH[2].CMPLD1.R = (pwmA.period - (pwmA.duty-pwmA.deadTime1));

 

- To shift PWM 2 from PWM 0, I use a Timer interrupt. The  shift value is updated in interrupt function like this

 

void SPC5_ETIMER3_TC2IR_HANDLER(void)
{
shift = pwmB.phaseShift - pwmB.phaseShiftActive;
pwmB.phaseShiftActive = pwmB.phaseShift;

ETIMER_3.CH[2].CMPLD1.R = (pwmB.period-1) + shift;

ETIMER_3.CH[2].STS.R = 0x3FFU; /* clear interrupt flag */

}

 

=> How I can configure PWM to create phase shift for 1 or multiple channels by SPC570S-DISP?

 

Thank you so much.

https://drive.google.com/open?id=0B3tbtuzuEA6Ia3dJaXMwR28wZ1k

Outcomes