Enabling GPIO output on Jetpack 6

I’ve got the Orin AGX 64GB DevKit running JP DP6 and I need to be able to do output to GPIO on six different pins on the 40 pin header. I’ve been reading a bunch of threads and it sounds like I need to explicitly set the pins to ‘output’ and set the drive to ‘0’ in the pinmux XLS before they will work. Only one of the six pins is ‘output’ by default, the rest are ‘input’.
So, I decided to take this opportunity to flash to JP6 GA and
I used the spreadsheet to set the pins to output and drive=0, then generated the three dtsi files and copied them over to the /bootloader and bootloader/generic/BCT directories in JP6 GA.

Now, I’m stuck because the documentation says that I should make sure to reference the files in the config file, however the jetson-agx-orin-devkit.conf has no reference to Pinmux and doesn’t look like the config files referenced in the docs…it looks like below. Do I need to reference them in that config file, if so - could someone please point me to documentation that matches the config file format below?

Note, I’m just using the default board names that the spreadsheet suggested and I’m just using the standard board definition - only changing five GPIO pins to ‘output’. (Note: It is strange to me that almost all the GPIO pins are input by default, this code worked great on Jetson nano where they all were bidirectional by default).

source “${LDK_DIR}/p3737-0000-p3701-0000.conf.common”;

update_flash_args_p3737_0000_p3701_0000()
{

Select the Base DTB based on SKU

if [ “${board_sku}” = “0000” ]; then
# Enable VRS11 DCM mode for CPU/GPU/CV rails
PMIC_CONFIG=“tegra234-mb1-bct-pmic-p3701-0005.dts”;
DTB_FILE=tegra234-p3737-0000+p3701-0000-nv.dtb;
elif [ “${board_sku}” = “0001” ] || [ “${board_sku}” = “0002” ]; then
DTB_FILE=tegra234-p3737-0000+p3701-0000-nv.dtb;
elif [ “${board_sku}” = “0004” ]; then
# Enable VRS11 DCM mode for CPU/GPU/CV rails
PMIC_CONFIG=“tegra234-mb1-bct-pmic-p3701-0005.dts”;
DTB_FILE=tegra234-p3737-0000+p3701-0004-nv.dtb;
elif [ “${board_sku}” = “0005” ]; then
# Enable VRS11 DCM mode for CPU/GPU/CV rails
PMIC_CONFIG=“tegra234-mb1-bct-pmic-p3701-0005.dts”;
DTB_FILE=tegra234-p3737-0000+p3701-0005-nv.dtb;
else
echo “Error: Unrecognized module SKU ${board_sku}”;
exit 1;
fi

TBCDTB_FILE=“${DTB_FILE}”;
}

update_flash_args:

update_flash_args()
{
update_flash_args_common
update_flash_args_p3737_0000_p3701_0000
}

DTB_FILE=tegra234-p3737-0000+p3701-0000-nv.dtb;
TBCDTB_FILE=“${DTB_FILE}”;
OVERLAY_DTB_FILE=“L4TConfiguration.dtbo,tegra234-p3737-0000+p3701-0000-dynamic.dtbo,tegra234-carveouts.dtbo,tegra-optee.dtbo,tegra234-p3737-camera-dual-imx274-overlay.dtbo,tegra234-p3737-camera-e3331-overlay.dtbo,tegra234-p3737-camera-e3333-overlay.dtbo,tegra234-p3737-camera-imx185-overlay.dtbo”;

jetson-agx-orin-devkit.conf has no reference to Pinmux

This is not correct. The first line has "source “${LDK_DIR}/p3737-0000-p3701-0000.conf.common” which means this “p3737-0000-p3701-0000.conf.common” file is included too. There could be other source in p3737-0000-p3701-0000.conf.common too which means you need to trace it down.

Ok, thanks @WayneWWW

I found p3737-0000-p3701-0000.conf.common
It had references to padvoltages and pinmux which I updated to:

