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.

interrupts

Dear all

I'm trying to use interrupt on GPIO Pin, in this case PE5 pin. I fixed the interrupt on falling edge.

Loop enter into the interrapt routine but continue to eneter in it forever.

Following my code:

void IntGPIOe(void){
   
   while (1){
        
       value= (GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_5));
       if (value!= 0) break;
 }
 
    
     GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_7, 0x80);

     SysCtlDelay(1000000);

    GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_7, 0x00);
   
   SysCtlDelay(1000000);
   
}



int main(void) {
 
    // Run from the PLL at 120 MHz.
    ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                       SYSCTL_OSC_MAIN |
                                       SYSCTL_USE_PLL |
                                       SYSCTL_CFG_VCO_480), 120000000);

        
      SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ);               
     GPIOPinTypeGPIOOutput(GPIO_PORTQ_BASE, GPIO_PIN_7);  // PQ7 as outputs
     
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    GPIOPinTypeGPIOInput(GPIO_PORTE_BASE, GPIO_PIN_5);            // PE5 as input
    GPIOIntTypeSet(GPIO_PORTE_BASE, GPIO_PIN_5, GPIO_FALLING_EDGE);  // interrupt on Falling edge
    GPIOIntEnable(GPIO_PORTE_BASE, GPIO_INT_PIN_5);
    IntEnable(INT_GPIOE);

    // Loop forever.
    //
    while(1) ;
  
}

Code enter in the interrupt service routine  when I press the button, then continue to enter in it.

Any Idea?

Thanks for all

Marco

  • Hello Marco,

    You need to clear the Interrupt in the Interrupt Handler.

    use the return value from the function GPIOPinIntStatus(GPIO_PORTQ_BASE,true) to get which pin caused interrupt and then use GPIOPinIntClear(GPIO_PORTQ_BASE,<retunr value>) to clear the interrupt condition

    Regards

    Amit