Unable to Get GPIO Working on Jetson Orin Nano

Hello,
I am using a Jetson Orin Nano Dev Kit with JetPack 6.0. I am trying to use GPIO for the first time, and I followed some research to set it up. Based on what I found, I ran the following command in the terminal:

sudo pip install Jetson.GPIO

The terminal responded that the library is already installed.

Next, I wrote the following Python code to test GPIO functionality:

import Jetson.GPIO as GPIO
import time

buzzer_pin = 12

GPIO.setmode(GPIO.BOARD)
GPIO.setup(buzzer_pin, GPIO.OUT, initial=GPIO.LOW)

def beep():
    for i in range(10):
        GPIO.output(buzzer_pin, GPIO.HIGH)
        time.sleep(0.0005)
        GPIO.output(buzzer_pin, GPIO.LOW)
        time.sleep(0.0005)

try:
    while True:
        beep()
        time.sleep(0.5)

except KeyboardInterrupt:
    print("Exiting gracefully")
    GPIO.cleanup()

For the wiring, I only connected the following two pins (see the wiring diagram below). However, it doesn’t matter which GPIO pins I use; I can change them if needed. I am only using the camera and not utilizing any other pins, so the choice of GPIO pins is flexible for me.

Some İnfo:

onur@ubuntu:~$ sudo gpioinfo
[sudo] password for onur: 
gpiochip0 - 164 lines:
	line   0:      "PA.00" "regulator-vdd-3v3-sd" output active-high [used]
	line   1:      "PA.01"       unused   input  active-high 
	line   2:      "PA.02"       unused   input  active-high 
	line   3:      "PA.03"       unused   input  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   input  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   input  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"       unused   input  active-high 
	line  48:      "PH.05"       unused   input  active-high 
	line  49:      "PH.06" "cam_reset_gpio" output active-high [used]
	line  50:      "PH.07"       unused  output  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  output  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  output  active-high 
	line  86:      "PN.02"       unused   input  active-high 
	line  87:      "PN.03"       unused   input  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   input  active-high 
	line 102:      "PQ.02"       unused   input  active-high 
	line 103:      "PQ.03"       unused  output  active-high 
	line 104:      "PQ.04"       unused   input  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   input  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  output  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"       unused   input  active-high 
	line 124:      "PY.02"       unused   input  active-high 
	line 125:      "PY.03"       unused   input  active-high 
	line 126:      "PY.04"       unused   input  active-high 
	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   input  active-high 
	line 131:      "PZ.01"  "interrupt"   input  active-high [used]
	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"       unused  output  active-high 
	line 139:     "PAC.01"       unused   input  active-high 
	line 140:     "PAC.02"       unused   input  active-high 
	line 141:     "PAC.03"       unused   input  active-high 
	line 142:     "PAC.04"       unused   input  active-high 
	line 143:     "PAC.05"       unused   input  active-high 
	line 144:     "PAC.06"       unused   input  active-high 
	line 145:     "PAC.07"       unused   input  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 
gpiochip1 - 32 lines:
	line   0:     "PAA.00"       unused   input  active-high 
	line   1:     "PAA.01"       unused   input  active-high 
	line   2:     "PAA.02"       unused   input  active-high 
	line   3:     "PAA.03"       unused   input  active-high 
	line   4:     "PAA.04"       unused  output  active-high 
	line   5:     "PAA.05" "regulator-vdd-3v3-pcie" output active-high [used]
	line   6:     "PAA.06"       unused   input  active-high 
	line   7:     "PAA.07"       unused   input  active-high 
	line   8:     "PBB.00"       unused   input  active-high 
	line   9:     "PBB.01"       unused   input  active-high 
	line  10:     "PBB.02"       unused   input  active-high 
	line  11:     "PBB.03"       unused  output  active-high 
	line  12:     "PCC.00"       unused  output  active-high 
	line  13:     "PCC.01"       unused  output  active-high 
	line  14:     "PCC.02"       unused  output  active-high 
	line  15:     "PCC.03"        "mux"  output  active-high [used]
	line  16:     "PCC.04"       unused   input  active-high 
	line  17:     "PCC.05"       unused   input  active-high 
	line  18:     "PCC.06"       unused   input  active-high 
	line  19:     "PCC.07"       unused   input  active-high 
	line  20:     "PDD.00"       unused   input  active-high 
	line  21:     "PDD.01"       unused   input  active-high 
	line  22:     "PDD.02"       unused   input  active-high 
	line  23:     "PEE.00"       unused   input  active-high 
	line  24:     "PEE.01"       unused   input  active-high 
	line  25:     "PEE.02"       unused   input  active-high 
	line  26:     "PEE.03"       unused   input  active-high 
	line  27:     "PEE.04"      "Power"   input   active-low [used]
	line  28:     "PEE.05"       unused   input  active-high 
	line  29:     "PEE.06"       unused   input  active-high 
	line  30:     "PEE.07"       unused   input  active-high 
	line  31:     "PGG.00"       unused   input  active-high 

