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.

TMS320F28377D: TMS320F28377D

Part Number: TMS320F28377D

Hi,

Thanks in advance. I would like to set a PWM interruption at 10KHz. I set it in up and down mode, CLKDIV= 2, HSPCLKDIV = 0. Thus, the frequency should be 200Mhz/4 =50MHz. And TBPRD is set to 2500. The ISR frequency should be 1/[2*2500*(1/50e+6)]=10KHz.

However, when I use the GPIO toggle to check it, it seems the clock signal for ePWM module exist a problem. The figure below shows the output of the pin which set GPIO toggle to 1. 

Could someone give me a hint on that? 

void main(void)
{
InitSysCtrl();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;

InitPieVectTable();
InitCpuTimers();

EALLOW;
PieVectTable.EPWM6_INT = &epwm6_isr; // function for interrupt based on ePWM6
EDIS;


IER |= M_INT1; // Enable EPWM
IER |= M_INT3; // Enable EPWM
PieCtrlRegs.PIEIER3.bit.INTx6 = 3; // enable EPWM6 interrupts (row 3:PIEIER3, column 6:INTx6)

EINT;
ERTM;

EALLOW;
EPwm6Regs.TBCTL.bit.CLKDIV= 2; //000:/1 001:/2 50mHZ
EPwm6Regs.TBCTL.bit.HSPCLKDIV = 0; //000:/1 001:/2
EPwm6Regs.TBCTL.bit.CTRMODE = 2; //TB_COUNT_UPDOWN
EPwm6Regs.TBPRD= 2500; // 2500 10KHz 
EPwm6Regs.TBCTL.bit.PHSEN = TB_DISABLE;

EPwm6Regs.ETSEL.bit.INTEN = 1; // 1 enable EPWMx_INT interrupt
EPwm6Regs.ETSEL.bit.INTSEL = 2; // 010 generate interrupt when TBCTR = TBPRD
EPwm6Regs.ETPS.bit.INTPRD = 1; // generate an interrupt in the first event
EDIS;

}

  • I have checked the external Oscillator, 20MHz is working well. And system control document is setting well. 200MHz should be okay. 

    #ifdef _LAUNCHXL_F28377S
    InitSysPll(XTAL_OSC,IMULT_40,FMULT_0,PLLCLK_BY_2);
    #else
    InitSysPll(XTAL_OSC,IMULT_20,FMULT_0,PLLCLK_BY_2); 
    #endif

  • Hi,
    The output observed on the scope doesn't seem to the PWM output. Because PWM output should switch from 0 to 3.3v. 
    The signal shown seems to have very small amplitude. Is there some noise source being coupled on to this pin?
    Do you have any other signals connected to this pin on the board?
    Can you try and check some other PWM output?

  • Hi,

    Many thanks for your feedback. I tried to use another pin to do the test. However, the same results. I  doubt is there any problem with my testing code.

    EALLOW;
    GpioCtrlRegs.GPCMUX2.bit.GPIO94=0; //SET GPIO
    GpioCtrlRegs.GPCDIR.bit.GPIO94=1; //SET TO OUTPUT PIN
    EDIS;

    And at the end of my ISR,

    GpioDataRegs.GPCTOGGLE.bit.GPIO94=1;

    Many Thanks

    kexin

  • Hi,

    I suggest you pick the example code and run it as it is on the hardware before trying your own configuration.
    Try a basic PWM example and observe the behavior at the pin.
    You can even try tp disable the PWM module and check the behavior on the pin to see if there are some other drivers on the pin causing this behavior.
    What you are observing is clearly not PWM output. There is some noise or some other loads connected to the same pin.
    I would also suggest to check the measurement setup like the probe etc.

  • Hi, 

    Many thanks for your feedback. Now I get the true situation. My ISR frequency is about 920Hz, which is different from my settings. I will go to check it. 

    Many Thanks

  • Hi,

    Thanks for the update. Feel free to update here or open a new thread later on if you need additional support.

  • ePWM type 4 should be 100Mhz.