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.

CCS/TMS320F28027: Interrupt is not working well in my custom board

Part Number: TMS320F28027
Other Parts Discussed in Thread: CONTROLSUITE

Tool/software: Code Composer Studio

Hii all,

        I am started working on C28x picolo F28027 custom board on CCS V6, here i am trying to enable the external interrupt but control is going to isr_interupt handler only once, if i want to go one more time to the isr i have to reboot the controller. i.e., i realized pullup has to enable to that particular pin (here GPIO0). 

        After enabling the pullup register, now interrupt is not even generating once while i connect the GPIO0 pin to 3.3v source, I am using the Example code from ControlSuite.

       Here, is my attached code below,

void main(void)
{

InitSysCtrl();

DINT;

InitPieCtrl();

IER = 0x0000;
IFR = 0x0000;

InitPieVectTable();

EALLOW;
PieVectTable.XINT1 = &xint1_isr;
EDIS

PieCtrlRegs.PIECTRL.bit.ENPIE = 1; // Enable the PIE block
PieCtrlRegs.PIEIER1.bit.INTx4 = 1; // Enable PIE Gropu 1 INT4
IER |= M_INT1; // Enable CPU INT1
EINT; // Enable Global Interrupts

EALLOW;
GpioCtrlRegs.GPAPUD.bit.GPIO0 = 0; // GPIOPullup
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0; // GPIO
GpioCtrlRegs.GPADIR.bit.GPIO0 = 0; // input
GpioCtrlRegs.GPAQSEL1.bit.GPIO0 = 0; // XINT1 Synch to SYSCLKOUT only
EDIS;

EALLOW;
GpioIntRegs.GPIOXINT1SEL.bit.GPIOSEL = 0; // XINT1 is GPIO0
EDIS;
XIntruptRegs.XINT1CR.bit.POLARITY = 0; // Falling edge interrupt
XIntruptRegs.XINT1CR.bit.ENABLE = 1; // Enable XINT1

for(;;);

}

interrupt void xint1_isr(void)
{

Xint1Count++;

PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}

-----------------------------------------------------------------

Please get me out of this problem, 

Thanks in Advance.

Regards,

Narasimha

  • Hi Narasimha,

    Please note that the external interrupt functionality is edge-triggered (as opposed to level-triggered).  Based on the software you're showing, the interrupt will not fire until GPIO00 transitions low (and this may not be occurring).

    ===

    Two extra comments, which may help you, depending on what you're trying to do:

    Inside the external interrupt you could read the value of the pin (by looking at GPADAT) and choose to only clear the interrupt if the GPIO has went back high. 

    Alternatively, if what you are looking for is a level-triggered interrupt from an external source, the Trip-Zone submodules' interrupts provide you a good option.


    Thank you,
    Brett

  • Hi Narasimha,

    If you select a falling edge interrupt configuration the interrupt will only trigger when GPIO line is externally driven low.

    From what you wrote I understood that you are connecting the GPIO line to 3v3 which is why your interrupt is not triggered.

    If you connect the GPIO line through a resistor to ground, it would drive the pin low and trigger the falling edge interrupt.

    The second interrupt would not trigger until path to ground is disconnected and connected again to generate a falling edge. (3v3 -> 0V).

    I did not check datasheet to see if your setup is correct, I trust that comments at the end of lines are correct.

    hope this helps,

    Ugnius
  • Hii all,

           I am configuring the GPIO0 as an edge triggered interrupt, according to datasheet 

    actually my task is to generate an interrupt for both Raising edge and falling edge for that i kept the polarity = 3;

    Before this i just tried for the configuration mentoned in the above post, But for these two configurations (Polarity 0 & 3) i didn't get single time interrupt also(Pullup enabled internally by GPAPUD.bit.GPIO0 = 0).

    Is there any need to disable the inetrrupt before ack in the isr handler?

    Regards,

    Narasimha

  • No, you do not have to disable interrupts to issue an ack. Like Brett suggested you can look at GPADAT registered to see what state processor thinks the GPIO0 is in. It might be that the interrupt does not happen if you drive the GPIO line incorrectly.

    i.e. with pull-up disabled the GPIO would be normally 0 and if you connect external 3v3 to the pin it would go to 1.

    With pull-up enabled the GPIO would be normally 1 and if you connect external GND(through a resistor) to the pin it would go to 0.

    Observing GPADAT register while you change the pin state would show you if your set up is correct.

    For example, if you have pull-up enabled and connect 3v3 to the pin externally, this gives no effect as default state was 1.

    This should help determine if there is a problem with the interrupt detection or the input edge generation.
  • Hii all,

            Thanks to all for giving support, I got solve my problem I just removed the GPIO pull up disable register and gave proper qualification for that GPIO, and just run my code with both raising edge and falling edge and the external interrupt is working fine.

    Thanks & Regards,

    Narsimha