Hi I am running two interrupts: 1) INT13 for SPI and CAN and 2)INT3.3 for Control (time critical). INT13 is nested wrt to INT3.1, that is INT3.1 can interrupt INT13_ISR (my understanding from http://processors.wiki.ti.com/index.php/Interrupt_Nesting_on_C28x
main(void)
{
InitSysCtrl();
DisableDog();
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.EPWM1_INT = &epwm1_timer_isr;
PieVectTable.XINT13 = &CpuTimer1_int13_isr; // CPU1 32bit Timer INT13
EDIS; // This is needed to disable write to EALLOW protected registers
EALLOW;
XIntruptRegs.XNMICTR = 0; //Counter (CPU_Timer1 = INT13)
EDIS;
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
InitFlash();
EPwm1TimerIntCount = 0;
IER |= M_INT3 | M_INT13; //CPU Interrupt 13 (CPUTimer1) and 3(ePWM1): Need to set IFR and IER
PieCtrlRegs.PIEIER3.bit.INTx1 = 1; // ePWM1_INT_ENABLE (ePWM1);
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
interrupt void CpuTimer1_int13_isr(void) // CPU1 32bit Timer INT13
{
//======= Nested - Allow ePWM1 INT=============
int16 TempPIEIER;
if(State != 6) {
TempPIEIER = PieCtrlRegs. PIEIER3.all;
IER |= M_INT3; // Enable CPU INT3 which is connected to EPWM1-3 INT:
IER &= M_INT3; //?????????????
PieCtrlRegs.PIEIER3.bit.INTx1 = 1; //Enable EPWM INT3 in the PIE:PWM1_INT_ENABLE INT3.1;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP3; // Acknowledge this interrupt to receive more interrupts from group 3
asm(" NOP");
EINT; //asm(" CLRC INTM");
// COmmunication Code//
DINT;
PieCtrlRegs.PIEIER3.all = TempPIEIER;
EDIS;
}
3) Disable / Re - enable INT3.3 Code
void EEPROMB_Loop()
{
//Disable INT3.1
EALLOW;
IER = 0x1000;
PieCtrlRegs.PIEIER3.bit.INTx1 = 0;
PieCtrlRegs.PIEACK.all = 0;
EDIS;
Update_EEPROMB(); // EEPROMB Programming
if(Enables == 0x0C) // Reset / Close
{
// Enable INT3.1
State = 2; // initialize and Reload EEPROMB Parameteres
EALLOW;
PieCtrlRegs.PIEIER3.bit.INTx1 = 1;
//IER = 0x1004;
IER |= M_INT3; //0x1004;
PieCtrlRegs.PIEIER3.bit.INTx1 = 1;
PieCtrlRegs.PIEACK.all = 0;
EDIS;
}
This code halts INT3.3 and continues INT13, but I lose INT13_ISR when I re-enable INT3.3 (IER=0x0000/4). I am not sure why, useless the nesting code is causing an issue?? Also I am not sure why the IER &= M_INT3 is used in the nesting algorithm (http://processors.wiki.ti.com/index.php/Interrupt_Nesting_on_C28x ) .
Thank you for any help
John