# GPIO control

**URL:** <https://forums.developer.nvidia.com/t/gpio-control/74659>\
**Category:** Jetson AGX Xavier\
**Created:** [May 14, 2019, 9:54am UTC](https://forums.developer.nvidia.com/t/gpio-control/74659 "2019-05-14T09:54:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![briskiydmitry](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@briskiydmitry](https://forums.developer.nvidia.com/u/briskiydmitry)\
**Post date:** [May 14, 2019, 9:54am UTC](https://forums.developer.nvidia.com/t/gpio-control/74659/1 "2019-05-14T09:54:47Z")

</div>

Hello forum! I have a Jetson Xavier with lastest JetPack, but I can’t control GPIO. Example ([Blinking LEDs on NVIDIA Jetson Xavier, Jetson TX2, and Raspberry Pi in 4K - YouTube](https://www.youtube.com/watch?time_continue=1060&v=2LctZ8n1Wl0)) shows a dir /sys/class/gpio/gpio393 to contol GPIO. But I have no such similar. How can I do this?

---

<div class="post-metadata">

**Author:** ![JerryChang](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/jerrychang/32/14043_2.png) [@JerryChang](https://forums.developer.nvidia.com/u/JerryChang)\
**Post date:** [May 15, 2019, 6:21am UTC](https://forums.developer.nvidia.com/t/gpio-control/74659/2 "2019-05-15T06:21:23Z")

</div>

hello briskiydmitry,

may I know which pin you would like to control?

some information as below for your reference.

1. you should check the module pin names in [Jetson AGX Xavier Pinmux](http://developer.nvidia.com/embedded/dlc/jetson-xavier-pinmux).
2. please refer to Xavier’s GPIO definitions,  
$TOP/kernel\_src/kernel/nvidia/include/dt-bindings/gpio/tegra194-gpio.h
3. please also refer to [Tegra Linux Driver Package TX2 Adaptation Guide](https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-282/Tegra%20Linux%20Driver%20Package%20Development%20Guide/baggage/Tegra_Linux_Driver_Package_TX2_Adaptation_Guide.pdf) → [GPIO Changes] for the GPIO mapping formulas.
4. another discussion thread, [Topic 1001584](https://devtalk.nvidia.com/default/topic/1001584/jetson-tx2/gpio-pinmux/post/5226482/#5226482) about GPIO you could refer to.

---

<div class="post-metadata">

**Author:** ![briskiydmitry](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@briskiydmitry](https://forums.developer.nvidia.com/u/briskiydmitry)\
**Post date:** [May 15, 2019, 12:59pm UTC](https://forums.developer.nvidia.com/t/gpio-control/74659/3 "2019-05-15T12:59:20Z")

</div>

Thx. These materials helped me a lot. It would be great to get an example of control on с / с ++. I found a ready solution in python, what if it could be useful to someone ([Jetson.GPIO · PyPI](https://pypi.org/project/Jetson.GPIO/)) .

---

<div class="post-metadata">

**Author:** ![ManuelLeiva](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/manuelleiva/32/273049_2.png) [@ManuelLeiva](https://forums.developer.nvidia.com/u/ManuelLeiva)\
**Post date:** [May 24, 2019, 4:29pm UTC](https://forums.developer.nvidia.com/t/gpio-control/74659/4 "2019-05-24T16:29:23Z")

</div>

Hi briskiydmitry,

For an example of control on с, please see:

[url][https://devtalk.nvidia.com/default/topic/1050109/jetson-nano/access-gpio-pins-using-quot-c-quot-programming/post/5342889/#5342889[/url]](https://devtalk.nvidia.com/default/topic/1050109/jetson-nano/access-gpio-pins-using-quot-c-quot-programming/post/5342889/#5342889%5B/url%5D)

---

<div class="post-metadata">

**Author:** ![jfernandez](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jfernandez](https://forums.developer.nvidia.com/u/jfernandez)\
**Post date:** [August 17, 2019, 1:07pm UTC](https://forums.developer.nvidia.com/t/gpio-control/74659/5 "2019-08-17T13:07:12Z")

</div>

@JerryChang

The discussion thread you mention just describes problems, but no solutions. I in particular can’t drive a pin, although everything seems ok. I can export the pin, change direction to output and write a value, but the output never changes - it is always the same -

This is clearly some goof-up, otherwise exporting the pin will always fail.

So the question is has anyone(perhaps you) got it to work and how? And why are there some many posts on GPIO but no solution to correct it.

---

<div class="post-metadata">

**Author:** ![snarky](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/snarky/32/10446_2.png) [@snarky](https://forums.developer.nvidia.com/u/snarky)\
**Post date:** [August 19, 2019, 7:33pm UTC](https://forums.developer.nvidia.com/t/gpio-control/74659/6 "2019-08-19T19:33:36Z")

</div>

Here’s an example for driving GPIO from user level C/C++:

> **[GitHub - jwatte/jetson-gpio-example: Simple example of memory-mapped NVIDIA Jetson GPIO...](https://github.com/jwatte/jetson-gpio-example)**
>
> Simple example of memory-mapped NVIDIA Jetson GPIO access from user space C code

Note that the specific GPIO port names/addresses are taken from the Jetson Nano; you’d have to update the code to match the address map of the Xavier.

---

<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, 6:24pm UTC](https://forums.developer.nvidia.com/t/gpio-control/74659/7 "2021-10-18T18:24:04Z")

</div>

Closed on October 18, 2021, 6:24pm UTC


