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.

LAUNCHXL-F2800137: ePWM SyncOut pulse in up-down count mode

Part Number: LAUNCHXL-F2800137

Tool/software:

Hi,

I am using the ePWM module to generate a sync out signal to trigger the counter in eCAP module. In the ePWM module I chose the CNT = CMPB setting to generate the sync out pulse. I am using up-down count mode therefore the condition CNT = CMPB is met twice each period. Does this mean that the sync out pulse is also generated twice? If so, is there a way to configure the sync out pulse so that it triggers only once per period, i.e. only when the counter is counting up?

I cannot find any mentions of this in the technical reference manual.

Thank you for your help.

Regards,

Samo

  • Hi Samo,

    Yes there will be two sync out pulses, one for the up count, one for the down count events.

    There is a way to do this.

    1. Set up sync out on CMPB event.

    2. Generate an ISR on PRD or ZRO

    3. Disable or enable the syncout pulse based on CTR direction.

    __interrupt void INT_myEPWM0_ISR(void)
    {
        if(EPWM_getTimeBaseCounterDirection(myEPWM0_BASE))
        {
            EPWM_enableSyncOutPulseSource(myEPWM0_BASE, EPWM_SYNC_OUT_PULSE_ON_CNTR_COMPARE_B);
    
        }else
        {
            EPWM_disableSyncOutPulseSource(myEPWM0_BASE, EPWM_SYNC_OUT_PULSE_ON_CNTR_COMPARE_B);
    
        }
    
        //
        // Clear the flags - we will continue to take this interrupt until the TZ
        // pin goes high.
        //
        EPWM_clearEventTriggerInterruptFlag(myEPWM0_BASE);
    
        //
        // Acknowledge this interrupt to receive more interrupts from group 2
        //
        Interrupt_clearACKGroup(INT_myEPWM0_INTERRUPT_ACK_GROUP);
    }

  • Thank you for your answer Ryan!

  • Hi Samo,

    You're welcome! If you have any additional questions please create a new post.

    Best,

    Ryan Ma