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: Phase shift ePWMA and ePWMB

Tool/software: Code Composer Studio

Hi Ti Community,

i use a launchpad f280049c and i try a 90 degree shift within a module of ePWM1A/B, i have worked with up-down mode, here in the appendix is the 180 degree shift, but need 90 degrees, someone can help me?

// Set-up compare
EPWM_setCounterCompareValue(base, EPWM_COUNTER_COMPARE_A, 800U); // need Duty-cycle of 20% 
EPWM_setCounterCompareValue(base, EPWM_COUNTER_COMPARE_B, (EPWM_TIMER_TBPRD-800U)); // need Duty-cycle of 20%

// Set actions
EPWM_setActionQualifierAction(base,
EPWM_AQ_OUTPUT_A,
EPWM_AQ_OUTPUT_HIGH,
EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);

EPWM_setActionQualifierAction(base,
EPWM_AQ_OUTPUT_A,
EPWM_AQ_OUTPUT_LOW,
EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);

EPWM_setActionQualifierAction(base,
EPWM_AQ_OUTPUT_B,
EPWM_AQ_OUTPUT_HIGH,
EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD);

EPWM_setActionQualifierAction(base,
EPWM_AQ_OUTPUT_B,
EPWM_AQ_OUTPUT_LOW,
EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPB);

Regards

