Posts: 143
Registered: ‎10-03-2015

Clearing Interrupts

There is probably probably a simple solution to the below. Still learning...


I have a pin configured as an interrupt. It is a constant pulsing input between 10 and 400Hz. 


The input is enabled and then disabled for short periods of time to do some measurements. Even when the interrupt is disabled, there is activity on the pin. To enable the interrupt I use:





To disable the interrupt when it is no longer needed I use:








With the above approach the interrupt flag is still set for the input even after I clear the flag and disable the interrupt.  This is an issue when another input interrupt is triggered and I can't tell what the actual source was.




What is the proper way to disable a pin so that the interrupt flag will not get set? GPIO_ExtIntConfig does not seem to work here either. Do I have change the pin mode?


Posts: 81
Registered: ‎07-12-2016

Re: Clearing Interrupts

hi Superpanda


In fact, we can find some example code about the gpio interrupt, for example AN0012.


And I also did a simple experiment to enable/disable the gpio interrupt base on AN0012 with EFM32TG, enable the PD8 interrupt with GPIO_IntConfig(gpioPortD, 8, false, true, true); and disable the interrupt in the ISR with GPIO_IntConfig(gpioPortD, 8, false, true, false); After disable the interrupt no any interrupt will be observed.



Posts: 143
Registered: ‎10-03-2015

Re: Clearing Interrupts

I did follow AN0012 as well. The interrupt can in fact be disabled as you observed, however...


Even with the interrupt disabled the interrupt flag is getting set when there is activity on the pin so when another interrupt from a different pin fires and I read the interrupts to clear, the disabled interrupt's flag is set. Odd.


I built a work-around in the mean time, but I still think I am either not doing something proper or not understanding the behavior.