GPIO_PortClearInterruptFlags not working

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GPIO_PortClearInterruptFlags not working

858 Views
rudycoppens
Contributor III

Hardware:

- MKE14F16

Software:

MCUXpresso IDE 10.1.1

I made a simple program when there is an interrupt on pin 7 from port A clear the interrupt pin.

But the function "GPIO_PortClearInterruptFlags(GPIOA, 1U <<  7U);" doesn't clear the flag...

Bit eight stays high. 

void IRQ_HANDLER_PORT_A(void)
{

   uint32_t Interrupt_Flags_A = GPIO_PortGetInterruptFlags(GPIOA);
   if((Interrupt_Flags_A >> 7u) & 1)
   {
      GPIO_PortClearInterruptFlags(GPIOA, 1u << 7);
      Interrupt_Flags_A = GPIO_PortGetInterruptFlags(GPIOA);
      DisableIRQ(PORTA_IRQn);

}

Tags (1)
0 Kudos
2 Replies

622 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Rudy Coppens

Could you clarify how you set your interruption in the GPIO module? Will it detect a falling edge? also, are you able to see that you get into the interrupt handler?

I use the code that you post and I can see that the interrupt flag is correctly cleared.

Best regards

Jorge Alcala

0 Kudos

622 Views
rudycoppens
Contributor III

Thanks for your reaction!

Yes I get into the interrupt handler. I putted there a break point and step through the code. 

That's why I did two times the reading of the flags. First, is the flag high than a clear on the interrupt flag and a reading again. 

It is always high... Maybe it takes some more time to clear the flag? 

0 Kudos