YT

  • Hi,

    What exactly is the question? Are you having any issues in generating the phase shift you wanted?
    what is the issue and your observation?

    Also, is this related to https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/832090 

  • Hi,

    Were you able to resolve the phase shift you wanted in your application?
    If there is any specific issues are questions please feel free to pose here or in the other thread mentioned above.
    For now, we can close the thread and open it if there is any further questions.

  • Hi,

    I've managed almost all phase shifts, but there's only one thing missing, for example the two submodules ePWM4A and 4B are shifted to each other with 180 degrees. and the module ePWM5 is in phase with ePWM4A, the problem is here with ePWM4B and ePWM6, they are also in phase, but when I measure ePWM6, I get the signal up to 1.6Volt then from 1.6Vol to 3Volt I get no more signal. I assume that the maximum duty cycle is 50% at 3.3 Volts.

    Regards

    void initEPWM4_Configuration(void) 

    EPWM_setClockPrescaler(EPWM4_BASE,
    EPWM_CLOCK_DIVIDER_1,
    EPWM_HSCLOCK_DIVIDER_1);
    EPWM_setTimeBaseCounterMode (EPWM4_BASE, EPWM_COUNTER_MODE_UP_DOWN);
    EPWM_setTimeBaseCounter(EPWM4_BASE,0);
    EPWM_setTimeBasePeriod(EPWM4_BASE,EPWM_TIMER_TBPRD);
    //
    EPWM_setPeriodLoadMode (EPWM4_BASE, EPWM_PERIOD_SHADOW_LOAD);
    EPWM_setCounterCompareShadowLoadMode(EPWM4_BASE,
    EPWM_COUNTER_COMPARE_A,
    EPWM_COMP_LOAD_ON_CNTR_ZERO);
    EPWM_setCounterCompareValue(EPWM4_BASE, EPWM_COUNTER_COMPARE_A, EPWM_TIMER_TBPRD/5);
    EPWM_setCounterCompareValue(EPWM4_BASE, EPWM_COUNTER_COMPARE_B, (EPWM_TIMER_TBPRD-(EPWM_TIMER_TBPRD/5)));
    // Set actions
    EPWM_setActionQualifierAction(EPWM4_BASE,
    EPWM_AQ_OUTPUT_A,
    EPWM_AQ_OUTPUT_HIGH,
    EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
    EPWM_setActionQualifierAction(EPWM4_BASE,
    EPWM_AQ_OUTPUT_A,
    EPWM_AQ_OUTPUT_LOW,
    EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
    EPWM_setActionQualifierAction(EPWM4_BASE,
    EPWM_AQ_OUTPUT_B,
    EPWM_AQ_OUTPUT_HIGH,
    EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD);
    EPWM_setActionQualifierAction(EPWM4_BASE,
    EPWM_AQ_OUTPUT_B,
    EPWM_AQ_OUTPUT_LOW,
    EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPB);
    // Phasenverschiebung
    EPWM_enablePhaseShiftLoad(EPWM4_BASE);
    SysCtl_setSyncInputConfig(SYSCTL_SYNC_IN_EPWM4, SYSCTL_SYNC_IN_SRC_EPWM1SYNCOUT);
    EPWM_setPhaseShift(EPWM4_BASE, EPWM_TIMER_TBPRD/2);
    //Dead Band
    EPWM_setRisingEdgeDeadBandDelayInput(EPWM4_BASE,EPWM_DB_INPUT_EPWMA);
    EPWM_setFallingEdgeDeadBandDelayInput(EPWM4_BASE, EPWM_DB_INPUT_EPWMB);
    EPWM_setDeadBandDelayPolarity(EPWM4_BASE,EPWM_DB_RED,EPWM_DB_POLARITY_ACTIVE_HIGH);
    EPWM_setDeadBandDelayPolarity(EPWM4_BASE, EPWM_DB_FED, EPWM_DB_POLARITY_ACTIVE_HIGH);
    EPWM_setDeadBandDelayMode(EPWM4_BASE,EPWM_DB_RED,true);
    EPWM_setDeadBandDelayMode(EPWM4_BASE, EPWM_DB_FED, true);
    EPWM_setDeadBandOutputSwapMode(EPWM4_BASE,EPWM_DB_OUTPUT_A,false);
    EPWM_setDeadBandOutputSwapMode(EPWM4_BASE, EPWM_DB_OUTPUT_B, false);
    EPWM_setRisingEdgeDelayCount(EPWM4_BASE, Dead_Band_RED);
    EPWM_setFallingEdgeDelayCount(EPWM4_BASE, Dead_Band_FED);
    }

    void initEPWM6_Configuration(void) 
    {
    EPWM_setClockPrescaler(EPWM6_BASE,
    EPWM_CLOCK_DIVIDER_1,
    EPWM_HSCLOCK_DIVIDER_1);
    EPWM_setTimeBaseCounterMode (EPWM6_BASE, EPWM_COUNTER_MODE_UP_DOWN);
    EPWM_setTimeBaseCounter(EPWM6_BASE,0);
    EPWM_setTimeBasePeriod(EPWM6_BASE,EPWM_TIMER_TBPRD);
    EPWM_setPeriodLoadMode (EPWM6_BASE, EPWM_PERIOD_SHADOW_LOAD);
    EPWM_setCounterCompareShadowLoadMode(EPWM6_BASE,
    EPWM_COUNTER_COMPARE_A,
    EPWM_COMP_LOAD_ON_CNTR_ZERO);
    EPWM_setCounterCompareValue(EPWM6_BASE, EPWM_COUNTER_COMPARE_A, EPWM_TIMER_TBPRD/5);
    EPWM_setCounterCompareValue(EPWM6_BASE, EPWM_COUNTER_COMPARE_B, (EPWM_TIMER_TBPRD-(EPWM_TIMER_TBPRD/5)));
    // Set actions
    EPWM_setActionQualifierAction(EPWM6_BASE,
    EPWM_AQ_OUTPUT_A,
    EPWM_AQ_OUTPUT_HIGH,
    EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
    EPWM_setActionQualifierAction(EPWM6_BASE,
    EPWM_AQ_OUTPUT_A,
    EPWM_AQ_OUTPUT_LOW,
    EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
    EPWM_setActionQualifierAction(EPWM6_BASE,
    EPWM_AQ_OUTPUT_B,
    EPWM_AQ_OUTPUT_LOW,
    EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD);
    EPWM_setActionQualifierAction(EPWM6_BASE,
    EPWM_AQ_OUTPUT_B,
    EPWM_AQ_OUTPUT_HIGH,
    EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPB);
    //
    EPWM_enablePhaseShiftLoad(EPWM6_BASE); //Enable phase register
    EPWM_setSyncOutPulseMode(EPWM6_BASE, EPWM_SYNC_OUT_PULSE_ON_EPWMxSYNCIN);
    EPWM_setPhaseShift(EPWM6_BASE, 3*EPWM_TIMER_TBPRD/2);
    //Dead Band
    EPWM_setRisingEdgeDeadBandDelayInput(EPWM6_BASE,EPWM_DB_INPUT_EPWMA);
    EPWM_setFallingEdgeDeadBandDelayInput(EPWM6_BASE, EPWM_DB_INPUT_EPWMA);
    EPWM_setDeadBandDelayPolarity(EPWM6_BASE,EPWM_DB_RED,EPWM_DB_POLARITY_ACTIVE_HIGH);
    EPWM_setDeadBandDelayPolarity(EPWM6_BASE, EPWM_DB_FED, EPWM_DB_POLARITY_ACTIVE_LOW);
    EPWM_setDeadBandDelayMode(EPWM6_BASE,EPWM_DB_RED,true);
    EPWM_setDeadBandDelayMode(EPWM6_BASE, EPWM_DB_FED, true);
    EPWM_setDeadBandOutputSwapMode(EPWM6_BASE,EPWM_DB_OUTPUT_A,false);
    EPWM_setDeadBandOutputSwapMode(EPWM6_BASE, EPWM_DB_OUTPUT_B, false);
    EPWM_setRisingEdgeDelayCount(EPWM6_BASE, Dead_Band_RED);
    EPWM_setFallingEdgeDelayCount(EPWM6_BASE, Dead_Band_FED);
    }

  • Hi,

    I presume you are measuring the signal at the output of the MCU.
    No configuration of the PWM should limit the signal swing to 1.6v. This just can not be a configuration problem.
    I suspect, there may be some conflicting drivers on the pin or some issue with IO configuration.

  • Hi,

    i have already tried to change the phase shift and i did not get this problem anymore, but what i need is exactly this shift of 3*TBPRD/2 with ePWM6. the module ePWM6 must be set to ePWM4B with 180° and to ePWM1 with 90°. i.e. a total shift of 270°.

  • Hi,

    Changing the phase shift should not cause any drop in the signal swing.
    But it must be something to do with conflicting drivers in the hardware.
    Please check the hardware, i do not suspect PWM configuration issue here.

  • Hi,

    Were you able to resolve the issue?
    If you have specific question, feel free to post here or a new thread.