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



