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.

EK-TM4C123GXL: External edge interrupt is set to trigger on both rising and falling edges. Can I know which edge triggered the interrupt?

Part Number: EK-TM4C123GXL

I'm using Tiva C dev board. I've configured a GPIO pin to trigger an interrupt on both rising and falling edges. The same interrupt handler subroutine will be executed on both rising and falling edges. The logic I'm trying to implement will depend on which edge the interrupt was triggered on. Is there a way for me to check, for example via a status bit, on which edge the interrupt was issued?

I know I could solve this issue by using two pins, but I'm wondering if it is possible to do it with a single pin.

Kind regards,

Ahmad

  • I'm surprised that no one has (as of yet) responded.     And applaud your ready recognition that - "two pins" - configured to "complementary edge detection" - quickly/easily resolves your objective.    (that's a "KISS" solution - and one we heartily approve...)

    Reading your post - I visited the GPIO Section of "123 MCU Manual" - and found no such "specific edge detection latch/history" bit.    (among 7 or so GPIO, Interrupt handling Registers)    Now it may reveal (instead) w/in the "Interrupt Section" of the same manual - I've not checked...

    That said - if the arriving signal's "post edge" level is sufficently sustained - cannot you simply, "Read the GPIO pin" - immediately w/in your "either edge triggered ISR" - and in that manner - identify the "triggering edge?"

    To aid/abet this task - you'd do well to promote that GPIO interrupt to high (or highest) and invoke, "pre-emptive capability - so that you're insured of the fastest "GPIO pin level read."    (when "pre-emptive" an "already launched & executing interrupt" will be (temporarily) "kicked to the curb" - and your "GPIO pin's ISR signal read" will command "fastest attention!")

  • Hello Ahmad,

    To continue on with cb1's line of thought, I checked the GPIO interrupt section of the datasheet and didn't find anything that would provide an indicator of which edge triggered even when in 'both edge trigger' mode.

    I like cb1's idea of reading the GPIO pin ASAP via high priority interrupts and efficient ISR design. As long as your signal isn't too high frequency that would be the easiest way to do what you want short of using 2 pins.