Jetpack 6 on Jetson Orin Nano Devkit 8GB cannot LED ON/OFF via GPIO

Hello

I am trying to turn on/off LED with GPIO with no success, it says off from the outset. I am on Jetson Orin Nano Devkit 8GB. I am using the simple code shown below and also tried /usr/share/doc/jetson-gpio-common/samples/simple_out.py on BOARD PIN15 .

I am on Jetpack 6, should this code run as I am intending or do I need to take a few setup steps as described on forum post [36.2] problem of using gpio to control LED ?

My system:
(base) sergio@jetson:~$ cat /etc/nv_tegra_release
R36 (release), REVISION: 2.0, GCID: 34956989, BOARD: generic, EABI: aarch64, DATE: Thu Nov 30 19:03:58 UTC 2023
KERNEL_VARIANT: oot
TARGET_USERSPACE_LIB_DIR=nvidia
TARGET_USERSPACE_LIB_DIR_PATH=usr/lib/aarch64-linux-gnu/nvidia
(base) sergio@jetson:/sys/class$ uname -r
5.15.122-tegra

Code I also tried:

# GPIO library`
import` `Jetson.GPIO as GPIO`
# Handles time`
import` `time `
# Pin Definition`
led_pin=15
# Set up the GPIO channel`
GPIO.setmode(GPIO.BOARD) `
GPIO.setup(led_pin, GPIO.OUT, initial` `=` `GPIO.HIGH) `
print("Press CTRL+C when you want the LED to stop blinking") 
# Blink the LED`
while` `True` `: `
time.sleep(` `2` `) `
GPIO.output(led_pin, GPIO.HIGH) `
print` `(` `"LED is ON"` `)`
time.sleep(` `2` `) `
GPIO.output(led_pin, GPIO.LOW)`
print` `(` `"LED is OFF"` `)`

Hi,

Can you please take a picture of your hardware setup?
Was it working properly with JetPack 5?

Hello @DaveYYY

Thanks for looking into this. Attached snapshots. I followed this tutorial to get it setup, and tested different PINs, latest in PIN12 shown on the snapshots.

I connect the Jetson via USB-c to ubuntu 22.04 host and ssh into it.

I did not try with Jetpack 5, I have only installed 6 because I need Ubuntu 22.04.

Do you need me to try with Jetpack 5? I have read in other forums I cannot downgrade to Jetpack 5 after installing 6?

Any logs I can get somewhere to shed more light?

Thank you for your help.

Hi,

After running this line, can you please check:

sudo su
cat /sys/kernel/debug/gpio | grep PH.07

See if the direction is changed to output, as it’s originally configured as an input pin in pinmux.

Hello @DaveYYY

base) sergio@jetson:~$ python3
Python 3.11.5 (main, Sep 11 2023, 13:14:08) [GCC 11.2.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import Jetson.GPIO as GPIO
led_pin=12
GPIO.setmode(GPIO.BOARD)
GPIO.setup(led_pin,GPIO.OUT,initial=GPIO.HIGH)

I open another terminal window:

(base) sergio@jetson:~$ sudo cat /sys/kernel/debug/gpio | grep PH.07
[sudo] password for sergio:
gpio-398 (PH.07 |Jetson-gpio ) out hi
(base) sergio@jetson:~$

Hello @DaveYYY I measure the GPIO wit a multimeter and I get no voltage when gpio-398 (PH.07 |Jetson-gpio ) out hi

I also tried pin 15 gpio-433 (PN.01 but no voltage

can you guide me what else to try please?

Thank you.

Have you tried to probe the pin (pin 15 of 40-pin header?) directly without jumper lines?

Hi @Trumany yes both on pin 12 and 15, I connected directly the multimeter lead tips to GND and the PIN

I mean you should probe the pin without any external components on it. Did you do that?

Hi @Trumany yes I have probed directly the pin 12 and 15 without external components, whats next please?

Then can you please try modifying pinmux and make GPIO3_PH.07 an output pin?
Also set the initial state as Drive 1 so it’s by default high voltage.

Hi @DaveYYY Does this require editing the device tree and recompiling the kernel, or can i do this with Jetson-io tool ? Sounds like an overkill otherwise 😅

I would really appreciate you point me where in the documentation to be sure please.

Thank you for your help

Please check the document:
https://docs.nvidia.com/jetson/archives/r36.2/DeveloperGuide/HR/JetsonModuleAdaptationAndBringUp/JetsonOrinNxNanoSeries.html?highlight=pinmux%20changes#mb1-configuration-changes

No device tree or kernel stuff involved so don’t worry.

Hi @DaveYYY

I’m following the guide you kindly shared and made the suggested changes. Where’s the dir to place the .dtsi files ?

I installed Jetpack 6 in the jetson orin nano devkit by flashing with etcher balena de jetpack image I downloaded. I can’t find:
<l4t_top>/bootloader/generic/BCT/` directory

