Jetson AGX Orin DevKit Pinmux with gpiod

I am trying to use the gpiod library to control my gpio pins but am struggling to figure out what pins are what.
running gpioinfo gpiochip0 it looks like this which to me doesnt provide much info. From the official documentation I realise that I am supposed to use the pinmux spreadsheet to find what pin is named what (PA.00 etc) but I cant find it on the sheet. Could someone provide an example of how to find the name for the physical pin 8 on the board with the spreadsheet?

gpioinfo gpiochip0
gpiochip0 - 164 lines:
line 0: “PA.00” “regulator-vdd-3v3-sd” output active-high [used]
line 1: “PA.01” “regulator-vdd-12v-pcie” output active-low [used]
line 2: “PA.02” unused output active-high
line 3: “PA.03” unused output active-high
line 4: “PA.04” unused input active-high
line 5: “PA.05” unused input active-high
line 6: “PA.06” unused input active-high
line 7: “PA.07” unused input active-high
line 8: “PB.00” unused input active-high
line 9: “PC.00” unused input active-high
line 10: “PC.01” unused input active-high
line 11: “PC.02” unused input active-high
line 12: “PC.03” unused input active-high
line 13: “PC.04” unused input active-high
line 14: “PC.05” unused input active-high
line 15: “PC.06” unused input active-high
line 16: “PC.07” unused input active-high
line 17: “PD.00” unused input active-high
line 18: “PD.01” unused input active-high
line 19: “PD.02” unused input active-high
line 20: “PD.03” unused input active-high
line 21: “PE.00” unused input active-high
line 22: “PE.01” unused input active-high
line 23: “PE.02” unused input active-high
line 24: “PE.03” unused input active-high
line 25: “PE.04” unused input active-high
line 26: “PE.05” unused input active-high
line 27: “PE.06” unused input active-high
line 28: “PE.07” unused input active-high
line 29: “PF.00” unused input active-high
line 30: “PF.01” unused input active-high
line 31: “PF.02” unused input active-high
line 32: “PF.03” unused input active-high
line 33: “PF.04” unused input active-high
line 34: “PF.05” unused input active-high
line 35: “PG.00” “Force Recovery” input active-low [used]
line 36: “PG.01” unused input active-high
line 37: “PG.02” “Suspend” input active-low [used]
line 38: “PG.03” unused output active-high
line 39: “PG.04” unused input active-high
line 40: “PG.05” unused input active-high
line 41: “PG.06” unused input active-high
line 42: “PG.07” “cd” input active-low [used]
line 43: “PH.00” unused input active-high
line 44: “PH.01” unused output active-high
line 45: “PH.02” unused input active-high
line 46: “PH.03” “camera-control-output-low” output active-high [used]
line 47: “PH.04” “regulator-vdd-3v3-pcie” output active-high [used]
line 48: “PH.05” unused output active-high
line 49: “PH.06” “camera-control-output-low” output active-high [used]
line 50: “PH.07” unused input active-high
line 51: “PI.00” unused input active-high
line 52: “PI.01” unused input active-high
line 53: “PI.02” unused input active-high
line 54: “PI.03” unused input active-high
line 55: “PI.04” unused input active-high
line 56: “PI.05” kernel input active-high [used]
line 57: “PI.06” unused input active-high
line 58: “PJ.00” unused input active-high
line 59: “PJ.01” unused input active-high
line 60: “PJ.02” unused input active-high
line 61: “PJ.03” unused input active-high
line 62: “PJ.04” unused input active-high
line 63: “PJ.05” unused input active-high
line 64: “PK.00” unused input active-high
line 65: “PK.01” unused input active-high
line 66: “PK.02” unused input active-high
line 67: “PK.03” unused input active-high
line 68: “PK.04” unused input active-high
line 69: “PK.05” unused output active-high
line 70: “PK.06” unused input active-high
line 71: “PK.07” unused input active-high
line 72: “PL.00” unused input active-high
line 73: “PL.01” unused input active-high
line 74: “PL.02” unused input active-high
line 75: “PL.03” unused input active-high
line 76: “PM.00” kernel input active-high [used]
line 77: “PM.01” unused input active-high
line 78: “PM.02” unused input active-high
line 79: “PM.03” unused input active-high
line 80: “PM.04” unused input active-high
line 81: “PM.05” unused input active-high
line 82: “PM.06” unused input active-high
line 83: “PM.07” unused input active-high
line 84: “PN.00” unused input active-high
line 85: “PN.01” unused input active-high
line 86: “PN.02” unused input active-high
line 87: “PN.03” unused output active-high
line 88: “PN.04” unused input active-high
line 89: “PN.05” unused input active-high
line 90: “PN.06” unused input active-high
line 91: “PN.07” unused input active-high
line 92: “PP.00” unused input active-high
line 93: “PP.01” unused input active-high
line 94: “PP.02” unused input active-high
line 95: “PP.03” unused input active-high
line 96: “PP.04” unused input active-high
line 97: “PP.05” unused input active-high
line 98: “PP.06” unused input active-high
line 99: “PP.07” unused input active-high
line 100: “PQ.00” unused input active-high
line 101: “PQ.01” unused output active-high
line 102: “PQ.02” unused input active-high
line 103: “PQ.03” unused input active-high
line 104: “PQ.04” unused output active-high
line 105: “PQ.05” unused input active-high
line 106: “PQ.06” unused input active-high
line 107: “PQ.07” unused input active-high
line 108: “PR.00” unused output active-high
line 109: “PR.01” unused input active-high
line 110: “PR.02” unused input active-high
line 111: “PR.03” unused input active-high
line 112: “PR.04” unused input active-high
line 113: “PR.05” unused input active-high
line 114: “PX.00” kernel input active-high [used]
line 115: “PX.01” kernel input active-high [used]
line 116: “PX.02” unused input active-high
line 117: “PX.03” unused input active-high
line 118: “PX.04” unused input active-high
line 119: “PX.05” unused input active-high
line 120: “PX.06” unused input active-high
line 121: “PX.07” unused input active-high
line 122: “PY.00” unused output active-high
line 123: “PY.01” “phy_reset” output active-high [used]
line 124: “PY.02” unused output active-high
line 125: “PY.03” “interrupt” input active-high [used]
line 126: “PY.04” “interrupt” input active-high [used]
line 127: “PY.05” unused input active-high
line 128: “PY.06” unused input active-high
line 129: “PY.07” unused input active-high
line 130: “PZ.00” unused output active-high
line 131: “PZ.01” unused input active-high
line 132: “PZ.02” unused input active-high
line 133: “PZ.03” unused input active-high
line 134: “PZ.04” unused input active-high
line 135: “PZ.05” unused input active-high
line 136: “PZ.06” unused input active-high
line 137: “PZ.07” unused input active-high
line 138: “PAC.00” “camera-control-output-low” output active-high [used]
line 139: “PAC.01” “camera-control-output-low” output active-high [used]
line 140: “PAC.02” unused output active-high
line 141: “PAC.03” unused input active-high
line 142: “PAC.04” unused input active-high
line 143: “PAC.05” “interrupt” input active-high [used]
line 144: “PAC.06” unused input active-high
line 145: “PAC.07” unused output active-high
line 146: “PAD.00” unused input active-high
line 147: “PAD.01” unused input active-high
line 148: “PAD.02” unused input active-high
line 149: “PAD.03” unused input active-high
line 150: “PAE.00” unused input active-high
line 151: “PAE.01” unused input active-high
line 152: “PAF.00” unused input active-high
line 153: “PAF.01” unused input active-high
line 154: “PAF.02” unused input active-high
line 155: “PAF.03” unused input active-high
line 156: “PAG.00” unused input active-high
line 157: “PAG.01” unused input active-high
line 158: “PAG.02” unused input active-high
line 159: “PAG.03” unused input active-high
line 160: “PAG.04” unused input active-high
line 161: “PAG.05” unused input active-high
line 162: “PAG.06” unused input active-high
line 163: “PAG.07” unused input active-high

