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.

tms320f28335: Interrupt disable / re-enable

Part Number: TMS320F28335


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

  • Hi John,

    Thank you for your question. This thread has been assigned to a C2000 expert and should get replied soon.

    Best regards,
    Chen
  • Hi John,

    What do you mean by you "lose INT13_ISR"? Do you mean you don't get any more interrupts from it at all or do you mean it fails to return to INT13_ISR and finish it after it was interrupted by INT3?

    Is EEPROMB_Loop() being called in interrupt context or not? Please read the notes in the System Control and Interrupts User's Guide about avoiding race conditions when disabling interrupts in PIEIER. Also, note that PIEACK = 0 doesn't have any effect--PIEACK bits are write 1 to clear bits.

    Regarding your question about IER &= M_INT3--it's just disabling all lower priority interrupts. In this case it just happens to be disabling everything but INT3 but you could adjust the mask to leave others enabled as needed.

    Whitney