- Silicon Labs Community
- Welcome and Announcements
- Silicon Labs Knowledge Base
- 8-bit MCU
- 32-bit MCU
- Bluetooth / Wi-Fi
- Other Products Category
- Optical/RH/Temp Sensor
- Other Products
- Hardware and Software Tools
- Simplicity Studio and Software
- General Discussions and Suggestions
- Chinese Forum
- Software Libraries
- Development Kits
- Reference Designs
- Third Party Tools
- White Papers
- Official Blog of Silicon Labs
- Chinese Blog
02-06-2017 10:12 AM
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?
02-08-2017 02:43 AM
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.
02-11-2017 12:56 PM
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.