*** Please note that this reply is generated by LLM automatically ***

I’d be happy to help you with your question!

It appears that you’re trying to use the gpiod library to control your GPIO pins, but you’re having trouble figuring out which pins correspond to which names (e.g., PA.00, PB.00, etc.). You’ve run the gpioinfo gpiochip0 command, which provides a list of GPIO lines, but you’re not sure how to match these lines to the physical pins on your board.

To solve this problem, you’ll need to consult the pinmux spreadsheet for your specific board. The pinmux spreadsheet is a document that maps the physical pins on your board to the corresponding GPIO lines.

Here’s a step-by-step guide to help you find the name for physical pin 8 on your board using the pinmux spreadsheet:

  1. Locate the pinmux spreadsheet: You’ll need to find the pinmux spreadsheet for your specific board. This document is usually provided by the board manufacturer or can be found on their website. If you’re having trouble finding it, try searching for “pinmux spreadsheet” along with your board’s name.
  2. Identify the GPIO chip: In your gpioinfo gpiochip0 output, you’ll see a list of GPIO lines starting from line 0. The GPIO chip is usually labeled as “gpiochip0” or “gpiochip1”, etc. Make a note of the GPIO chip number that corresponds to the lines you’re interested in.
  3. Find the physical pin number: Look for physical pin 8 on your board. You can usually find this information in the board’s datasheet or user manual.
  4. Match the physical pin to the GPIO line: In the pinmux spreadsheet, look for the row that corresponds to physical pin 8. The spreadsheet should have columns for the physical pin number, GPIO line number, and GPIO name (e.g., PA.00, PB.00, etc.). Match the physical pin number to the corresponding GPIO line number.
  5. Verify the GPIO name: Once you’ve found the GPIO line number, verify that it matches the GPIO name in the gpioinfo gpiochip0 output. You should see the GPIO name (e.g., PA.00, PB.00, etc.) next to the line number.

