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.

TMS320F28379D: TMS320F28379D

Part Number: TMS320F28379D

Hi,

I set default clock to 200 MHz with predefined symbol _LAUNCHXL_F28379D. I set EPWM_TIMER_TBPRD =2.  When I run this code:

EPWM_setTimeBasePeriod(base, EPWM_TIMER_TBPRD);
EPWM_setPhaseShift(base, 0U);
EPWM_setTimeBaseCounter(base, 0U);
EPWM_setTimeBaseCounterMode(base, EPWM_COUNTER_MODE_UP);
EPWM_disablePhaseShiftLoad(base);

//
// Set ePWM clock pre-scaler
//
EPWM_setClockPrescaler(base,EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1);

EPWM_setActionQualifierAction(base,
EPWM_AQ_OUTPUT_A,
EPWM_AQ_OUTPUT_TOGGLE,
EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD);
EPWM_setActionQualifierAction(base,
EPWM_AQ_OUTPUT_B,
EPWM_AQ_OUTPUT_TOGGLE,
EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);

on the scope the meander frequency is 16.68 MHz and A and B outputs are not out of phase but shifted pi/2. I would expect the frequency to be half of 200 MHz clock.

thanks vadim

  • Hi Vadim,

    Let me take a look at this and get back to you by end of day.

    Best,

    Ryan Ma

  • Hi Vadim, 

    200Mhz is the speed of the PLLSYSCLK with default configuration. The TBCLK is 100 MHz if you're using default clock configurations. 

    200Mhz / 2 = 100Mhz, and you're using HSPCLKDIV = /1 , and CLKDIV = /1, thus giving a 100Mhz signal

    The frequency is correct since you are toggling at the end of the period. Instead if you toggled at CMPA event, you will get a frequency of  33.33Mhz.

    I have outputted the waveforms between A and B as shown. A is toggling when CMPA = 1, B is toggling when the period comes. Output A is giving a 33.3Mhz output, and output B is giving a 16.68Mhz output.

    If you want a 100Mhz signal, you will have to change the clock configuration so that your TBCLK is running at 200Mhz. However according the datasheet you can have a max EPWMCLK frequency of 100Mhz.

  • Hi Ryan,

    I followed your suggestions but still get the same result.

    Here is the code:

    void initEPWMWithoutDB(uint32_t base)
    {
    //
    // Set-up TBCLK
    //
    EPWM_setTimeBasePeriod(base, 2);
    EPWM_setPhaseShift(base, 0U);
    EPWM_setTimeBaseCounter(base, 0U);
    EPWM_setTimeBaseCounterMode(base, EPWM_COUNTER_MODE_UP);
    EPWM_disablePhaseShiftLoad(base);
    EPWM_setCounterCompareValue(myEPWM1_BASE, EPWM_COUNTER_COMPARE_A, 1);

    //
    // Set ePWM clock pre-scaler
    //
    EPWM_setClockPrescaler(base,EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1);

    EPWM_setActionQualifierAction(base,
    EPWM_AQ_OUTPUT_A,
    EPWM_AQ_OUTPUT_TOGGLE,
    EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
    EPWM_setActionQualifierAction(base,
    EPWM_AQ_OUTPUT_B,
    EPWM_AQ_OUTPUT_TOGGLE,
    EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD);

    }

    thanks vadim

  • Hi Vadim,

    Try this:

    EPWM_setActionQualifierAction(base,
    EPWM_AQ_OUTPUT_A,
    EPWM_AQ_OUTPUT_HIGH,
    EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
    EPWM_setActionQualifierAction(base,
    EPWM_AQ_OUTPUT_A,
    EPWM_AQ_OUTPUT_LOW,
    EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD);

    This will set high on cmpa, then low on period.

  • Tank you! will not use toggle