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.

TMS320F280049C: EPWM not started without sync in pulse

Part Number: TMS320F280049C


Hi,

I am using 4 epwm that are synced by an external pulse on SYNCI.

My question are:

1) Why the epwms need a SYNCI pulse to start counting? I was expecting them to be unsynchronized until a SYNCI signal is present, not to be kind of disabled.

2) And why do they continue working when there is no more pulse on SYNCI? If they need a SYNCI pulse to start counting, why do they continue counting when there is no SYNCI pulse anymore?

Thanks,

Sebastien

  • EPWMs are not dependent on SYNCI to start. What is your ePWM setting?

  • Hi,

    Thank you for your answer, the first ePWM setting is like below (the 3 others are the same except for the phase shift value):

        EPWM_setClockPrescaler(myEPWM1_BASE, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1);
        EPWM_setTimeBasePeriod(myEPWM1_BASE, 1000);
        EPWM_setTimeBaseCounterMode(myEPWM1_BASE, EPWM_COUNTER_MODE_UP);
        EPWM_setTimeBaseCounter(myEPWM1_BASE, 0);
        EPWM_selectPeriodLoadEvent(base, EPWM_SHADOW_LOAD_MODE_SYNC);
        EPWM_setPhaseShift(myEPWM1_BASE, 0);
        EPWM_enablePhaseShiftLoad(myEPWM1_BASE);


        EPWM_setCounterCompareValue(myEPWM1_BASE, EPWM_COUNTER_COMPARE_A, 500);
        EPWM_setCounterCompareShadowLoadMode(myEPWM1_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO);
        EPWM_setCounterCompareValue(myEPWM1_BASE, EPWM_COUNTER_COMPARE_B, 0);
        EPWM_setCounterCompareShadowLoadMode(myEPWM1_BASE, EPWM_COUNTER_COMPARE_B, EPWM_COMP_LOAD_ON_CNTR_ZERO);

    EPWM_setActionQualifierAction(myEPWM1_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH,            EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
        EPWM_setActionQualifierAction(myEPWM1_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD);
        EPWM_setActionQualifierAction(myEPWM1_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
        EPWM_setActionQualifierAction(myEPWM1_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);
        EPWM_setActionQualifierAction(myEPWM1_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
        EPWM_setActionQualifierAction(myEPWM1_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPB);
        EPWM_setActionQualifierAction(myEPWM1_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
        EPWM_setActionQualifierAction(myEPWM1_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD);
        EPWM_setActionQualifierAction(myEPWM1_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
        EPWM_setActionQualifierAction(myEPWM1_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA);
        EPWM_setActionQualifierAction(myEPWM1_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
        EPWM_setActionQualifierAction(myEPWM1_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPB);

        EPWM_setDeadBandDelayPolarity(myEPWM1_BASE, EPWM_DB_FED, EPWM_DB_POLARITY_ACTIVE_LOW);
        EPWM_setDeadBandDelayMode(myEPWM1_BASE, EPWM_DB_RED, true);
        EPWM_setRisingEdgeDelayCount(myEPWM1_BASE, BUCK_DFLT_EPWM_RED_TICKS);
        EPWM_enableRisingEdgeDelayCountShadowLoadMode(myEPWM1_BASE);
        EPWM_setRisingEdgeDelayCountShadowLoadMode(myEPWM1_BASE, EPWM_RED_LOAD_ON_CNTR_ZERO);
        EPWM_setDeadBandDelayMode(myEPWM1_BASE, EPWM_DB_FED, true);
        EPWM_setFallingEdgeDelayCount(myEPWM1_BASE, BUCK_DFLT_EPWM_FED_TICKS);
        EPWM_enableFallingEdgeDelayCountShadowLoadMode(myEPWM1_BASE);
        EPWM_setFallingEdgeDelayCountShadowLoadMode(myEPWM1_BASE, EPWM_FED_LOAD_ON_CNTR_ZERO);

        //Used by ADC and FSI/DMA
        EPWM_enableADCTrigger(myEPWM1_BASE, EPWM_SOC_A);
        EPWM_setADCTriggerSource(myEPWM1_BASE, EPWM_SOC_A, EPWM_SOC_TBCTR_ZERO);
        EPWM_setADCTriggerEventPrescale(myEPWM1_BASE, EPWM_SOC_A, 1);

        //Used by FSI/DMA
        EPWM_enableADCTrigger(myEPWM1_BASE, EPWM_SOC_B);
        EPWM_setADCTriggerSource(myEPWM1_BASE, EPWM_SOC_B, EPWM_SOC_TBCTR_ZERO);
        EPWM_setADCTriggerEventPrescale(myEPWM1_BASE, EPWM_SOC_B, 1);

        EPWM_disableInterrupt(myEPWM1_BASE);
        EPWM_clearEventTriggerInterruptFlag(myEPWM1_BASE);
        EPWM_setInterruptSource(myEPWM1_BASE, EPWM_INT_TBCTR_ZERO);
        EPWM_setInterruptEventCount(myEPWM1_BASE, 1);

  • You have the SYSCTL_enableMoulde  used along with TBCLKSYNC in the main function after the EPWM intiialization?

  • I found the reason of this behavior. It is because of EPWM_selectPeriodLoadEvent(base, EPWM_SHADOW_LOAD_MODE_SYNC). Because of this, the period will only be load from shadow to active register when a SYNCI is received. If no SYNCI is received, the ePWM period (active register) remains to 0 so they do nothing until a sync is received.