And what dir is l4t_top?

Thank you

You have to re-flash the device, and l4t_top means Linux_for_Tegra on your host PC.

That’s helpful @DaveYYY !

Can I confirm with you this is where I need to make the changes (mine is a Jetson Orin Nano [8GB developer kit version] P3767-0005 module P3768-0000 carrier board)

sergio@sergio-pc-2:~$ nano /home/sergio/nvidia/nvidia_sdk/JetPack_6.0_DP_Linux_DP_JETSON_ORIN_NANO_TARGETS/Linux_for_Tegra/p3767.conf.common

I ask because none of these parameters shown in the documentation example I need to change currently exist in the host at the above mentioned conf.common file:

source “${LDK_DIR}/p3767.conf.common”;

PINMUX_CONFIG=“tegra234-mb1-bct-pinmux-p3767-dp-a03.dtsi”;
PMC_CONFIG=“tegra234-mb1-bct-padvoltage-p3767-dp-a03.dtsi”;
BPFDTB_FILE=“tegra234-bpmp-3767-0000-a02-3509-a02.dtb”;
DTB_FILE=“tegra234-p3767-0000-p3768-0000-a0.dtb”;
TBCDTB_FILE=“${DTB_FILE}”;
EMMC_CFG=“flash_t234_qspi_sd.xml”;

what dir is LDK_DIR ?

Thank you.

Hi,

Please make changes in this config:
Linux_for_Tegra/jetson-orin-nano-devkit.conf

DEFAULT_EMC_FUSE="0";
PINMUX_CONFIG="tegra234-mb1-bct-pinmux-p3767-dp-a03.dtsi";
PMC_CONFIG="tegra234-mb1-bct-padvoltage-p3767-dp-a03.dtsi";
BPFDTB_FILE="tegra234-bpmp-3767-0000-a02-3509-a02.dtb";
EMMC_CFG="flash_t234_qspi_sd.xml";
DTB_FILE=tegra234-p3768-0000+p3767-0000-nv.dtb;
TBCDTB_FILE="${DTB_FILE}";
OVERLAY_DTB_FILE+=",tegra234-p3768-0000+p3767-0000-dynamic.dtbo";

Make sure PINMUX_CONFIG points to the new file you just generate.

Hi @DaveYYY

SDK Manager fails to flash when I replace the pinmux file, attached log file.

Process:

  1. I formatted my SD card and flashed Jetpack 6 with SDK Manager to have a clean version. Also signed in to let Jetson setup the user by ubuntu os etc. Then:

2.changed with xls pinmux as you explained and copied the pinmux file created by the macros to the ~/nvidia/nvidia_sdk/JetPack_6.0_DP_Linux_DP_JETSON_ORIN_NANO_TARGETS/Linux_for_Tegra/bootloader/generic/BCT/Orion_tegra234-mb1-bct-pinmux-p3767-dp-a03.dtsi

  1. Changed at /home/sergio/nvidia/nvidia_sdk/JetPack_6.0_DP_Linux_DP_JETSON_ORIN_NANO_TARGETS/Linux_for_Tegra/jetson-orin-nano-devkit.conf PINMUX_CONFIG to point to new pinmux filename

