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.
Hi,
I'm having trouble triggering an interrupt on epwm3 int (epwm1-2 works fine with the same settings).
Aside from the registers I've set below, are there additional registers that need to be setup for epwm3 to interrupt?
I've attached my test project.
void _epwmSetup(void) {
EALLOW;
// enable CLK to ePWM
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0;
// enable interrupt
// set up CPU IER group
IER |= M_INT3;
//SysCtrlRegs.PCLKCR1.bit.EPWM3ENCLK = 1; // ePWM3 (this is already done in F2806x_SysCtrl.c)
PieCtrlRegs.PIEIER3.bit.INTx3 = 1; // EPWM-INT3
asm (" NOP");
asm (" NOP");
asm (" NOP");
asm (" NOP");
asm (" NOP");
// clear the PIEACK x bit for the peripheral group
// write one to clear
PieCtrlRegs.PIEACK.bit.ACK3 = 1;
EDIS;
EPwm3Regs.TBPRD = DDS_PERIOD - 1;
EPwm3Regs.TBPHS.half.TBPHS = 0x0000;
EPwm3Regs.TBCTR = 0x0000; // Clear counter
// Setup counter mode
EPwm3Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP; // Count up
EPwm3Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading
EPwm3Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; // Sync out @ counter=zero
EPwm3Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; // Clock ratio to SYSCLKOUT
EPwm3Regs.TBCTL.bit.CLKDIV = TB_DIV1;
// setup interrupt on EPWM3
EPwm3Regs.ETCLR.bit.INT = 1; // clear current interrupt
EPwm3Regs.ETPS.bit.INTPRD = ET_1ST; // Generate pulse on 1st event
EPwm3Regs.ETSEL.bit.INTSEL = ET_CTR_ZERO; // Select interrupt mode 1. TBCTR=0 2. TBCTR=TBPRD 3. BOTH
EPwm3Regs.ETSEL.bit.INTEN = 0; // Disable interrupt
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
EDIS;
}
// in main after calling _epwmSetup()...
// enable the epwm
EPwm3Regs.ETCLR.bit.INT = 1;
EPwm3Regs.ETSEL.bit.INTEN = 1;
// this is located at the end of the interrupt function // clear the interrupt
EPwm3Regs.ETCLR.bit.INT = 1;
PieCtrlRegs.PIEACK.all = M_INT3;
Thanks,
Chuck