update pinmux for concord

    if [ "${board_sku}" != "0005" ]; then
            if [ "${chip_SKU}" = "00" ] || [ "${chip_SKU}" = "D0" ]; then
                    if [ "${board_FAB}" = "TS1" ] || [ "${board_FAB}" = "TS2" ] ||
                    [ "${board_FAB}" = "TS3" ] || [ "${board_FAB}" = "EB1" ] ||
                    [ "${board_FAB}" = "EB2" ] || [ "${board_FAB}" = "EB3" ] ||
                    [ "${board_FAB}" = "000" ] || [ "${board_FAB}" = "100" ] ||
                    [ "${board_FAB}" = "200" ]; then
                            PINMUX_CONFIG="Orin-jetson_agx_orin-pinmux.dtsi";
                            PMC_CONFIG="Orin-jetson_agx_orin-padvoltage-default.dtsi";
                    fi
            fi
    fi

and it then pointed to
p3701.conf.common which had these two references which I updated, does that seem right?

PINMUX_CONFIG=“Orin-jetson_agx_orin-pinmux.dtsi”;
GPIOINT_CONFIG=“Orin-jetson_agx_orin-gpio-default.dtsi”;

Anything I might have missed?

Ok, I tried flashing but it failed…error below looks like some sort of unexpected value in the auto-generated files?

> populating rootfs from /tmp/tmp.7GBooUx2em ... 	populating /boot/extlinux/extlinux.conf ... done.

Sync’ing system.img … done.
Converting RAW image to Sparse image… done.
system.img built successfully.
Not signing of kernel-dtb
Existing tbcfile(/home/jason/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra/bootloader/uefi_jetson.bin) reused.
Sync’ing esp.img … done.
copying tbcdtbfile(/home/jason/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra/kernel/dtb/tegra234-p3737-0000+p3701-0005-nv.dtb)… done.
copying cfgfile(/home/jason/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra/bootloader/generic/cfg/flash_t234_qspi_sdmmc.xml) to flash.xml… done.
Existing flashapp(/home/jason/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra/bootloader/tegraflash.py) reused.
copying overlay_dtb(/home/jason/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra/kernel/dtb/L4TConfiguration.dtbo)… done.
copying overlay_dtb(/home/jason/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra/kernel/dtb/tegra234-p3737-0000+p3701-0000-dynamic.dtbo)… done.
copying overlay_dtb(/home/jason/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra/kernel/dtb/tegra234-carveouts.dtbo)… done.
copying overlay_dtb(/home/jason/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra/kernel/dtb/tegra-optee.dtbo)… done.
copying overlay_dtb(/home/jason/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra/kernel/dtb/tegra234-p3737-camera-dual-imx274-overlay.dtbo)… done.
copying overlay_dtb(/home/jason/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra/kernel/dtb/tegra234-p3737-camera-e3331-overlay.dtbo)… done.
copying overlay_dtb(/home/jason/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra/kernel/dtb/tegra234-p3737-camera-e3333-overlay.dtbo)… done.
copying overlay_dtb(/home/jason/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra/kernel/dtb/tegra234-p3737-camera-imx185-overlay.dtbo)… done.
copying overlay_dtb(/home/jason/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra/kernel/dtb/BootOrderNvme.dtbo)… done.
./tegraflash.py --bl uefi_jetson_with_dtb.bin --odmdata gbe-uphy-config-22,hsstp-lane-map-3,nvhs-uphy-config-0,hsio-uphy-config-0,gbe0-enable-10g --overlay_dtb L4TConfiguration.dtbo,tegra234-p3737-0000+p3701-0000-dynamic.dtbo,tegra234-carveouts.dtbo,tegra-optee.dtbo,tegra234-p3737-camera-dual-imx274-overlay.dtbo,tegra234-p3737-camera-e3331-overlay.dtbo,tegra234-p3737-camera-e3333-overlay.dtbo,tegra234-p3737-camera-imx185-overlay.dtbo,BootOrderNvme.dtbo --bldtb tegra234-p3737-0000+p3701-0005-nv.dtb --applet mb1_t234_prod.bin --cmd “sign” --cfg flash.xml --chip “0x23” --concat_cpubl_bldtb --cpubl uefi_jetson.bin --minratchet_config tegra234-mb1-bct-ratchet-p3701-0000.dts --device_config tegra234-mb1-bct-device-p3701-0000.dts --misc_config tegra234-mb1-bct-misc-p3701-0000.dts --pinmux_config Orin-jetson_agx_orin-pinmux.dtsi --gpioint_config Orin-jetson_agx_orin-gpio-default.dtsi --pmic_config tegra234-mb1-bct-pmic-p3701-0005.dts --pmc_config tegra234-mb1-bct-padvoltage-p3701-0000-a04.dtsi --deviceprod_config tegra234-mb1-bct-cprod-p3701-0000.dts --prod_config tegra234-mb1-bct-prod-p3701-0000.dts --scr_config tegra234-mb2-bct-scr-p3701-0000.dts --wb0sdram_config tegra234-p3701-0005-wb0sdram-l4t.dts --br_cmd_config tegra234-mb1-bct-reset-p3701-0000.dts --uphy tegra234-mb1-bct-uphylane-si.dtsi --dev_params tegra234-br-bct-p3701-0000.dts,tegra234-br-bct_b-p3701-0000.dts --mb2bct_cfg tegra234-mb2-bct-misc-p3701-0000.dts --bins “psc_fw pscfw_t234_prod.bin; mts_mce mce_flash_o10_cr_prod.bin; tsec_fw tsec_t234.bin; mb2_applet applet_t234.bin; mb2_bootloader mb2_t234.bin; xusb_fw xusb_t234_prod.bin; pva_fw nvpva_020.fw; dce_fw display-t234-dce.bin; nvdec nvdec_t234_prod.fw; bpmp_fw bpmp_t234-TE990M-A1_prod.bin; bpmp_fw_dtb tegra234-bpmp-3701-0005-3737-0000.dtb; rce_fw camera-rtcpu-t234-rce.img; ape_fw adsp-fw.bin; spe_fw spe_t234.bin; tos tos-optee_t234.img; eks eks_t234.img” --sdram_config tegra234-p3701-0005-sdram-l4t.dts --cust_info custinfo_out.bin --bct_backup --boot_chain A
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands

