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;
}

