The MCU firmware currently supports setting either a rising-edge interrupt or a falling-edge interrupt for a given GPIO, but not both simultaneously. Your 2nd call to gpio_register_interrupt() triggered the message "E invalid int mode for share irq: 128" you saw in the debug error log and returned a non-zero error status that your application did not check.
Detecting both rising and falling edges will require two GPIO inputs.
Thanks for the reply. The error message was from registering the second ISR on the same pin as you said.
However, further testing shows that when configuring a falling-edge interrupt on a GPIO, that interrupt is in fact triggered on both rising and falling edges. I'm not sure if this is the intended functionality or not, but I have verified this behavior by putting the input signal on an oscilloscope.
I have attached the code I am using. The external device is a 90 ppr quadrature encoder, so I am reading edges of two signals offset in phase by about 90 degrees. The ISRs are getting hit on both rising and falling edges.
Also, it seems that this very simple program I am running is suffering from terrible interrupt performance. When I limit the number of interrupts to ~20-30 per second, none are missed, but I was hoping to track the encoder position at 500+ edges per second. I thought the 100 MHz MCU would have no trouble with this, but am I mistaken? Is there a more efficient way to handle this task?
mcu_main.c.zip 535 bytes
Given that your original question about interrupt handlers on a single GPIO was already answered here, and your second question about the MCU interrupt performance has been answered in this other thread Edison MCU interrupt performance, we will continue with the support in your other thread. If you have any other question about the MCU interrupt performance, you can post it there.