However, it is not working, and I have no idea what I might be doing wrong. Could someone provide me with detailed guidance on how to fix this issue?

Thank you!
Any guidance would be greatly appreciated. Thank you! @AastaLLL , @AakankshaS @EduardoSalazar96, @allan.navarro, @proventusnova

hello onurrcifcii,

could you please give it a try with following to toggle a pin state change,
for instance, # gpioset --mode=wait --drive=push-pull gpiochip1 11=1

Hello @JerryChang

Thank you for the suggestion. it connected to pin31(J12 - 40 pin expansion header) for GPIO11 and tried running the following command in the terminal:

gpioset --mode=wait --drive=push-pull gpiochip1 11=1  

Unfortunately, it did not work. The pin state did not change, and there was no response from the connected device.

Could you provide further guidance or suggest additional steps to debug this issue? I would greatly appreciate your help.

hello onurrcifcii,

would you please also probe the pin to check it’s not toggling?

Thanks for interest @JerryChang ,

Here is the control for GPIO pin 11:

And here is the control for all pins:

While performing these tests, the terminal showed this status:

Is there anyone who can help? @JerryChang , @WayneWWW, @carolyuu , @KevinFFF, @ManuelLeiva , @linuxdev ,

BTW,
please refer to Topic 301171, there’s patch to address the issue cannot control GPIO in JP-6.

Hi @JerryChang ,

This is honestly quite difficult for me to understand, and I’m currently at a critical stage of my project. It needs to be completed within 2 weeks, so I cannot afford to take any risks or make mistakes. Could you please provide detailed guidance?

Thank you so much in advance!

hello onurrcifcii,

it requires re-compiling the kernel with the patch applied.
you may refer to Kernel Customization.

Hi @JerryChang ,

Thank you for your guidance so far. I would like to know if it is possible to perform this process (rebuilding the kernel with the patch) using the NVIDIA SDK Manager without resetting the board. If so, could you provide detailed instructions on how to proceed with it?

it’s kernel update, you may update /boot/Image after re-building the kernel image, reboot the system to have changes take effect.

Hi @JerryChang,

Hello,

When I run the following command to sync the kernel sources:

cd /usr/src
sudo ./source_sync.sh -k -t r36.6

I get the following error:

sudo: ./source_sync.sh: command not found

Here are the files in the /usr/src directory and here is the information about my board:

and

Could you please help me resolve this issue?

Which one is, I need to download for 36.3?

Thank you in advance!

Are you sure that is the correct release tag.

Hi,
I changed it to 36.3 and tried again with the same result.

image

You are also in the wrong directory.

/Linux_for_Tegra/source$

Yes, I think the latest version is 36.4 but I have 36.3 installed at the moment and that’s the result here.
Should I install 36.4, how do I do it without resetting?

How can i go or use to /Linux_for_Tegra/source$ directory there is no Linux_for_Tegra folder, I couldn’t find it.

Which one is, I need to download for this issue?

I believe its the top BSP package or the sources BSP. If it has Linux_for_Tegra in it, that would be correct one.

Update I am fairly certain its the one under sources : public_sources.tbz2
Its been a while since I touched that so please forgive my inaccuracy on this.

