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.

TMS320F280025C: ePWM initialisation issues

Part Number: TMS320F280025C
Other Parts Discussed in Thread: LAUNCHXL-F280025C

Hello.

I am having some trouble setting up the ePWM module.

The initialisation code snippet below for ePWM7 works just fine when GPIO12 and GPIO13 are muxed to ePWM7, but not when GPIO28 and GPIO29 are muxed to ePWM7 instead.

Additionally, the same code (copied and pasted, except for changing the clock enables, pin muxing, and register file) works for ePWM1 to ePWM4, but does not work for ePWM5, ePWM6, and ePWM7.

In case it matters, I am trying this out on a LAUNCHXL-F280025C.

I don't know what I've missed - any assistance would be greatly appreciated.

Regards,

Vishnu

    EALLOW;
    CpuSysRegs.PCLKCR2.bit.EPWM7 = 1;

    GpioCtrlRegs.GPAGMUX2.bit.GPIO28 = 0x0;
    GpioCtrlRegs.GPAMUX2.bit.GPIO28 = 0x3;
    GpioCtrlRegs.GPAGMUX2.bit.GPIO29 = 0x0;
    GpioCtrlRegs.GPAMUX2.bit.GPIO29 = 0x3;
    GpioCtrlRegs.GPAQSEL2.bit.GPIO28=0x3;
    GpioCtrlRegs.GPAQSEL2.bit.GPIO29=0x3;

//    GpioCtrlRegs.GPAGMUX1.bit.GPIO12 = 0x0;
//    GpioCtrlRegs.GPAMUX1.bit.GPIO12 = 0x1;
//    GpioCtrlRegs.GPAGMUX1.bit.GPIO13 = 0x0;
//    GpioCtrlRegs.GPAMUX1.bit.GPIO13 = 0x1;
//    GpioCtrlRegs.GPAQSEL1.bit.GPIO12=0x3;
//    GpioCtrlRegs.GPAQSEL1.bit.GPIO13=0x3;
    EDIS;

    EPwm7Regs.TBPRD = 500;

    EPwm7Regs.CMPA.bit.CMPA = 125;
    EPwm7Regs.CMPB.bit.CMPB = 250;

    EPwm7Regs.TBCTL.bit.CLKDIV = 0x0;
    EPwm7Regs.TBCTL.bit.HSPCLKDIV = 0x1;

    EPwm7Regs.TBCTL.bit.PHSEN=TB_DISABLE;
    EPwm7Regs.TBPHS.bit.TBPHS=0;

    EPwm7Regs.TBCTR=0;
    EPwm7Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN;

    EPwm7Regs.TBCTL.bit.PRDLD = TB_SHADOW;

    EPwm7Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
    EPwm7Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;

    EPwm7Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // load on CTR = Zero
    EPwm7Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; // load on CTR = Zero

    EPwm7Regs.AQCTLA.bit.CAU = AQ_CLEAR;
    EPwm7Regs.AQCTLA.bit.CAD = AQ_SET;
    EPwm7Regs.AQCTLB.bit.CBU = AQ_CLEAR;
    EPwm7Regs.AQCTLB.bit.CBD = AQ_SET;

    EPwm7Regs.ETSEL.bit.SOCAEN=0;
    EPwm7Regs.ETSEL.bit.SOCASEL=1;
    EPwm7Regs.ETSOCPS.bit.SOCAPRD2=1;
    EPwm7Regs.ETSEL.bit.SOCAEN=1;

  • Hi,

    Configuration seems correct for ePWM7 to appear on GPIO28 and GPIO29.
    Which pins on  LAUNCHXL-F280025C are you monitoring? Is there any other ckt connected to these pins? 

  • Hi Subrahmanya,

    I'm monitoring the pin marked IO28 (as showing in the picture). I haven't connected any other circuit yet, just oscilloscope probes.

    I tried toggling the pins in an infinite loop with a delay (after setting them to GPIO output) that corresponded to the ePWMs that were giving me issues - GPIO18 (ePWM6_A), GPIO19 (ePWM6_B), GPIO28 (ePWM7_A) and GPIO29 (ePWM7_B). They did not toggle.

    I thought it might be a problem with the board so I tried with another identical launchpad, but the same thing happened for the other one as well.

    Do let me know if there's anything about the launchpad that you remember that might cause this. I am still new to this microcontroller and development board, so there is a chance I might have missed something basic.

    Thank you very much for your help.

    Edit: I should also mention that ePWM7 seems to work when I put the registers on a watch window (the counter keeps changing). I also compared each register to ePWM1's registers just to check for config errors. But they are the same. I am sure it isn't a pin muxing issue, I have checked that enough times.

  • Update: Turns out there are switches on the LAUNCHXL that forcibly routes SCIA UART (on GPIO28 and GPIO29) to XDS110's virtual COM port. I moved those switches and it is working now.