GPIO control

Hello forum! I have a Jetson Xavier with lastest JetPack, but I can’t control GPIO. Example (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?

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.
  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-> [GPIO Changes] for the GPIO mapping formulas.
  4. another discussion thread, Topic 1001584 about GPIO you could refer to.

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 (https://pypi.org/project/Jetson.GPIO/) .

Hi briskiydmitry,

For an example of control on с, please see:

https://devtalk.nvidia.com/default/topic/1050109/jetson-nano/access-gpio-pins-using-quot-c-quot-programming/post/5342889/#5342889

@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.

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

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.