[ 0.0136 ] tegrasign_v3.py --key None --getmode mode.txt
[ 0.0137 ] Assuming zero filled SBK key
[ 0.0131 ] Parsing partition layout
[ 0.0135 ] tegraparser_v2 --pt flash.xml.tmp
[ 0.0173 ] Change tegra234-bpmp-3701-0005-3737-0000.dtb to tegra234-bpmp-3701-0005-3737-0000_with_odm.dtb
[ 0.0173 ] Change tegra234-bpmp-3701-0005-3737-0000.dtb to tegra234-bpmp-3701-0005-3737-0000_with_odm.dtb
[ 0.0500 ] /usr/bin/python3 dtbcheck.py -c t234 -o tegra234-bpmp-3701-0005-3737-0000_with_odm.dtb tegra234-bpmp-3701-0005-3737-0000_with_odm_tmp.dtb
[ 0.2269 ] Concatenating L4TConfiguration.dtbo,tegra234-p3737-0000+p3701-0000-dynamic.dtbo,tegra234-carveouts.dtbo,tegra-optee.dtbo,tegra234-p3737-camera-dual-imx274-overlay.dtbo,tegra234-p3737-camera-e3331-overlay.dtbo,tegra234-p3737-camera-e3333-overlay.dtbo,tegra234-p3737-camera-imx185-overlay.dtbo,BootOrderNvme.dtbo to tegra234-p3737-0000+p3701-0005-nv_with_odm_overlay.dtb.updated
[ 0.2271 ] Concatenating bl dtb to cpubl binary
[ 0.2291 ] MB2 binary: mb2_t234.bin
[ 0.2291 ] Pre-processing mb2bct config: tegra234-mb2-bct-misc-p3701-0000.dts
[ 0.2368 ] Pre-processing mb2bct config: tegra234-mb2-bct-scr-p3701-0000.dts
[ 0.4742 ] Generating coldboot mb2-bct
[ 0.4742 ] tegrabct_v2 --chip 0x23 0 --mb2bct mb2_cold_boot_bct.cfg --mb2bctcfg tegra234-mb2-bct-misc-p3701-0000_cpp.dtb --scr tegra234-mb2-bct-scr-p3701-0000_cpp.dtb
[ 0.4746 ] ERROR: value 0x31 is out of range
[ 0.4753 ] ERROR: value 0x31 is out of range
[ 0.4753 ] ERROR: value 0x31 is out of range
[ 0.4754 ] ERROR: value 0x31 is out of range
[ 0.4754 ] WARNING: unknown property ‘tfc_version’
[ 0.4756 ] WARNING: unknown property ‘addr_header_version’
[ 0.4837 ] Updating mb2-bct with storage information
[ 0.4841 ] tegrabct_v2 --chip 0x23 0 --mb2bct mb2_cold_boot_bct_MB2.bct --updatestorageinfo flash.xml.bin
[ 0.4858 ] Concatenating mb2-bct to mb2 binary
[ 0.4858 ] mb2_bin_file = mb2_t234.bin
[ 0.4858 ] mb2_bct_file = mb2_cold_boot_bct_MB2.bct
[ 0.4882 ] DCE binary: display-t234-dce.bin
[ 0.4882 ] Kernel DTB used: kernel_tegra234-p3737-0000+p3701-0005-nv.dtb
[ 0.4882 ] Concatenating kernel-dtb to dce-fw binary
[ 0.4882 ] dce_bin = display-t234-dce.bin
[ 0.4882 ] kernel_dtb = kernel_tegra234-p3737-0000+p3701-0005-nv.dtb
[ 0.4882 ] dce_with_dtb = display-t234-dce_with_kernel_tegra234-p3737-0000+p3701-0005-nv.bin
[ 0.5021 ] Update display-t234-dce_with_kernel_tegra234-p3737-0000+p3701-0005-nv.bin to dce_fw partitions
[ 0.5038 ] Parsing partition layout
[ 0.5042 ] tegraparser_v2 --pt flash.xml.tmp
[ 0.5049 ] Creating list of images to be signed
[ 0.5052 ] Generating ratchet blob
[ 0.5052 ] Pre-processing config: tegra234-mb1-bct-reset-p3701-0000.dts
[ 0.5097 ] Pre-processing config: tegra234-mb1-bct-device-p3701-0000.dts
[ 0.5140 ] Pre-processing config: tegra234-mb1-bct-cprod-p3701-0000.dts
[ 0.5180 ] Pre-processing config: Orin-jetson_agx_orin-gpio-default.dtsi
Error: Return value 1
Command dtc -I dts -O dtb -o Orin-jetson_agx_orin-gpio-default_cpp.dtb Orin-jetson_agx_orin-gpio-default_cpp.dts
Using bpmp-dtb concatenated with odmdata in blob for t23x
./tegraflash.py --bl uefi_jetson_with_dtb_sigheader.bin.encrypt --bct br_bct_BR.bct --bldtb tegra234-p3737-0000+p3701-0005-nv.dtb --applet rcm_2_encrypt.rcm --applet_softfuse rcm_1_encrypt.rcm --cmd “secureflash;reboot” --cfg secureflash.xml --chip 0x23 --mb1_bct mb1_bct_MB1_sigheader.bct.encrypt --mem_bct mem_rcm_sigheader.bct.encrypt --mb1_cold_boot_bct mb1_cold_boot_bct_MB1_sigheader.bct.encrypt --mb1_bin mb1_t234_prod_aligned_sigheader.bin.encrypt --psc_bl1_bin psc_bl1_t234_prod_aligned_sigheader.bin.encrypt --mem_bct_cold_boot mem_coldboot_sigheader.bct.encrypt --bins “psc_fw pscfw_t234_prod_sigheader.bin.encrypt; mts_mce mce_flash_o10_cr_prod_sigheader.bin.encrypt; tsec_fw tsec_t234_sigheader.bin.encrypt; mb2_applet applet_t234_sigheader.bin.encrypt; mb2_bootloader mb2_t234_with_mb2_bct_MB2_sigheader.bin.encrypt; xusb_fw xusb_t234_prod_sigheader.bin.encrypt; pva_fw nvpva_020_sigheader.fw.encrypt; dce_fw display-t234-dce_sigheader.bin.encrypt; nvdec nvdec_t234_prod_sigheader.fw.encrypt; bpmp_fw bpmp_t234-TE990M-A1_prod_sigheader.bin.encrypt; bpmp_fw_dtb tegra234-bpmp-3701-0005-3737-0000_with_odm_sigheader.dtb.encrypt; rce_fw camera-rtcpu-t234-rce_sigheader.img.encrypt; ape_fw adsp-fw_sigheader.bin.encrypt; spe_fw spe_t234_sigheader.bin.encrypt; tos tos-optee_t234_sigheader.img.encrypt; eks eks_t234_sigheader.img.encrypt” --bct_backup
saving flash command in flashcmd.txt