Hello,

I have downloaded and extracted the “Driver Package (BSP).” Now I am in the source directory, and when I run ls, I see the following output:

Is it wrong one? Should I download the other one? What should I do next?

I got these warnings, it downloaded some of them but could not complete them, can you help me?

generic_rt_build.sh  kernel_src_build_env.sh  nvbuild.sh       source_sync.sh
kernel               Makefile                 nv_src_build.sh
onur@ubuntu:~/Linux_for_Tegra/source$ ./source_sync.sh -k -t r36.3
Downloading default kernel/kernel-jammy-src source...
Cloning into '/home/onur/Linux_for_Tegra/source/kernel/kernel-jammy-src'...
remote: Enumerating objects: 8573906, done.
remote: Counting objects: 100% (8573906/8573906), done.
remote: Compressing objects: 100% (1246342/1246342), done.
remote: Total 8573906 (delta 7283235), reused 8566451 (delta 7275808), pack-reused 0
Receiving objects: 100% (8573906/8573906), 1.89 GiB | 5.00 MiB/s, done.
Resolving deltas: 100% (7283235/7283235), done.
Checking objects: 100% (33554432/33554432), done.
The default kernel/kernel-jammy-src source is downloaded in: /home/onur/Linux_for_Tegra/source/kernel/kernel-jammy-src
Couldn't find tag r36.3
/home/onur/Linux_for_Tegra/source/kernel/kernel-jammy-src source sync to tag r36.3 failed!


Downloading default nvgpu source...
Cloning into '/home/onur/Linux_for_Tegra/source/nvgpu'...
remote: Enumerating objects: 141714, done.
remote: Counting objects: 100% (141714/141714), done.
remote: Compressing objects: 100% (35526/35526), done.
remote: Total 141714 (delta 96588), reused 138482 (delta 93358), pack-reused 0
Receiving objects: 100% (141714/141714), 36.97 MiB | 4.32 MiB/s, done.
Resolving deltas: 100% (96588/96588), done.
The default nvgpu source is downloaded in: /home/onur/Linux_for_Tegra/source/nvgpu
Couldn't find tag r36.3
/home/onur/Linux_for_Tegra/source/nvgpu source sync to tag r36.3 failed!


Downloading default nvidia-oot source...
Cloning into '/home/onur/Linux_for_Tegra/source/nvidia-oot'...
remote: Enumerating objects: 30516, done.
remote: Counting objects: 100% (30516/30516), done.
remote: Compressing objects: 100% (12959/12959), done.
remote: Total 30516 (delta 16575), reused 29028 (delta 15089), pack-reused 0
Receiving objects: 100% (30516/30516), 23.30 MiB | 2.56 MiB/s, done.
Resolving deltas: 100% (16575/16575), done.
The default nvidia-oot source is downloaded in: /home/onur/Linux_for_Tegra/source/nvidia-oot
Couldn't find tag r36.3
/home/onur/Linux_for_Tegra/source/nvidia-oot source sync to tag r36.3 failed!


Downloading default hwpm source...
Cloning into '/home/onur/Linux_for_Tegra/source/hwpm'...
remote: Enumerating objects: 2142, done.
remote: Counting objects: 100% (2142/2142), done.
remote: Compressing objects: 100% (1363/1363), done.
remote: Total 2142 (delta 623), reused 2096 (delta 579), pack-reused 0
Receiving objects: 100% (2142/2142), 1.38 MiB | 1.07 MiB/s, done.
Resolving deltas: 100% (623/623), done.
The default hwpm source is downloaded in: /home/onur/Linux_for_Tegra/source/hwpm
Couldn't find tag r36.3
/home/onur/Linux_for_Tegra/source/hwpm source sync to tag r36.3 failed!


