# GPIO Interrupts

**URL:** <https://forums.developer.nvidia.com/t/gpio-interrupts/46404>\
**Category:** Jetson TX1\
**Created:** [November 26, 2016, 8:26am UTC](https://forums.developer.nvidia.com/t/gpio-interrupts/46404 "2016-11-26T08:26:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SagiS](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/sagis/32/17483_2.png) [@SagiS](https://forums.developer.nvidia.com/u/SagiS)\
**Post date:** [November 26, 2016, 8:26am UTC](https://forums.developer.nvidia.com/t/gpio-interrupts/46404/1 "2016-11-26T08:26:15Z")

</div>

Is there a way to get GPIO interrupts on the TX1? (as opposed to polling for values).  
I’m using Python, but any language would be appreciated.

---

<div class="post-metadata">

**Author:** ![linuxdev](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/linuxdev/32/10243_2.png) [@linuxdev](https://forums.developer.nvidia.com/u/linuxdev)\
**Post date:** [November 27, 2016, 12:44am UTC](https://forums.developer.nvidia.com/t/gpio-interrupts/46404/2 "2016-11-27T00:44:04Z")

</div>

Can you be more specific about the nature of what is driving the GPIO change, and what kind of performance issues you might be looking at obtaining or avoiding?

---

<div class="post-metadata">

**Author:** ![SagiS](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/sagis/32/17483_2.png) [@SagiS](https://forums.developer.nvidia.com/u/SagiS)\
**Post date:** [November 27, 2016, 10:31am UTC](https://forums.developer.nvidia.com/t/gpio-interrupts/46404/3 "2016-11-27T10:31:11Z")

</div>

I have an application which uses a “dismiss alarm” button hooked to a GPIO port.  
To check if the button has been pressed, I need to check the GPIO port’s status in a closed loop.  
Something like:

```auto
for (EVER) {
   check_if_pressed(GPIO_PORT);
   sleep(100ms)
}

```

This is both inefficient and unstable (once in a while I get some GPIO errors), and could even miss some brief presses.  
A better paradigm would be to get a callback when someone presses the button.

---

<div class="post-metadata">

**Author:** ![linuxdev](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/linuxdev/32/10243_2.png) [@linuxdev](https://forums.developer.nvidia.com/u/linuxdev)\
**Post date:** [November 27, 2016, 7:45pm UTC](https://forums.developer.nvidia.com/t/gpio-interrupts/46404/4 "2016-11-27T19:45:42Z")

</div>

Have you considered using ordinary file I/O with the “/sys” GPIO files? You could do this in combination with POSIX asynchronous I/O. See “man aio”.

If file I/O is too slow you might end up writing a driver to directly export events to a “/dev” event file.

---

<div class="post-metadata">

**Author:** ![TomNVIDIA](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/tomnvidia/32/14181_2.png) [@TomNVIDIA](https://forums.developer.nvidia.com/u/TomNVIDIA)\
**Post date:** [October 18, 2021, 7:00pm UTC](https://forums.developer.nvidia.com/t/gpio-interrupts/46404/5 "2021-10-18T19:00:44Z")

</div>

Closed on October 18, 2021, 7:00pm UTC


