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.

LAUNCHXL-F280039C: ePWM time base counter is frozen causing no PWM output

Part Number: LAUNCHXL-F280039C

I have enabled the clock to ePWM1 and configured the time base counter and action qualifiers. I have no idea why the time base counter is frozen at zero even though the CTRMODE bits are configured as 0b00 (up-count mode) not 0b11 (counter frozen). Maybe I'm missing something...I've been trying to fix this for a while now to no avail. 

  EPWM1 Registers in the CCS debugger

Below is the code I have written to configure EPWM1 using DriverLib functions. No output appears on GPIO0 which makes sense as the counter is frozen. 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
// Enable clock
EALLOW;
CpuSysRegs.PCLKCR2.bit.EPWM1 = 1;
EDIS;
// Configure time base counter
EPWM_setClockPrescaler(EPWM1_BASE, EPWM_CLOCK_DIVIDER_16, EPWM_HSCLOCK_DIVIDER_2); // Net prescaler of /32
EPWM_setTimeBasePeriod(EPWM1_BASE, COUNTER_TOP); // Set top value of time base counter
// Initialize EPWM1A on GPIO0 with non-inverting mode.
EPWM_setActionQualifierActionComplete(EPWM1_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH_ZERO | EPWM_AQ_OUTPUT_LOW_UP_CMPA);
GPIO_setPinConfig(GPIO_0_EPWM1_A); // Set GPIO0 to output EPWM1A
EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, 128);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hello Charley,

    Please add the line

    Fullscreen
    1
    SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    To your code after ePWM configuration. You've used Bitfield to enable the ePWM, but you haven't actually enabled the peripheral clock, if that makes sense?

    Regards,

    Jason Osborn