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.

TMS320F28379D: Synchronisation of pwm

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hi Sir/madam,

I am using below example for acheving phase shift to pwm1,pwm2,pwm3,pwm4

C:\ti\c2000\C2000Ware_6_00_01_00\driverlib\f2837xd\examples\cpu1\epwm\epwm_ex3_synchronization

But when I change the sequence for phase shift pwm2 ,pwm3,pwm4,pwm1 I am not getting the phase shift. Is there any way to this?

Thanks and Regards,

Prashant Gugle

  • Hello Prashant

    Can you give more detail of the issue? What changes do you make to change the phase sequence? Please make sure you are giving the synchronization input across the PWM modules.

    Thank you 

    Amir Hussain

  • Hi Amir,

    Thanks for your reply.

    To change the phase sequence, I am doing following things,

       
     
        SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);

        //
        // Initialize PWM2 without phase shift as master
        //
        initEPWM(myEPWM2_BASE);  

        //
        // Initialize PWM3 with phase shift of 150 TBCLKs
        //
        initEPWM(myEPWM3_BASE);      
        EPWM_selectPeriodLoadEvent(myEPWM3_BASE, EPWM_SHADOW_LOAD_MODE_SYNC);
        EPWM_setPhaseShift(myEPWM3_BASE, 150);   
        EPWM_setTimeBaseCounter(myEPWM3_BASE, 150);

        //
        // Initialize PWM3 with phase shift of 600 TBCLKs
        //
        initEPWM(myEPWM4_BASE);  
        EPWM_selectPeriodLoadEvent(myEPWM4_BASE, EPWM_SHADOW_LOAD_MODE_SYNC);
        EPWM_setPhaseShift(myEPWM4_BASE, 300); 
        EPWM_setTimeBaseCounter(myEPWM4_BASE, 300);

        //
        // Initialize PWM4 with phase shift of 450 TBCLKs
        //
        initEPWM(myEPWM1_BASE);  
        EPWM_selectPeriodLoadEvent(myEPWM1_BASE, EPWM_SHADOW_LOAD_MODE_SYNC);
        EPWM_setPhaseShift(myEPWM1_BASE, 450);
        EPWM_setTimeBaseCounter(myEPWM1_BASE, 450);

        //
        // ePWM2 SYNCO is generated on CTR=0
        //
        EPWM_setSyncOutPulseMode(EPWM2_BASE, EPWM_SYNC_OUT_PULSE_ON_COUNTER_ZERO);

        //
        // ePWM3 uses the ePWM2 SYNCO as its SYNCIN.
        // ePWM3 SYNCO is generated from its SYNCIN, which is ePWM2 SYNCO
        //
        EPWM_setSyncOutPulseMode(myEPWM3_BASE, EPWM_SYNC_OUT_PULSE_ON_EPWMxSYNCIN);
     

       EPWM_setSyncOutPulseMode(myEPWM4_BASE, EPWM_SYNC_OUT_PULSE_ON_EPWMxSYNCIN);
       
     
        //
        // ePWM4 uses the ePWM 2 SYNCO as its SYNCIN.
        //
       //SysCtl_setSyncInputConfig(SYSCTL_SYNC_IN_EPWM4, SYSCTL_SYNC_IN_SRC_EPWM1SYNCOUT);
        //
        // Enable all phase shifts.
        //
        EPWM_enablePhaseShiftLoad(myEPWM1_BASE);
        EPWM_enablePhaseShiftLoad(myEPWM3_BASE);
        EPWM_enablePhaseShiftLoad(myEPWM4_BASE);

        //
        // Enable sync and clock to PWM
        //
        SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);

    Thanks and Regards,

    Prashant Gugle

  • Dear Amir,

    Any replies on this?

  • Dear Sir/Madam,

    There is no EPWM_setSyncInPulseSource for selecting sync input source. Then how to synchrnise PWMs?

    Thanks and Regards,

    Prashant Gugle

  • Hi Prashant

    If you are inputting the syncin pulse source from an epwm module, it has to be in a chain. That means you can give syncin pulse to EPWM2 from only EPWM1, and so on. For more detail, please see page 1913 for the manual.

    Thank you 

    Amir Hussain

  • Dear Amir,

    Does it mean that we cannot change the sequence. We need PWM1,PWM2,PWM3,PWM4 as the first sequence for one line cycle. Next line cycle PWM2,PWM3,PWM4,PWM1.  In next lime cycle PWM3,PWM4,PWM1,PWM2. In next cycle PWM4,PWM1,PWM2,PWM3. This sequence will continue.

    Thanks and Regards,

    Prashant Gugle

  • Dear Amir,

    In TMS320F28P65x, any PWM SYNCOUT can be SYNCIN  to any PWM. So the above rotating PWM sequence is possible?

    Thanks and Regards,

    Prashant Gugle

  • Hello Prashant

    Yes, For F28P65x, you sync an EPWM module with any EPWM. It does not have to follow any sequence.

    Thank you 

    Amir Hussain