Downloading default nvethernetrm source...
Cloning into '/home/onur/Linux_for_Tegra/source/nvethernetrm'...
remote: Enumerating objects: 4881, done.
remote: Counting objects: 100% (4881/4881), done.
remote: Compressing objects: 100% (2654/2654), done.
remote: Total 4881 (delta 2773), reused 4317 (delta 2209), pack-reused 0
Receiving objects: 100% (4881/4881), 3.76 MiB | 1.77 MiB/s, done.
Resolving deltas: 100% (2773/2773), done.
The default nvethernetrm source is downloaded in: /home/onur/Linux_for_Tegra/source/nvethernetrm
Couldn't find tag r36.3
/home/onur/Linux_for_Tegra/source/nvethernetrm source sync to tag r36.3 failed!


Downloading default hardware/nvidia/t23x/nv-public source...
Cloning into '/home/onur/Linux_for_Tegra/source/hardware/nvidia/t23x/nv-public'...
remote: Enumerating objects: 2575, done.
remote: Counting objects: 100% (2575/2575), done.
remote: Compressing objects: 100% (1307/1307), done.
remote: Total 2575 (delta 1660), reused 2143 (delta 1230), pack-reused 0
Receiving objects: 100% (2575/2575), 954.20 KiB | 595.00 KiB/s, done.
Resolving deltas: 100% (1660/1660), done.
The default hardware/nvidia/t23x/nv-public source is downloaded in: /home/onur/Linux_for_Tegra/source/hardware/nvidia/t23x/nv-public
Couldn't find tag r36.3
/home/onur/Linux_for_Tegra/source/hardware/nvidia/t23x/nv-public source sync to tag r36.3 failed!


Downloading default hardware/nvidia/tegra/nv-public source...
Cloning into '/home/onur/Linux_for_Tegra/source/hardware/nvidia/tegra/nv-public'...
remote: Enumerating objects: 107, done.
remote: Counting objects: 100% (107/107), done.
remote: Compressing objects: 100% (46/46), done.
remote: Total 107 (delta 68), reused 82 (delta 44), pack-reused 0
Receiving objects: 100% (107/107), 18.69 KiB | 4.67 MiB/s, done.
Resolving deltas: 100% (68/68), done.
The default hardware/nvidia/tegra/nv-public source is downloaded in: /home/onur/Linux_for_Tegra/source/hardware/nvidia/tegra/nv-public
Couldn't find tag r36.3
/home/onur/Linux_for_Tegra/source/hardware/nvidia/tegra/nv-public source sync to tag r36.3 failed!


Downloading default nvdisplay source...
Cloning into '/home/onur/Linux_for_Tegra/source/nvdisplay'...
remote: Enumerating objects: 2865, done.
remote: Counting objects: 100% (2865/2865), done.
remote: Compressing objects: 100% (2451/2451), done.
remote: Total 2865 (delta 1478), reused 1590 (delta 204), pack-reused 0
Receiving objects: 100% (2865/2865), 4.66 MiB | 2.02 MiB/s, done.
Resolving deltas: 100% (1478/1478), done.
The default nvdisplay source is downloaded in: /home/onur/Linux_for_Tegra/source/nvdisplay
Couldn't find tag r36.3
/home/onur/Linux_for_Tegra/source/nvdisplay source sync to tag r36.3 failed!


Downloading default dtc-src/1.4.5 source...
Cloning into '/home/onur/Linux_for_Tegra/source/dtc-src/1.4.5'...
remote: Enumerating objects: 394, done.
remote: Counting objects: 100% (394/394), done.
remote: Compressing objects: 100% (326/326), done.
remote: Total 394 (delta 49), reused 355 (delta 11), pack-reused 0
Receiving objects: 100% (394/394), 308.89 KiB | 291.00 KiB/s, done.
Resolving deltas: 100% (49/49), done.
The default dtc-src/1.4.5 source is downloaded in: /home/onur/Linux_for_Tegra/source/dtc-src/1.4.5
Couldn't find tag r36.3
/home/onur/Linux_for_Tegra/source/dtc-src/1.4.5 source sync to tag r36.3 failed!


ln: failed to create symbolic link 'nvidia-oot/drivers/net/ethernet/nvidia/nvethernet/nvethernetrm': No such file or directory

source sync and manual download can both download the source code. If you already manually downloaded the source code, then you don’t need to run source_sync.sh anymore. Just go to next step.