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.

Disabled Interrupt Trigered Issue



We are using F28377S MCU and have a external GPIO input that has to be Disabled and Enabled when other tasks are running. I have configured INT1.4 as the interrupt for this purpose. However I am getting trigerred into '1.1 - ADCA Interrupt 1' when I step out of the function it enters the interrupt disable function. 

Here is my interrupt disable code

void ESC_disableInt()

{

                 DINT;

                 EALLOW;

                 PieCtrlRegs.PIEIER1.bit.INTx4 = 0;

                 EDIS;

                 EINT;

}

When I check the PIEIFR1.bit.INTx4 it is enabled, however the flag PIEIFR1.bit.INTx1 is disabled. Why am I still entering the particular interrupt.

Here is the code that my MCU enters

 

 

// 1.1 - ADCA Interrupt 1

interrupt void ADCA1_ISR(void)

{

    // Insert ISR Code here

 

    // To receive more interrupts from this PIE group,

    // acknowledge this interrupt.

    // PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;

 

    // Next two lines for debug only to halt the processor here

    // Remove after inserting ISR Code

    asm ("      ESTOP0");

    for(;;);

}

 

  • If the CPU receives an interrupt for a PIE group, but no interrupt in that group is both flagged and enabled, the PIE returns the ISR for the first interrupt in the group. This is probably what's happening:

    1. DINT
    2. PIE receives interrupt trigger 1.4. PIEIFR1.4 is set and propagates to CPU IFR.1.
    3. PIEIER1.4 is cleared
    4. EINT
    5. CPU receives the group 1 interrupt flagged in IFR.1. No PIE interrupt is both flagged and enabled (because PIEIER1.4 is cleared), so the PIE returns ISR 1.1 by default.

    To avoid this, please follow the procedure in TRM section 2.4.4.3 (Disabling Interrupts).
  • Hi,

    Thanks for it. I am still having issues please check if I am doing it right.

    Here is the code

    void ESC_disableInt()
    {
    DINT;
    EALLOW;
    PieVectTable.XINT1_INT = &EmptyISR;
    XintRegs.XINT1CR.bit.ENABLE = 0;
    EDIS;
    EINT;
    asm(" NOP");
    asm(" NOP");
    asm(" NOP");
    asm(" NOP");
    asm(" NOP");
    DINT;
    EALLOW;
    PieVectTable.XINT1_INT = &ESC_ApplicationLayerISR;
    EDIS;
    PieCtrlRegs.PIEACK.bit.ACK1 = 0;
    EINT;
    }

    void ESC_enableInt()
    {
    DINT;
    EALLOW;
    XintRegs.XINT1CR.bit.ENABLE = 1;
    EDIS;
    EINT;
    }

  • You're still seeing the interrupt 1.1. triggered? At what point in the function is it triggered?

    If you just want to clear XINT1CR.ENABLE, you don't need to do a special sequence. There might still be a propagating interrupt, but it should be taken within a few cycles. You can leave the five NOPs if you want to be sure the interrupt is disabled before the function returns.
  • This is my current code,

    void ESC_disableInt()
    {
    DINT;
    EALLOW;
    PieVectTable.XINT1_INT = &EmptyISR;
    PieCtrlRegs.PIEIER1.bit.INTx4 = 0;
    EDIS;
    EINT;
    asm(" NOP");
    asm(" NOP");
    asm(" NOP");
    asm(" NOP");
    asm(" NOP");
    DINT;
    EALLOW;
    PieVectTable.XINT1_INT = &ESC_ApplicationLayerISR;
    EDIS;
    PieCtrlRegs.PIEACK.bit.ACK1 = 0;
    EINT;
    }

    void ESC_enableInt()
    {
    DINT;
    EALLOW;
    PieCtrlRegs.PIEIER1.bit.INTx4 = 1;
    EDIS;
    EINT;
    }

    The interrupt is triggered on the first NOP call.

  • You're mixing up the procedure for disabling interrupts with the procedure for clearing a PIEIFR bit. To disable the interrupt in the PIE, you want to do this:

    1. DINT
    2. Clear the PIEIER bit for the interrupt
    3. Wait 5 cycles
    4. Clear the CPU IFR bit for the interrupt's PIE group.
    5. Clear the PIEACK bit for the interrupt's PIE group.
    6. EINT
  • Hi I tried this particular method. Still having the same issue

    void ESC_disableInt()
    {
    DINT;
    EALLOW;
    PieCtrlRegs.PIEIER1.bit.INTx4 = 0;
    EDIS;
    asm(" NOP");
    asm(" NOP");
    asm(" NOP");
    asm(" NOP");
    asm(" NOP");
    EALLOW;
    PieCtrlRegs.PIEIFR1.all = 0;
    PieCtrlRegs.PIEACK.bit.ACK1 = 0;
    EDIS;
    EINT;
    }

    void ESC_enableInt()
    {
    DINT;
    PieCtrlRegs.PIEIER1.bit.INTx4 = 1;
    EINT;
    }
  • DINT;
    EALLOW;
    PieCtrlRegs.PIEIER1.bit.INTx4 = 0;
    EDIS;
    asm(" NOP");
    asm(" NOP");
    asm(" NOP");
    asm(" NOP");
    asm(" NOP");
    EALLOW;
    IFR = 0;
    PieCtrlRegs.PIEIFR1.all = 0;
    PieCtrlRegs.PIEACK.bit.ACK1 = 0;
    EDIS;
    EINT;

    This code is working fine. Thanks foe your guidance.