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.
I would like to synchronize EPWM10, EPWM11 and EPWM12. When the EPWM is initialized with the code below there is only output on EPM10. Note: SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC); is executed further down in the code. If I set the load events to Load on counter = 0 then all three outputs are present. I have looked at examples and could not find anything the code is missing. This code is executed in CPU2.
Is there code that needs to be executed in CPU1 to allow for synchronization? Older versions of CCS, 10.3.1.00003, and C200Ware, 03_03_00_00, are being used for this project.
static void Init_EPWM( void ) { EALLOW; SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_GTBCLKSYNC); SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC); //////////////////////////// // EPWM TIME BASE COUNTER //////////////////////////// // load from shadow synchronously EPWM_setClockPrescaler( EPWM10_BASE, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1 ); EPWM_setClockPrescaler( EPWM11_BASE, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1 ); EPWM_setClockPrescaler( EPWM12_BASE, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1 ); EPWM_setPeriodLoadMode( EPWM10_BASE, EPWM_PERIOD_SHADOW_LOAD ); EPWM_setPeriodLoadMode( EPWM11_BASE, EPWM_PERIOD_SHADOW_LOAD ); EPWM_setPeriodLoadMode( EPWM12_BASE, EPWM_PERIOD_SHADOW_LOAD ); EPWM_setTimeBasePeriod( EPWM10_BASE, init_half_pwm_period ); EPWM_setTimeBasePeriod( EPWM11_BASE, init_half_pwm_period ); EPWM_setTimeBasePeriod( EPWM12_BASE, init_half_pwm_period ); EPWM_selectPeriodLoadEvent( EPWM10_BASE, EPWM_SHADOW_LOAD_MODE_COUNTER_ZERO ); EPWM_selectPeriodLoadEvent( EPWM11_BASE, EPWM_SHADOW_LOAD_MODE_SYNC ); EPWM_selectPeriodLoadEvent( EPWM12_BASE, EPWM_SHADOW_LOAD_MODE_SYNC ); EPWM_setTimeBaseCounterMode( EPWM10_BASE,EPWM_COUNTER_MODE_UP_DOWN ); EPWM_setTimeBaseCounterMode( EPWM11_BASE,EPWM_COUNTER_MODE_UP_DOWN ); EPWM_setTimeBaseCounterMode( EPWM12_BASE,EPWM_COUNTER_MODE_UP_DOWN ); EPWM_setTimeBaseCounter( EPWM10_BASE, 0 ); EPWM_setTimeBaseCounter( EPWM11_BASE, 0 ); EPWM_setTimeBaseCounter( EPWM12_BASE, 0 ); EPWM_setCountModeAfterSync( EPWM10_BASE, EPWM_COUNT_MODE_UP_AFTER_SYNC ); EPWM_setCountModeAfterSync( EPWM11_BASE, EPWM_COUNT_MODE_UP_AFTER_SYNC ); EPWM_setCountModeAfterSync( EPWM12_BASE, EPWM_COUNT_MODE_UP_AFTER_SYNC ); EPWM_disablePhaseShiftLoad( EPWM10_BASE ); EPWM_disablePhaseShiftLoad( EPWM11_BASE ); EPWM_disablePhaseShiftLoad( EPWM12_BASE ); EPWM_setPhaseShift( EPWM10_BASE, 0 ); EPWM_setPhaseShift( EPWM11_BASE, 0 ); EPWM_setPhaseShift( EPWM12_BASE, 0 ); EPWM_setSyncOutPulseMode( EPWM10_BASE, EPWM_SYNC_OUT_PULSE_ON_COUNTER_ZERO ); EPWM_setSyncOutPulseMode( EPWM11_BASE, EPWM_SYNC_OUT_PULSE_ON_EPWMxSYNCIN ); /////////////////////////////// // COUNTER COMPARE /////////////////////////////// EPWM_setCounterCompareValue( EPWM10_BASE, EPWM_COUNTER_COMPARE_A, 0 ); EPWM_setCounterCompareValue( EPWM11_BASE, EPWM_COUNTER_COMPARE_A, 0 ); EPWM_setCounterCompareValue( EPWM12_BASE, EPWM_COUNTER_COMPARE_A, 0 ); EPWM_setCounterCompareShadowLoadMode( EPWM10_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO ); EPWM_setCounterCompareShadowLoadMode( EPWM11_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO ); EPWM_setCounterCompareShadowLoadMode( EPWM12_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO ); /////////////////////////////// // EPWM ACTION QUALIFIER /////////////////////////////// // placeholders... these are set based on DPWM1 or SVPWM in inverter_zone.c EPWM_setActionQualifierActionComplete( EPWM10_BASE, EPWM_AQ_OUTPUT_A, (EPWM_ActionQualifierEventAction)( EPWM_AQ_OUTPUT_LOW_UP_CMPA | EPWM_AQ_OUTPUT_HIGH_DOWN_CMPA )); EPWM_setActionQualifierActionComplete( EPWM11_BASE, EPWM_AQ_OUTPUT_A, (EPWM_ActionQualifierEventAction)( EPWM_AQ_OUTPUT_LOW_UP_CMPA | EPWM_AQ_OUTPUT_HIGH_DOWN_CMPA )); EPWM_setActionQualifierActionComplete( EPWM12_BASE, EPWM_AQ_OUTPUT_A, (EPWM_ActionQualifierEventAction)( EPWM_AQ_OUTPUT_LOW_UP_CMPA | EPWM_AQ_OUTPUT_HIGH_DOWN_CMPA )); /////////////////////////////////////////////////////// // EPWM DEADBAND // Configure EPWM1B to be complementary to EPWM1A /////////////////////////////////////////////////////// EPWM_setRisingEdgeDeadBandDelayInput( EPWM10_BASE, EPWM_DB_INPUT_EPWMA ); EPWM_setRisingEdgeDeadBandDelayInput( EPWM11_BASE, EPWM_DB_INPUT_EPWMA ); EPWM_setRisingEdgeDeadBandDelayInput( EPWM12_BASE, EPWM_DB_INPUT_EPWMA ); EPWM_setFallingEdgeDeadBandDelayInput( EPWM10_BASE, EPWM_DB_INPUT_EPWMA ); EPWM_setFallingEdgeDeadBandDelayInput( EPWM11_BASE, EPWM_DB_INPUT_EPWMA ); EPWM_setFallingEdgeDeadBandDelayInput( EPWM12_BASE, EPWM_DB_INPUT_EPWMA ); EPWM_setDeadBandDelayPolarity( EPWM10_BASE, EPWM_DB_RED, EPWM_DB_POLARITY_ACTIVE_HIGH ); EPWM_setDeadBandDelayPolarity( EPWM11_BASE, EPWM_DB_RED, EPWM_DB_POLARITY_ACTIVE_HIGH ); EPWM_setDeadBandDelayPolarity( EPWM12_BASE, EPWM_DB_RED, EPWM_DB_POLARITY_ACTIVE_HIGH ); EPWM_setDeadBandDelayPolarity( EPWM10_BASE, EPWM_DB_FED, EPWM_DB_POLARITY_ACTIVE_LOW ); EPWM_setDeadBandDelayPolarity( EPWM11_BASE, EPWM_DB_FED, EPWM_DB_POLARITY_ACTIVE_LOW ); EPWM_setDeadBandDelayPolarity( EPWM12_BASE, EPWM_DB_FED, EPWM_DB_POLARITY_ACTIVE_LOW ); EPWM_setDeadBandDelayMode( EPWM10_BASE, EPWM_DB_RED, true ); EPWM_setDeadBandDelayMode( EPWM11_BASE, EPWM_DB_RED, true ); EPWM_setDeadBandDelayMode( EPWM12_BASE, EPWM_DB_RED, true ); EPWM_setDeadBandDelayMode( EPWM10_BASE, EPWM_DB_FED, true ); EPWM_setDeadBandDelayMode( EPWM11_BASE, EPWM_DB_FED, true ); EPWM_setDeadBandDelayMode( EPWM12_BASE, EPWM_DB_FED, true ); EPWM_setRisingEdgeDelayCountShadowLoadMode( EPWM10_BASE, EPWM_RED_LOAD_ON_CNTR_ZERO); EPWM_setRisingEdgeDelayCountShadowLoadMode( EPWM11_BASE, EPWM_RED_LOAD_ON_CNTR_ZERO); EPWM_setRisingEdgeDelayCountShadowLoadMode( EPWM12_BASE, EPWM_RED_LOAD_ON_CNTR_ZERO); EPWM_setFallingEdgeDelayCountShadowLoadMode( EPWM10_BASE, EPWM_FED_LOAD_ON_CNTR_ZERO ); EPWM_setFallingEdgeDelayCountShadowLoadMode( EPWM11_BASE, EPWM_FED_LOAD_ON_CNTR_ZERO ); EPWM_setFallingEdgeDelayCountShadowLoadMode( EPWM12_BASE, EPWM_FED_LOAD_ON_CNTR_ZERO ); // 100 = 1uS - this will get overwritten later EPWM_setRisingEdgeDelayCount( EPWM10_BASE, 150 ); EPWM_setRisingEdgeDelayCount( EPWM11_BASE, 150 ); EPWM_setRisingEdgeDelayCount( EPWM12_BASE, 150 ); EPWM_setFallingEdgeDelayCount( EPWM10_BASE, 150 ); EPWM_setFallingEdgeDelayCount( EPWM11_BASE, 150 ); EPWM_setFallingEdgeDelayCount( EPWM12_BASE, 150 );
Hello Matt,
Load event for what are you talking about here ?
If I set the load events to Load on counter = 0 then all three outputs are present.
Can you send me the complete code looks like some of it is missing.
Prarthan,
I was unaware that the phase shift needed to be enabled even if no phase shift was desired. This fixed the issue.
Thanks,
Matt