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.

TMS320F2800137: EPWM TBCTR higher then TBPRD

Part Number: TMS320F2800137

Hi,

Im working with 2 channels of EPWM, with sync between them.
When Im settiing EPWM1 in higher speed (lower TBPRD) I set his sync in pulse according to EPWM3 lower speed (higher TBPRD) and vice versa.

its working well at the beginning, after toggling (EPWM 3 is higher speed and EPWM1 slower) and when toggling back (EPWM1 is higher speed and EPWM3 slower) I got problem:

TBCTR(3056) is >> then TBPRD (600) ; PROBLEM SOLVED AFTER I RESET 

ANOTHER PIC REGISTER EPWM1 WORKING WELL:

ERROR: 



Reset PHSEN from 1 to 0 and back to 1 solve the problem:



Code that transient  : 

        EPWM_enablePhaseShiftLoad (EPWM1);
        EPWM_setSyncInPulseSource(EPWM1, EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM3);
        EPWM_setPhaseShift(EPWM1, (2U * TBPRD) - 30U );
        EPWM_setSyncInPulseSource(EPWM3, EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM3);


Thanks!

  • Hi Michael,

    To clarify, you are changing the TBPRD of EPWM1 and EPWM3 during runtime? If so, it is likely you could change your TBPRD to be below the current value of the counter, or have a TBPHS value that is greater than TBPRD at the time of a sync pulse. If TBCTR exceeds TBPRD, it will keep counting upwards until the TBCTR overflows.

    You will need to be very careful about when you change your TBPRD value to avoid this scenario. You can also set TBCTR to 0 in software to help prevent this.

    Could you provide more information on when your TBPRD is being updated for EPWM1 and EPWM3, when your sync pulses are occurring, and what values are being used for TBPHS?