TMS320F28335: Interrupt and breakpoint issue

Part Number: TMS320F28335

Tool/software:

Hi team,

I hit a breakpoint in the EPWM interrupt, but the program doesn't stop in the interrupt. Does my program not enter the interrupt? I set the EPWM interrupt to change the value of cmpa and called the function value table I wrote.

#include "DSP2833x_Device.h"
#include "DSP2833x_Examples.h"
#include <math.h>
#include <stdio.h>
#include "cmpa.h"
interrupt void epwm1_isr(void);

interrupt void epwm1_tzint_isr(void);

int main(void)
{
InitSysCtrl();
InitEPwmGpio();
InitTzGpio();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EALLOW;
PieVectTable.EPWM1_INT = &epwm1_isr;
PieVectTable.EPWM1_TZINT=&epwm1_tzint_isr;
EDIS;
//InitCpuTimers();
InitAdc();
InitEPwm();
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0;
EDIS;
PieCtrlRegs.PIEIER3.bit.INTx1 = 1;
IER |= M_INT3;
EINT;
ERTM;
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
EDIS;

//for(;;){

// }

}

interrupt void epwm1_isr(void)
{

static int index = 0;


EPwm1Regs.CMPA.half.CMPA = (int)(Va_table[index]);

EPwm4Regs.CMPA.half.CMPA =(int)(Va_table[index]);

EPwm2Regs.CMPA.half.CMPA = (int)(Vb_table[index]);

EPwm5Regs.CMPA.half.CMPA =(int)(Vb_table[index]);

EPwm3Regs.CMPA.half.CMPA =(int)(Vc_table[index]);

EPwm6Regs.CMPA.half.CMPA =(int)(Vc_table[index]);

index++;
if (index >= TABLE_SIZE) {
index = 0;
}


// Clear INT flag for this timer
EPwm1Regs.ETCLR.bit.INT = 1;

// Acknowledge this interrupt to receive more interrupts from group 3
PieCtrlRegs.PIEACK.all = PIEACK_GROUP3;

void InitEPwm1SPWM()
{

//TZ
EALLOW;
EPwm1Regs.TZSEL.bit.OSHT1 = 1;
/ EPwm1Regs.TZSEL.bit.OSHT2 = 1;


EPwm1Regs.TZCTL.bit.TZA = TZ_FORCE_HI; 
EPwm1Regs.TZCTL.bit.TZB = TZ_FORCE_HI;

// Enable TZ interrupt
EPwm1Regs.TZEINT.bit.OST = 1;

EDIS;

//TB
EPwm1Regs.TBPRD =3750; // Set timer period
EPwm1Regs.TBPHS.half.TBPHS = 0x0000; // Phase is 0
EPwm1Regs.TBCTR = 0x0000; // Clear counter

// Setup TBCLK
EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; 
EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; 
EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW; 
EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; 
EPwm1Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; // TBCLK=SYSCLKOUT/2=150/2=75MHz
EPwm1Regs.TBCTL.bit.CLKDIV = TB_DIV2;
//CC
EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;

EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO;
EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;


EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; //Pwm1A
EPwm1Regs.AQCTLA.bit.CAD =AQ_CLEAR;


EPwm1Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE; 
EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_LOC; 
EPwm1Regs.DBCTL.bit.IN_MODE = DBA_ALL; 
EPwm1Regs.DBRED = 300;

EPwm1Regs.DBFED = 300;

//ET

EPwm1Regs.ETSEL.bit.INTSEL = ET_CTR_ZERO; 
EPwm1Regs.ETSEL.bit.INTEN = 1; 
EPwm1Regs.ETPS.bit.INTPRD = ET_1ST; 
}
void InitEPwm2SPWM()
{


//TZ
EALLOW;
EPwm2Regs.TZSEL.bit.OSHT1 = 1;
EPwm2Regs.TZSEL.bit.OSHT2 = 1;
// What do we want the TZ1 and TZ2 to do?
EPwm2Regs.TZCTL.bit.TZA = TZ_FORCE_HI; 
EPwm2Regs.TZCTL.bit.TZB = TZ_FORCE_HI;

EPwm2Regs.TZEINT.bit.OST = 1;

// EDIS;


EPwm2Regs.TBPRD = 3750; // Set timer period
EPwm2Regs.TBPHS.half.TBPHS = 0x0000; // Phase is 0
EPwm2Regs.TBCTR = 0x0000; // Clear counter

// Setup TBCLK
EPwm2Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count up
EPwm2Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading
EPwm2Regs.TBCTL.bit.PRDLD = TB_SHADOW; //周期寄存器使用映射
EPwm2Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; //当计数器值等于0时发同步输出信号
EPwm2Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; // TBCLK=SYSCLKOUT/2=150/2=75MHz
EPwm2Regs.TBCTL.bit.CLKDIV = TB_DIV2;

EPwm2Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; // Load registers every ZERO
EPwm2Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm2Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO;
EPwm2Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;



// Set actions
EPwm2Regs.AQCTLA.bit.CAU = AQ_SET; //Pwm1A
EPwm2Regs.AQCTLA.bit.CAD = AQ_CLEAR;
// EPwm2Regs.AQCTLB.bit.CAU = AQ_CLEAR; //Pwm1B
// EPwm2Regs.AQCTLB.bit.CAD = AQ_SET;


// Active Low PWMs - Setup Deadband 死区设置
EPwm2Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE; //11,使能上升沿和下降沿延时
EPwm2Regs.DBCTL.bit.POLSEL = DB_ACTV_LOC; //01,EPWMxA取反,EPWMxB不取反
EPwm2Regs.DBCTL.bit.IN_MODE = DBA_ALL; //00,只将EPWMxA作为输入源,所以前面动作限定输出只定义AQCTLA。
EPwm2Regs.DBRED = 300; //由于TBCLK=SYSCLKOUT/2,按照死区表,设置DBRED=DBFED=300,
EPwm2Regs.DBFED = 300; ////即理论死区为6us,但实际波形死区为4us。

}

void InitEPwm3SPWM()
{

//TZ
EALLOW;
EPwm3Regs.TZSEL.bit.OSHT1 = 1;//选择TZ1作为单次触发事件源
EPwm3Regs.TZSEL.bit.OSHT2 = 1;//选择TZ2作为单次触发事件源
// What do we want the TZ1 and TZ2 to do?
EPwm3Regs.TZCTL.bit.TZA = TZ_FORCE_HI; //触发事件发生时ePWM1A与ePWM1B均强制拉高
EPwm3Regs.TZCTL.bit.TZB = TZ_FORCE_HI;


//EDIS;

EPwm3Regs.TBPRD =3750; // Set timer period
EPwm3Regs.TBPHS.half.TBPHS = 0x0000; // Phase is 0
EPwm3Regs.TBCTR = 0x0000; // Clear counter

// Setup TBCLK
EPwm3Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count up
EPwm3Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading
EPwm3Regs.TBCTL.bit.PRDLD = TB_SHADOW; //周期寄存器使用映射
EPwm3Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; //当计数器值等于0时发同步输出信号
EPwm3Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; // TBCLK=SYSCLKOUT/2=75MHz
EPwm3Regs.TBCTL.bit.CLKDIV = TB_DIV2;

EPwm3Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; // Load registers every ZERO
EPwm3Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm3Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO;
EPwm3Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;

// Set actions

EPwm3Regs.AQCTLA.bit.CAU = AQ_SET; //Pwm1B
EPwm3Regs.AQCTLA.bit.CAD = AQ_CLEAR;

// Active Low PWMs - Setup Deadband 死区设置
EPwm3Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE; //11,使能上升沿和下降沿延时
EPwm3Regs.DBCTL.bit.POLSEL = DB_ACTV_LOC; //01,EPWMxA取反,EPWMxB不取反
EPwm3Regs.DBCTL.bit.IN_MODE = DBA_ALL; //00,只将EPWMxA作为输入源,所以前面动作限定输出只ㄒ錋QCTLA。
EPwm3Regs.DBRED = 300; //由于TBCLK=SYSCLKOUT/2,按照死区表,设置DBRED=DBFED=300,
EPwm3Regs.DBFED = 300; 


}
void InitEPwm4SPWM()
{

//TZ
EALLOW;
EPwm4Regs.TZSEL.bit.OSHT1 = 1;//选择TZ1作为单次触发事件源
EPwm4Regs.TZSEL.bit.OSHT2 = 1;//选择TZ1作为单次触发事件源
// What do we want the TZ1 and TZ2 to do?
EPwm4Regs.TZCTL.bit.TZA = TZ_FORCE_HI; //触发事件发生时ePWM1A与ePWM1B均强制拉高
EPwm4Regs.TZCTL.bit.TZB = TZ_FORCE_HI;


//EDIS;


EPwm4Regs.TBPRD = 3750; // Set timer period
EPwm4Regs.TBPHS.half.TBPHS = 0x0000; // Phase is 0
EPwm4Regs.TBCTR = 0x0000; // Clear counter

// Setup TBCLK
EPwm4Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count up
EPwm4Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading
EPwm4Regs.TBCTL.bit.PRDLD = TB_SHADOW; //周期寄存器使用映射
EPwm4Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; //当计数器值等于0时发同步输出信号
EPwm4Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; // TBCLK=SYSCLKOUT/2=75MHz
EPwm4Regs.TBCTL.bit.CLKDIV = TB_DIV2;

EPwm4Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; // Load registers every ZERO
EPwm4Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm4Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO;
EPwm4Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;

// Setup compare
// EPwm4Regs.CMPA.half.CMPA = 3000;//?这个值怎么确定?

// Set actions


EPwm4Regs.AQCTLA.bit.CAU =AQ_SET ; //Pwm1B
EPwm4Regs.AQCTLA.bit.CAD =AQ_CLEAR;

// Active Low PWMs - Setup Deadband 死区设置
EPwm4Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE; //11,使能上升沿和下降沿延时
EPwm4Regs.DBCTL.bit.POLSEL = DB_ACTV_LOC; //01,EPWMxA取反,EPWMxB不取反
EPwm4Regs.DBCTL.bit.IN_MODE = DBA_ALL; //00,只将EPWMxA作为输入源,所以前面动作限定输出只定义AQCTLA。
EPwm4Regs.DBRED = 300; //由于TBCLK=SYSCLKOUT,按照死区表,设置DBRED=DBFED=400,
EPwm4Regs.DBFED = 300; //即死区设为4us


}
void InitEPwm5SPWM()
{

//TZ
EALLOW;
EPwm5Regs.TZSEL.bit.OSHT1 = 1;//选择TZ1作为单次触发事件源(过压)
EPwm5Regs.TZSEL.bit.OSHT2 = 1;//选择TZ2 作为单次触发事件源(过压)
// What do we want the TZ1 and TZ2 to do?
EPwm5Regs.TZCTL.bit.TZA = TZ_FORCE_HI; //触发事件发生时ePWM1A与ePWM1B均强制拉高
EPwm5Regs.TZCTL.bit.TZB = TZ_FORCE_HI;

EDIS;


EPwm5Regs.TBPRD =3750; // Set timer period
EPwm5Regs.TBPHS.half.TBPHS = 0x0000; // Phase is 0
EPwm5Regs.TBCTR = 0x0000; // Clear counter

// Setup TBCLK
EPwm5Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count up
EPwm5Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading
EPwm5Regs.TBCTL.bit.PRDLD = TB_SHADOW; //周期寄存器使用映射
EPwm5Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; //当计数器值等于0时发同步输出信号
EPwm5Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; // TBCLK=SYSCLKOUT/2=75MHz
EPwm5Regs.TBCTL.bit.CLKDIV = TB_DIV2;

EPwm5Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; // Load registers every ZERO
EPwm5Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm5Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO;
EPwm5Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;


// Set actions

EPwm5Regs.AQCTLA.bit.CAU = AQ_SET; //Pwm1B
EPwm5Regs.AQCTLA.bit.CAD = AQ_CLEAR;


// Active Low PWMs - Setup Deadband 死区设置
EPwm5Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE; //11,使能上升沿和下降沿延时
EPwm5Regs.DBCTL.bit.POLSEL = DB_ACTV_LOC; //01,EPWMxA取反,EPWMxB不取反
EPwm5Regs.DBCTL.bit.IN_MODE = DBA_ALL; //00,只将EPWMxA作为输入源,所以前面动作限定输出只定义AQCTLA。
EPwm5Regs.DBRED = 300; //由于TBCLK=SYSCLKOUT,按照死区表,设置DBRED=DBFED=400,
EPwm5Regs.DBFED = 300; //即死区设为4us


}

void InitEPwm6SPWM()
{

//TZ
EALLOW;
EPwm6Regs.TZSEL.bit.OSHT1 = 1;//选择TZ1作为单次触发事件源
EPwm6Regs.TZSEL.bit.OSHT2 = 1;//选择TZ2作为单次触发事件源
// What do we want the TZ1 and TZ2 to do?
EPwm6Regs.TZCTL.bit.TZA = TZ_FORCE_HI; //触发事件发生时ePWM1A与ePWM1B均强制拉高
EPwm6Regs.TZCTL.bit.TZB = TZ_FORCE_HI;


//EDIS;

EPwm6Regs.TBPRD = 3750; // Set timer period
EPwm6Regs.TBPHS.half.TBPHS = 0x0000; // Phase is 0
EPwm6Regs.TBCTR = 0x0000; // Clear counter

// Setup TBCLK
EPwm6Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count up
EPwm6Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading
EPwm6Regs.TBCTL.bit.PRDLD = TB_SHADOW; //周期寄存器使用映射
EPwm6Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; //当计数器值等于0时发同步输出信号
EPwm6Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; // TBCLK=SYSCLKOUT/2=75MHz
EPwm6Regs.TBCTL.bit.CLKDIV = TB_DIV2;

EPwm6Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; // Load registers every ZERO
EPwm6Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm6Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO;
EPwm6Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;

// Set actions

EPwm6Regs.AQCTLA.bit.CAU =AQ_SET ; //Pwm1B
EPwm6Regs.AQCTLA.bit.CAD = AQ_CLEAR;


// Active Low PWMs - Setup Deadband 死区设置
EPwm6Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE; //11,使能上升沿和下降沿延时
EPwm6Regs.DBCTL.bit.POLSEL = DB_ACTV_LOC; //01,EPWMxA取反,EPWMxB不取反
EPwm6Regs.DBCTL.bit.IN_MODE = DBA_ALL; //00,只将EPWMxA作为输入源,所以前面动作限定输出只定义AQCTLA。
EPwm6Regs.DBRED = 300; //由于TBCLK=SYSCLKOUT,按照死区表,设置DBRED=DBFED=400,
EPwm6Regs.DBFED = 300; //即死区设为4us


}

Thanks & Best regards,

Jiahui