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.

AM2431: EPWM synchronize

Part Number: AM2431
Other Parts Discussed in Thread: SYSCONFIG,

Tool/software:

Hi all TI experts,

I want to synchronize EPWM0, 1, and 2. I have included the following code in the initialization function of each EPWM.

EPWM_tbSyncEnable(epwmBaseAddr, 0, EPWM_TB_CNT_DIR_AFT_SYNC_UP);
EPWM_tbSetSyncOutMode(epwmBaseAddr, EPWM_TB_SYNC_OUT_EVT_SYNCIN);
EPWM_tbSetEmulationMode(epwmBaseAddr, EPWM_TB_EMU_MODE_FREE_RUN);

In the interrupt callback of EPWM2, I declared a variable, gEpwmIsrCnt. Each time an interrupt is triggered, gEpwmIsrCnt increments by one. After initialization, the synchronization signal will be sent only when gEpwmIsrCnt is greater than 10. The implementation is as follows:

EPWM2_init(EPWM2_BaseAddr, APP_EPWM2_OUTPUT_CH, EPWM2_FCLK);
EPWM1_init(EPWM1_BaseAddr, APP_EPWM1_OUTPUT_CH, EPWM1_FCLK);
EPWM0_init(EPWM0_BaseAddr, APP_EPWM0_OUTPUT_CH, EPWM0_FCLK);

gEpwmIsrCnt = 0;
while (gEpwmIsrCnt < 10)
    ;

//Send software sync signal to EPWM
EPWM_tbTriggerSwSync(EPWM2_BaseAddr);
EPWM_tbTriggerSwSync(EPWM1_BaseAddr);
EPWM_tbTriggerSwSync(EPWM0_BaseAddr);

Will this method correctly trigger EPWM synchronization? Currently, I am operating this way, but I find that the EPWM output signals do not appear to be synchronized. Therefore, I would like to ask if there is something I might have done wrong.

By the way, the EPWMs I want to synchronize are 0, 1, 2, 3, and 5. I know that EPWM2 needs to be configured to trigger EPWM3, but I am not using EPWM4. Do I still need to initialize EPWM4 to allow the synchronization signal of EPWM3 to synchronize with EPWM5?

Best,

Larry

  • Hi Larry, let me take a look and come back to you in a day or two

    thank you

    Paula

  • Hi Paula,

    Thanks for your replay, hope can get your feedback ASAP.

    Best,

    Larry

  • Hi Larry, your code seems OK to me.

    So, if you use a scope, you see the EPWMs outputs out of sync? Can you share a scope shot with SYNC IN, SYNC OUT, and EPMW0,1,2 outputs? No sure if highlighted in yellow part below applies to you, but anyhow, highlighted just in case =)

    There are some SYNCI/SYNCO dependencies between EPWMs, as EPWM modules are connected in daisy-chain. Some details here (from TRM):

    12.4.3.3.1.2 Daisy-Chain Connectivity between EPWM Modules

    The EPWM modules provide synchronization signals to allow them to be synchronized to other modules or events. In this device, these signals are connected in a daisy-chain fashion for EPWM0-EPWM8 as shown in Figure 12-2230. For EPWM3, EPWM4, EPWM5 and for EPWM6, EPWM7, EPWM8, the EPWM modules can be synchronized to a separate external event (routed through the SoC Sync mux3 and SoC Sync mux 6). Note that the EPWM0_SYNCIN, EPWM3_SYNCIN, and EPWM6_SYNCIN pins and the ICSSG interrupts that source the EPWMSYNCI inputs require synchronization. Also note that there can be no extra delay (synchronization or pipelining) between the EPWMSYNCOUT of one EPWM module and the EPWMSYNCI of the next, because this will induce a slight phase shift between the counters of the EPWM peripherals. The connections from the time sync and compare event routers are intended to reset the EPWM timebase counters for synchronization of the PWM output period to (some multiple of) an external synchronization pulse (for example: from a time synchronized network).

    AM64x/AM243x Technical Reference Manual (Rev. H) (ti.com)

    I would also suggest using Sysconfig and ADD all your EPWM modules there as this could help you to avoid pinmux conflicts when using SYNCI/SYNCO signals.

    Thank you,

    Paula

  • Hi Paula,

    I am a bit confused here. I thought the EPWM synchronization was internal, but according to your syscfg screenshot, it seems like an IO is needed to obtain the synchronization signal.

    For example, in this screenshot, EPWM0 needs to receive a trigger signal from GPIO at R21 to start, and then send the next synchronization signal to EPWM1 from GPIO at R20. Is that correct?

    Best,

    Larry

  • Hi Paula,

    Additionally, I have another question. I want to synchronize EPWM3 with EPWM5. Do I need to initialize EPWM4? I tried to test this, but I couldn't find EPWM4 in syscfg. Does AM2431 not support EPWM4?

    Best,

    Larry

  • Hi Larry,

    for your first question please refer to TRM Figure 12-2230. Daisy-Chain Connectivity between EPWM Modules, there you will see which SYNCI options are for every EPWMx. Link and example snapshot below

     

    AM64x/AM243x Technical Reference Manual (Rev. H) (ti.com)

     

     

    For your second question, there are differences between ALX and ALV with respect of the pins available. So, in case of EPWM4 those pins are present in ALV package but not in ALX.

    Link and snapshot example below

     

    AM243x SitaraTm Microcontrollers datasheet (Rev. G) (ti.com)

    Thank you,

    Paula

  • Hi Paula,

    Thanks for your explain, I found the problem root cause, I can make EPWM0/1/2 sync, and EPWM3 and EPWM5 can sync without EPWM4.

    Best,

    Larry

  • Great! thanks for let us know

    Paula