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/TMS320F280049C: Set Phase shift while running

Part Number: TMS320F280049C

Tool/software: Code Composer Studio

Hello,

I have a problem with setting the phase shift.

If I set it during the initialization it is working fine:

    EPWM_disablePhaseShiftLoad(VIENNA1_DRV_EPWM_BASE);
    EPWM_setSyncOutPulseMode(VIENNA1_DRV_EPWM_BASE, EPWM_SYNC_OUT_PULSE_ON_COUNTER_ZERO);

    EPWM_enablePhaseShiftLoad(VIENNA2_DRV_EPWM_BASE);
    EPWM_setSyncOutPulseMode(VIENNA2_DRV_EPWM_BASE,EPWM_SYNC_OUT_PULSE_ON_COUNTER_ZERO);
    EPWM_setCountModeAfterSync(VIENNA2_DRV_EPWM_BASE, EPWM_COUNT_MODE_UP_AFTER_SYNC);

    //Set phaseshift. The maximum count is: VIENNA_EPWM_SWITCHING_PERIOD (5000ticks)

    EPWM_setPhaseShift(VIENNA2_DRV_EPWM_BASE, 2000);

but... if I set it while running the program, from a variable, then the value is written in the register but not updated to the output:

uint16_t PSFB_shift = 2000;

The PWM configuration is as follows:

    EPWM_setClockPrescaler(PWMbase,VIENNA_EPWM_EPWMCLK_DIV, VIENNA_EPWM_HSCLK_DIV);
    EPWM_setEmulationMode(PWMbase, EPWM_EMULATION_FREE_RUN);
    //
    // Configure ePWM for count-up operation
    //
    EPWM_setTimeBaseCounter(PWMbase, 0);
    EPWM_setTimeBasePeriod(PWMbase, VIENNA_EPWM_TBPRD);
    EPWM_setPeriodLoadMode(PWMbase, EPWM_PERIOD_SHADOW_LOAD);
    EPWM_selectPeriodLoadEvent(PWMbase, EPWM_SHADOW_LOAD_MODE_COUNTER_ZERO);
    EPWM_setTimeBaseCounterMode(PWMbase, EPWM_COUNTER_MODE_UP);
    EPWM_setPhaseShift(PWMbase,0);

Can anyone help me, please?

Thank you very much.

BR,

Luis