Here’s an example of what the pinmux spreadsheet might look like:

Physical Pin Number GPIO Line Number GPIO Name
1 0 PA.00
2 1 PA.01
3 2 PA.02
8 7 PB.00

In this example, physical pin 8 corresponds to GPIO line 7, which has the name PB.00.

Comparison to GitHub:

While GitHub is a platform for software development and version control, it’s not directly related to the problem you’re trying to solve. However, if you’re working on a project that involves GPIO programming, you might use GitHub to host and manage your code.

Additional resources:

  • If you’re new to GPIO programming, you might want to check out some tutorials or documentation on the subject. The gpiod library documentation is a good place to start.
  • If you’re having trouble finding the pinmux spreadsheet for your board, try contacting the manufacturer or searching online for more information.

I hope this helps! Let me know if you have any further questions.

Please refer to the following line in AGX Orin pinmux spreadsheet for PA.00
image

What do you mean about physical pin 8?
Do you mean the PIN8 of 40pins-header?

Hi Kevin,

Yes I mean PIN8 on the 40pin header. Right now i have it connected to a solenoid that i want to control turning on and off, but I don’t know which line i should be setting to high with gpioset to achieve this. At the end of the day I would like to control these pins as GPIO in my C++ code and from what I’ve found, with Jetpack 6, gpiod is the only way to do it now. I also am trying to do this within a ros2 node, so sudo privileges wont work.

Please configure it as following in pinmux spreadsheet first.
image

And, you can simply run the following command to control this pin through gpioset.

# gpioset --mode=wait `gpiofind "PR.02"`=1
# gpioset --mode=wait `gpiofind "PR.02"`=0
1 Like

This worked in the terminal thank you Kevin! I was wondering if you knew how to use this library in C++ code to execute the same kind of commands? I was trying to find resources online but have not been successful.

You can use gpiod library for c++ to do this task.
I found similar post for this requirement, please refer to Using c++ libgpiod library, how can I set gpio lines to be outputs and manipulate single lines with set_value() function? - Stack Overflow for details.