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.

CCS: pwm phase shift with launchpad f280049c



Tool/software: Code Composer Studio

Hi Ti Community, 

i use f280049C launchpad
i have a question, in my program from creating the PWM signal, i have 4 signals ( ePWM1 to ePWM4), they are shifted with each other. but i always get an inverted signal at each PWM signal for example ePWM 1A and ePWM1B, both are supposed to have the same action, i've tried to get it before but doesn't work, und how can i creat a phase shift between ePWM1A and ePWM1B ? can anyone help me ?

Best Reagrds

  • The code I will provide you is for a similar C28x device and should work for F28004x. Take a look at the example below:

    http://dev.ti.com/tirex/explore/node?node=ANQtAx1d.2Tq4rBvalR55g__gYkahfz__LATEST

    Nima Eskandari

  • Hi Nima,

    i did my synchronization with exactly this example, and the shift between ePWM1 and ePWM2, but what i lack now is the shift between ePWM1A and ePWM1B with 180 degrees, i'm assuming it's about the SetAction and Duty-cycle function, but i don't know exactly how i can do it. 

    i use Mode Up Count

    here is my code:

    Best regards

    void initEPWM1_Configuration(void)
    {
    EPWM_setClockPrescaler(EPWM1_BASE,
    EPWM_CLOCK_DIVIDER_1,
    EPWM_HSCLOCK_DIVIDER_1);
    //
    EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP);
    EPWM_setTimeBaseCounter(EPWM1_BASE, 0);// count initial value setting
    EPWM_setTimeBasePeriod(EPWM1_BASE, EPWM_TIMER_TBPRD); //count cycle fs=300khz
    //
    EPWM_setPeriodLoadMode(EPWM1_BASE, EPWM_PERIOD_SHADOW_LOAD);// CYCLE LOADING MODE
    EPWM_setCounterCompareShadowLoadMode(EPWM1_BASE,
    EPWM_COUNTER_COMPARE_A,
    EPWM_COMP_LOAD_ON_CNTR_ZERO_PERIOD); // comparison value loading mode
    EPWM_setCounterCompareShadowLoadMode(EPWM1_BASE,
    EPWM_COUNTER_COMPARE_B,
    EPWM_COMP_LOAD_ON_CNTR_ZERO_PERIOD);
    //
    EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, Duty_cycle); //Set the comparison value
    EPWM_setCounterCompareValue(EPWM1_BASE,EPWM_COUNTER_COMPARE_B, Duty_cycle);
    //
    EPWM_setActionQualifierAction(EPWM1_BASE,
    EPWM_AQ_OUTPUT_A,
    EPWM_AQ_OUTPUT_LOW,
    EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA); //ePWMA
    //
    EPWM_setActionQualifierAction(EPWM1_BASE,
    EPWM_AQ_OUTPUT_A,
    EPWM_AQ_OUTPUT_HIGH,
    EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD);
    EPWM_setActionQualifierAction(EPWM1_BASE,
    EPWM_AQ_OUTPUT_B,
    EPWM_AQ_OUTPUT_LOW,
    EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA); //ePWMA
    //
    EPWM_setActionQualifierAction(EPWM1_BASE,
    EPWM_AQ_OUTPUT_B,
    EPWM_AQ_OUTPUT_HIGH,
    EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD);
    //
    EPWM_setSyncOutPulseMode(EPWM1_BASE, EPWM_SYNC_OUT_PULSE_ON_COUNTER_ZERO); //Synchronize pulse when counting to zero
    //
    EPWM_setRisingEdgeDeadBandDelayInput(EPWM1_BASE,EPWM_DB_INPUT_EPWMA);
    EPWM_setFallingEdgeDeadBandDelayInput(EPWM1_BASE, EPWM_DB_INPUT_EPWMA); //Configure dead zone input mode
    EPWM_setDeadBandDelayPolarity(EPWM1_BASE,EPWM_DB_RED,EPWM_DB_POLARITY_ACTIVE_HIGH);
    EPWM_setDeadBandDelayPolarity(EPWM1_BASE, EPWM_DB_FED, EPWM_DB_POLARITY_ACTIVE_HIGH); // configuration polarity
    EPWM_setDeadBandDelayMode(EPWM1_BASE,EPWM_DB_RED,true);
    EPWM_setDeadBandDelayMode(EPWM1_BASE, EPWM_DB_FED, true); //Configure output mode
    EPWM_setDeadBandOutputSwapMode(EPWM1_BASE,EPWM_DB_OUTPUT_A,false);
    EPWM_setDeadBandOutputSwapMode(EPWM1_BASE, EPWM_DB_OUTPUT_B, false); //Output is not exchanged
    //
    EPWM_setRisingEdgeDelayCount(EPWM1_BASE, Dead_Band_RED); //Rising edge delay 0nS
    EPWM_setFallingEdgeDelayCount(EPWM1_BASE, Dead_Band_FED); //falling edge delay 0nS
    }

  • If you want phase shift between EPWM1A and EPWM1B, you have to manually program the PWM to have this. For example use UP/DOWN mode, the for channel A, set high at 0 and set low at CMPA. For Channel B set high at PRD, and set low at CMPB. This ensures they are always PRD apart.

  • Hi Nima,

    Thank you, i got it for 180 degree shifting,  for the 90 degrees i need another setting oder event?

    Regards

    YT

  • For 90 degrees phase shift with the way you're implementing it, yes! you need to manually do the math and move your CMP values.