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.

CCS/LAUNCHXL-F280049C: C28x EPWM Driver is not writing to registers

Part Number: LAUNCHXL-F280049C
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hello,

I have a problem using functions in epwm.h (part of c2000ware driverlib).

I am not able to change any register value using epwm module functions. The epwm inline function executes, but register value remains unchanged.

The GPIO form the same driverlib works fine, and I am able to run and compile the code fine.

EPWMLOCK register is 0x00000000.

My pwm setup code is below.

Best regards,

Tom.

void INIT_epwm(void)
{
    //! ePWM3 SETUP
    uint16_t periodCount = 4095U;

    //! Reset the ePWM3 counter
    EPWM_setTimeBaseCounter(EPWM3_BASE, 0U);

    //! Set the prescaler
    EPWM_setClockPrescaler(EPWM3_BASE,
                           EPWM_CLOCK_DIVIDER_1,
                           EPWM_HSCLOCK_DIVIDER_1);

    //! Set the time base period (reset value)
    EPWM_setTimeBasePeriod(EPWM3_BASE, periodCount);

    //! Set period load mode to load from shadow register
    EPWM_setPeriodLoadMode(EPWM3_BASE,  EPWM_PERIOD_SHADOW_LOAD);

    //! Set time base counter mode to up-down
    EPWM_setTimeBaseCounterMode(EPWM3_BASE, EPWM_COUNTER_MODE_UP_DOWN);

    //! Set the period load event (from shadow register)
    EPWM_selectPeriodLoadEvent(EPWM3_BASE, EPWM_SHADOW_LOAD_MODE_COUNTER_ZERO);

    //! Set on which event will compare registers load from their respective...
    //! ...shadow load registers. Will be set for CMPA and CMPB.
    EPWM_setCounterCompareShadowLoadMode(EPWM3_BASE,
                                         EPWM_COUNTER_COMPARE_A,
                                         EPWM_COMP_LOAD_ON_SYNC_CNTR_ZERO);
    EPWM_setCounterCompareShadowLoadMode(EPWM3_BASE,
                                         EPWM_COUNTER_COMPARE_B,
                                         EPWM_COMP_LOAD_ON_SYNC_CNTR_ZERO);

    //! Set initial duty cycle to 50%
    EPWM_setCounterCompareValue(EPWM3_BASE,
                                EPWM_COUNTER_COMPARE_A,
                                (uint16_t) 0.5*periodCount);
    EPWM_setCounterCompareValue(EPWM3_BASE,
                                EPWM_COUNTER_COMPARE_B,
                                (uint16_t) 0.5*periodCount);

    //! Set action qualifier to load on counter zero
    EPWM_setActionQualifierShadowLoadMode(EPWM3_BASE,
                                          EPWM_ACTION_QUALIFIER_A,
                                          EPWM_AQ_LOAD_ON_CNTR_ZERO);

    //! In future, set action qualifier T1 to trigger on overcurrent
    //! Also set the appropriate action qualifier action make outputs HI-Z

    //! Add dead-band functions in future

    //! Add trip-zone functions in future

    //! Set EPWM interrupt source as time-base counter = ZERO
    EPWM_setInterruptSource(EPWM3_BASE, EPWM_INT_TBCTR_ZERO);

    //! Set EPWM interrupt event count to one event
    EPWM_setInterruptEventCount(EPWM3_BASE, 1);

    //! Add ADC trigger source in future
}