*** no-flash flag enabled. Exiting now… ***

User can run above saved command in factory environment without
providing pkc and sbk keys to flash a device

Example:

$ cd bootloader 
$ sudo bash ./flashcmd.txt

Error: /home/jason/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra/bootloader/signed/flash.idx is not found
Error: failed to relocate images to /home/jason/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_AGX_ORIN_TARGETS/Linux_for_Tegra/tools/kernel_flash/images
Cleaning up…
15:11:51.291 - Error: [exec_command]: /bin/bash -c /tmp/tmp_NV_L4T_FLASH_JETSON_LINUX_COMP.jason.sh; [error]: sed: can’t read flash.xml.tmp: No such file or directory

15:11:51.291 - Info: [ Component Install Finished with Error ]

If you don’t know how to flash board, please file a new topic. I think this topic should only focus on pinmux and gpio.

:)
I am pretty sure the error is because of the change to include the updated pinmux and gpio files - if I revert back to the original files - it flashes just fine.

Note this line here which indicates an error immediately after processing the GPIO default

[ 0.5049 ] Creating list of images to be signed
[ 0.5052 ] Generating ratchet blob
[ 0.5052 ] Pre-processing config: tegra234-mb1-bct-reset-p3701-0000.dts
[ 0.5097 ] Pre-processing config: tegra234-mb1-bct-device-p3701-0000.dts
[ 0.5140 ] Pre-processing config: tegra234-mb1-bct-cprod-p3701-0000.dts
> [ 0.5180 ] Pre-processing config: Orin-jetson_agx_orin-gpio-default.dtsi
> Error: Return value 1

This indicates to me that pre-processing: Orin-jetson_agx_orin-gpio-default.dtsi is the problem.

Then, I notice that the file originally in the config file for GPIOINT_CONFIG is a dts file not a dtsi (GPIOINT_CONFIG=“tegra234-mb1-bct-gpioint-p3701-0000.dts”;)

Is this what is causing the problem? Should I leave GPIOINT_CONFIG as-is or update it to the dtsi file generated by the spreadsheet?

Yes, the gpio dtsi generated by the pinmux spreadsheet is just located inside the pinmux dtsi itself. Open the original pinmux dtsi and read the first few lines of the file and you would know what I mean.

The gpioint-3701 file is talking about GPIO interrupt stuff. Not related to pinmux.