kdb379: GPIO Pin Mapping for Jetson Carriers

Updated GPIO pin mapping for CTI Jetson carrier boards. Using the Jetson GPIO pins is primarily done using the Linux sysfs or the Jetson pin number.

To use a GPIO pin from the Jetson first it will need to be “exported”.  This tells the Tegra’s GPIO driver that the pin is to be used as a GPIO. The example below demonstrates how to export pin 186 to be used as a GPIO:

echo 186 > /sys/class/gpio/export

The GPIO Reference Table maps out which pin on your carrier maps to which sysfs pin number.  For this example we will continue using pin 186.

The pin can be set as either an input or an output. The following sets pin 186 to be an output:

echo  out > /sys/class/gpio/gpio186/direction

OR:

echo out > /sys/class/gpio/PH.00/direction

*Note that depending on board and JetPack version the pin may show up in /sys/class/gpio as it’s pin number (ex. PH.00), in this case you can still interact with the pin the same way by referencing it with it’s pin number instead.

While this would set pin 186 to be an input (default):

echo  in > /sys/class/gpio/gpio186/direction

Another option is changing if the pin is an “active high” (reads 1 when the pin is held high), or “active low” (reads 1 when the pin is held low). This is modified by writing a 0 or 1 to “active_low” this would set pin 186 to be active low:

echo  1 > /sys/class/gpio/gpio186/active_low

Now that the pin is setup, you can read or write to it using the “value” file.

This reads the current value of the pin, returning 1 or 0.

cat /sys/class/gpio/gpio186/value

While this writes a 1 to the pin (if the pin is configured to be an output)

echo 1 > /sys/class/gpio/gpio186/value

If you would like to monitor an input pin in the terminal to see if it is being toggled you can use this command.  It continuously reads the value of the pin every 0.1 seconds and shows it in the terminal.  It can be exited by using ctrl-c.

while [ True ] ; do echo -ne $(cat /sys/class/gpio/gpio186/value) “\r”; sleep 0.1;  done

Boson Carrier – NGX007/NGX017

Photon Carrier – NGX002/NGX003

Quark Carrier – NGX004/NGX014

Hadron Carrier – NGX012

Rogue for AGX Xavier – AGX101

Rogue for AGX Orin – AGX202

Forge for AGX Orin – AGX201

Rudi NX – ESG605

Rudi AGX – ESG610

Go to Top