PINMUX_CONFIG=“tegra234-mb1-bct-pinmux-p3767-dp-a03.dtsi”;
For
PINMUX_CONFIG=“Orion_tegra234-mb1-bct-pinmux-p3767-dp-a03.dtsi”;

  1. Select Automatic Setup → Flash

I attach log file:
SDKM_logs_JetPack_6.0_DP_Linux_for_Jetson_Orin_Nano_modules_2024-01-31_14-35-17.zip (134.8 KB)

To re-flash:

Two further questions please:

  1. I assume I do not need to also copy gpio.dtsi and padvoltage.dtsi, but if I need to copy these too, do I also change the pointing files in the config file and in particular where in the Linux_for_Tegra/jetson-orin-nano-devkit.conf file is the variable to point to the gpio.dtsi file?

  2. Linux_for_Tegra/jetson-orin-nano-devkit.conf file for board_FAB TS1 EB1 also has variable pointing to pinmux file. Do I need to change this one too?

Error Log snippet:
14:36:08.858 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [ 1.2007 ] Pre-processing config: Orin-tegra234-mb1-bct-pinmux-p3767-dp-a03.dtsi
14:36:08.858 - error: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: Error: Return value 1
14:36:08.858 - info: Event: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS - error is: Error: Return value 1
14:36:08.859 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: Command cpp -nostdinc -x assembler-with-cpp -D IN_DTS_CONTEXT -I … -I …/generic/BCT Orin-tegra234-mb1-bct-pinmux-p3767-dp-a03.dtsi Orin-tegra234-mb1-bct-pinmux-p3767-dp-a03_cpp.dts
14:36:08.873 - error: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: Error: /home/sergio/nvidia/nvidia_sdk/JetPack_6.0_DP_Linux_DP_JETSON_ORIN_NANO_TARGETS/Linux_for_Tegra/bootloader/signed/flash.idx is not found
14:36:08.873 - info: Event: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS - error is: Error: /home/sergio/nvidia/nvidia_sdk/JetPack_6.0_DP_Linux_DP_JETSON_ORIN_NANO_TARGETS/Linux_for_Tegra/bootloader/signed/flash.idx is not found
14:36:08.873 - error: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: Error: failed to relocate images to /home/sergio/nvidia/nvidia_sdk/JetPack_6.0_DP_Linux_DP_JETSON_ORIN_NANO_TARGETS/Linux_for_Tegra/tools/kernel_flash/images
14:36:08.873 - info: Event: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS - error is: Error: failed to relocate images to /home/sergio/nvidia/nvidia_sdk/JetPack_6.0_DP_Linux_DP_JETSON_ORIN_NANO_TARGETS/Linux_for_Tegra/tools/kernel_flash/images
14:36:08.878 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: Cleaning up…
14:36:08.885 - error: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [exec_command]: /bin/bash -c /tmp/tmp_NV_L4T_FLASH_JETSON_LINUX_COMP.sergio.sh; [error]: /home/sergio/nvidia/nvidia_sdk/JetPack_6.0_DP_Linux_DP_JETSON_ORIN_NANO_TARGETS/Linux_for_Tegra/bootloader/L4TConfiguration.dtbo: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property

Thank you.
My Jetson etson Orin Nano [8GB developer kit version] P3767-0005 module P3768-0000 carrier board

It’s stated on the document that you also need gpio.dtsi.

What is board_FAB TS1 EB1 here?

Hello @DaveYYY

Yes my bad. But what is the variable for gpio.dtsi in the Linux_for_Tegra/jetson-orin-nano-devkit.conf to point to the new file I save ? I do not see this anywhere in the documentation please.

About board_FAB, I am changing the filename in case, does this apply to Jetson etson Orin Nano [8GB developer kit version] P3767-0005 module P3768-0000 carrier board?, this is the snippet for Linux_for_Tegra/jetson-orin-nano-devkit.conf :

Thank you.