Skip to content

GPIO not working on Jetson Orin Nano Super Developer Kit #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sarmadgulzar opened this issue Feb 13, 2025 · 10 comments
Open

GPIO not working on Jetson Orin Nano Super Developer Kit #120

sarmadgulzar opened this issue Feb 13, 2025 · 10 comments

Comments

@sarmadgulzar
Copy link

sarmadgulzar commented Feb 13, 2025

Device: NVIDIA Jetson Orin Nano Super Developer Kit
OS: Ubuntu 22.04.5 LTS (Jammy Jellyfish) with Jetpack 6.2
SSD: Samsung 980 NVMe M.2

The LED is not blinking when I run the samples/simple_out.py

Here's my code:

$ cat blink_led.py 
import RPi.GPIO as GPIO
import time

# Pin Definitions
output_pin = 18  # BCM pin 18, BOARD pin 12

def main():
    # Pin Setup:
    GPIO.setmode(GPIO.BCM)  # BCM pin-numbering scheme from Raspberry Pi
    # set pin as an output pin with optional initial state of HIGH
    GPIO.setup(output_pin, GPIO.OUT, initial=GPIO.HIGH)

    print("Starting demo now! Press CTRL+C to exit")
    curr_value = GPIO.HIGH
    try:
        while True:
            time.sleep(1)
            # Toggle the output every second
            print("Outputting {} to pin {}".format(curr_value, output_pin))
            GPIO.output(output_pin, curr_value)
            curr_value ^= GPIO.HIGH
    finally:
        GPIO.cleanup()

if __name__ == '__main__':
    main()

I've installed the library into the global Python installation:

$ pip3 freeze | grep Jetson
Jetson.GPIO==2.1.9

I've setup the permissions as described here: https://github.com/NVIDIA/jetson-gpio?tab=readme-ov-file#setting-user-permissions

I've also run export JETSON_MODEL_NAME=JETSON_ORIN_NANO as described in #116

The positive leg of LED is connected to pin 12 on the board and the negative leg is connected to GND on pin 6. I can confirm that LED works if I connect the positive leg of the LED to pin 1 which is 3.3v.

Any ideas what I might be doing wrong?

@anhmiuhv
Copy link
Collaborator

Please refer to
#114 (comment)

@anhmiuhv
Copy link
Collaborator

anhmiuhv commented Feb 14, 2025

You will need to change the pinmux for Jetson Orin Nano

https://docs.nvidia.com/jetson/archives/r36.3/DeveloperGuide/HR/JetsonModuleAdaptationAndBringUp/JetsonOrinNxNanoSeries.html#generating-the-pinmux-dtsi-files

From the docs:

Starting with JetPack 6, you can change the pinmux in the following ways:
Update the MB1 pinmux BCT as mentioned in [Generating the Pinmux dtsi Files]?(https://docs.nvidia.com/jetson/archives/r36.3/DeveloperGuide/HR/JetsonModuleAdaptationAndBringUp/JetsonOrinNxNanoSeries.html#generating-the-pinmux-dtsi-files).
For debugging, you can dynamically change the pinmux.

I suggest you dynamically change the pinmux first to make the GPIO output work first

@sarmadgulzar
Copy link
Author

@anhmiuhv thanks for the reference to the documentation. I was able to dynamically change the registers and make the LED blink. I'll post more on that later so that others can use it but before that I have a question. How do we determine the mapping between the pins and the registers? Let's say I want to use the following pin (Board pin # 31):

Image

This corresponds to this register PADCTL_G3_SOC_GPIO33_0:

Image

How exactly do we determine that? Although I was able to run the LED but that's only because I knew this pin <-> register mapping from the example given here: https://docs.nvidia.com/jetson/archives/r36.3/DeveloperGuide/HR/JetsonModuleAdaptationAndBringUp/JetsonOrinNxNanoSeries.html#changing-the-pinmux

If you can guide me in the right direction, that'll be super helpful. Thanks again!

@anhmiuhv
Copy link
Collaborator

anhmiuhv commented Feb 21, 2025

Step 1: Check the carrier board spec sheet.

Image

As you can see here, you want to use Pin 31, which corresponds with PQ.06

Step 2: Open the corresponding pinmux spreadsheet for your device type. In this example, you use Jetson Orin Nano so we are going to use Jetson_Orin_NX_series_and_Orin_Nano_series_Pinmux_Config_Template.xlsm . You can find this file on the Jetson download center.

Step 3: Find PQ.06 in the pinmux spreadsheet.

Image

You can see that in here PQ.06 and SOC_GPIO33 are in the same customer usage option

Step 4: Find the corresponding PADCTL register for SOC_GPIO33 in the Orin Technical Reference Manual like what you do here:

Image

@sarmadgulzar
Copy link
Author

@anhmiuhv thanks. Much appreciated!

@aryans99860
Copy link

@sarmadgulzar Hey! Can you share the step by step way to set GPIO pin bidirectional/Output. I am facing problems doing this.
Thanks

@alexanderywy
Copy link

alexanderywy commented Apr 11, 2025

You will need to change the pinmux for Jetson Orin Nano

https://docs.nvidia.com/jetson/archives/r36.3/DeveloperGuide/HR/JetsonModuleAdaptationAndBringUp/JetsonOrinNxNanoSeries.html#generating-the-pinmux-dtsi-files

From the docs:

Starting with JetPack 6, you can change the pinmux in the following ways:
Update the MB1 pinmux BCT as mentioned in [Generating the Pinmux dtsi Files]?(https://docs.nvidia.com/jetson/archives/r36.3/DeveloperGuide/HR/JetsonModuleAdaptationAndBringUp/JetsonOrinNxNanoSeries.html#generating-the-pinmux-dtsi-files).
For debugging, you can dynamically change the pinmux.

I suggest you dynamically change the pinmux first to make the GPIO output work first

Sorry for bothering, I am now using Jetpack 6.0 with Jetson.GPIO == 2.1.7. Is that means dynamically change is to use jetson-io.py, so that I can use setup() in Jetson.GPIO? Or maybe I misunderstood what is dynamically change.

Because I found that if I configured PINs with the Jetson-io.py, such as i2s2 (12, 35, 38, 40), these PINs can be set as GPIO inputs and outputs with setup() function provided by Jetson.GPIO, but not working properly (inspected by oscilloscope).

But somebody says that setup() is conflicts with Jetson-io.py, it's so confusing.

@anhmiuhv
Copy link
Collaborator

Dynamically change the pinmux mean using busybox devmem tool

busybox devmem

You can read more about it in the documentation here
https://docs.nvidia.com/jetson/archives/r36.3/DeveloperGuide/HR/JetsonModuleAdaptationAndBringUp/JetsonOrinNxNanoSeries.html#generating-the-pinmux-dtsi-files

@alexanderywy
Copy link

Dynamically change the pinmux mean using busybox devmem tool

busybox devmem

You can read more about it in the documentation here https://docs.nvidia.com/jetson/archives/r36.3/DeveloperGuide/HR/JetsonModuleAdaptationAndBringUp/JetsonOrinNxNanoSeries.html#generating-the-pinmux-dtsi-files

So in JETPACK 6.x, after setup pins manually, can we still use Jetson.GPIO to enable functions? Does it only affect GPIO.setup()?

@anhmiuhv
Copy link
Collaborator

Yes you can use Jetson GPIO to use GPIO after changing the pinmux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants