Phase-shift PWM in MC56F82748

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Phase-shift PWM in MC56F82748

1,274 Views
engineer12
Contributor II

Hello community,

I recently started a project for a control system design of a Phase-shift full bridge DC-DC converter. I found an example code of the phase-shift PWM, but I do not understand how the phase shift operates in the code and how you can control it.

Could you please give me a hint how to control the phase-shift?

Thank you in advance.

P.S. I am a newbie to that stuff, please don't be harsh to me

7 Replies

637 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Ivan,

Regarding your question how the phase-shift funmction of PWM is implemented, this is the basic theory.

As you know that the eFlexPWM module has 4 sub-module: SM0, SM1, SM2 and SM3, each sub-module SMn can generates two PWM signal:PWM_SMnA and PWM_SMnB, the two signals PWM_SMnA and PWM_SMnB can be independent or complementary with deadtime insertion.

The PWM sub-module works independently, from theory, each PWM sub-module is a counter, it can count tick from PWMA_SMnINIT to PWMA_SMnVAL1, then  from PWMA_SMnINIT to PWMA_SMnVAL1 repeatedly. When the counter reach up to PWMA_SMnVAL3, PWM_SMnA signal becomes High logic, when the counter reach up to PWMA_SMnVAL4, PWM_SMnA signal becomes Low logic, so that the PWM cycle time is PWMA_SMnVAL1-PWMA_SMnINIT. The PWM duty cycle time is PWMA_SMnVAL4-PWMA_SMnVAL3.

If you want to implement phase-shift feature while the SMn works in complementary mode, as the example, you can use SM0 and SM1, of course, the SM0 and SM1 module must be synchronized by setting the PWMA_SM0CTRL2[INIT_SEL]=00,PWMA_SM1CTRL2[INIT_SEL]=10.

This is the register setting for the the SM0 and SM1:

PWMA_SM0INIT=PWMA_SM1INIT=-2000;

PWMA_SM0VAL1=PWMA_SM1VAL1=2000; //the duty cycle=4000 tick

SM0:

PWMA_SM0VAL3=-2000;

PWMA_SM0VAL4=0; //the PWMA_SM0A duty cycle is 2000/4000=50%

The SM0 register setting is fixed.

SM1:

PWMA_SM1VAL3=-2000;

PWMA_SM1VAL4=0; //the PWMA_SM0A duty cycle is 2000/4000=50%

Result: the PWMA_SM1A and PWMA_SM0A signal are the same

PWMA_SM1VAL3=-1000;

PWMA_SM1VAL4=-1000+2000=1000; //the PWMA_SM0A duty cycle is 2000/4000=50%

Result: the PWMA_SM1A lag behind PWMA_SM0A signal 90 degree

PWMA_SM1VAL3=0;

PWMA_SM1VAL4=0+2000=2000; //the PWMA_SM0A duty cycle is 2000/4000=50%

Result: the PWMA_SM1A lag behind PWMA_SM0A signal 180 degree, in other words, they are inverter.

This is the code to update the phase shift in reload ISR.

Hope it can help you

BR

Xiangjun rong

void PWMA_0_Reload_ISR(void)
{
    PWMA_REGS_ALL *ptr = &udtPWMAreg;
    //GPIOE_DR &= ~GPIOE_DR_D_3;
    setReg16Bits(PWMA_SM0STS,0x1000);    /* Clear interrupt request flag */
    invertReg16Bits(GPIOF_DR,0x040);    /* Toggle GPIOF6 output LED8 */

    ptr->SM1.pwmsmval2 = (Word16)ptr->SM1.pwmsmval2 + 2;
    if((Word16)ptr->SM1.pwmsmval2>=0) //ptr->SM1.pwmsmval1)
        {
        ptr->SM1.pwmsmval2 = -2000; //ptr->SM1.pwmsminit;
        }
    ptr->SM1.pwmsmval3 = (Word16)ptr->SM1.pwmsmval2 + 2000;

    phase = (ptr->SM1.pwmsmval2  - ptr->SM0.pwmsmval2);
    FMSTR_Recorder();
    PWM_A_Update(&udtPWMAreg);
}

637 Views
engineer12
Contributor II

Hello Xiangjun,

Thank you for replying to my question.

Unfortunately, the suggested changes didn't work for me, probably because I was not able to change the PWMA_SM0CTRL2[INIT_SEL]=00,PWMA_SM1CTRL2[INIT_SEL]=10 , as they are 0xE602 and 0xE632 accordingly. In addition when I did the changes you mentioned, I lost the SM1 PWM responses as well as the SM0 response was not as sharp as in the example code.

Could you please give me a hint how to change the SMnCTRL2 values? Also, do you mean by changing the values of VAL3&4 of SM1 we control the phase shift?

Thank you in advance.

Kind regards,

Ivan

0 Kudos

637 Views
mohammad_kamil
NXP Employee
NXP Employee

Hello engineer12, Xiangjun as already explained about the code how it is been implemented. I will just give you the background of Phase shift full bridge converter.

Phase shift Full bridge converter is generally used for high power high voltage application to reduce the switching losses by achieving zero voltage switching of its MOSFET. zero voltage switching is achieve by using parasitic inductance transformer and parasitic capacitance of MOSFETs. 

To implement these, we need to two pair of PWM operated in fix 50% duty cycle in complementary mode. and phase difference between these two pair defined the duty cycle of converter. 

Feel free to contact should you need more insight of phase shift full bridge converter and its implementation. 

With Regards

Kamil

0 Kudos

637 Views
engineer12
Contributor II

Hello Kamil,

Thank you for explaining the operation of the phase shift full bridge converter.

Looking at the Xiangjun code it seems that the phase shift is achieved by varying the frequency of the SM1. As far as I understand, the frequency and the duty cycle should be fixed. How can I control the phase shift between SM0 and SM1?

Thank you in advance.

Kind regards,

Ivan

0 Kudos

637 Views
mohammad_kamil
NXP Employee
NXP Employee

Hello Ivan,

Phase shift can be implemented in various way, as we dont have hardware implementation and it has to be software. One of the simplest way could be you fix both SM0 and SM1 PWMs as fix frequency and fix 50% duty with complementary mode. 

E.g Period value = 1000

Period/2 = 500 (50% duty cycle)

SM0_VALinit = 0

SM0_VAL1 = Period value 

SM0_VAL2 = 0

SM0_VAL3 = Period value/2 (500) , 50% duty cycle

SM1_VALinit = 0

SM1_VAL1 = Period value 

SM1_VAL2 = 0

SM1_VAL3 = Period value/2 (500)  , 50% duty cycle

This will produce 0% duty cycle 

let say if you want to have effective duty of 50% duty cycle with means phase difference between SM0 and SM1 should be 1000/4 = 250 (phase)

then you need just change value of SM1_VAL2 and SM1_VAL3

SM1_VAL2 = 250

SM1_VAL3 = 250 (phase)  + Period value/2 (500) = 750

With Regards

Kamil

 

0 Kudos

637 Views
mohammad_kamil
NXP Employee
NXP Employee

here is the attachment 

0 Kudos

637 Views
mohammad_kamil
NXP Employee
NXP Employee

Hello Ivan,

No problem, this code example has been created by my team. We will explain you in details.

With Regards

Kamil

0 Kudos