Jetson Orin NX, Jetpack 6.2, Configure GPIO as input

Hi,

I’m working on building a customs image for the Jetson Orin NX, based on Jetpack 6.2.
I will need to configure a gpio PCC.02 as an input. Here is the configure in dtbs:

gpio@c2f0000 {
	gpio-output-high {
		gpio-hog;
		output-high;
		gpios = <TEGRA234_AON_GPIO(CC, 3) GPIO_ACTIVE_HIGH >;
		label = "gpio-out";
	};

	gpio-control-input {
		status = "okay";
		gpio-hog;
		gpios = <TEGRA234_AON_GPIO(CC, 2) 0>;
		input;
		label = "gpio-int";
	};
};

The PCC.02 will be configured as an input, and the PCC.03 will be an output. They are connected by a wire. I try to set the output at HIGH, but the input still LOW.

nvidia@ubuntu:~$ sudo cat /sys/kernel/debug/gpio | grep PCC.02
 gpio-330 (PCC.02              |cam-reset-output-hig) out hi 
nvidia@ubuntu:~$ sudo cat /sys/kernel/debug/gpio | grep PCC.03
 gpio-331 (PCC.03              |camera-control-input) in  lo 
nvidia@ubuntu:~$

With the same setup (code and hardware), it worked on the Jetpack 5.1.2, but not work on the Jetpack 6.2.

Do you have any idea on this?

Thank you.

Hi karoot,

Are you using the devkit or custom board for Orin NX?

It seems PCC.02 is used as cam-reset-output-hig and PCC.03 is used as camera-control-input by default.
Please configure the pin in pinmux spreadsheet first and remove their usage by camera.

Hi KevinFFF,

Thank you for the reply.

" It seems PCC.02 is used as cam-reset-output-hig and PCC.03 is used as camera-control-input by default."
Where can I find these settings on the source code? I try to find them but no luck. If I can find them, I can disable these settings for testing first.

I also see on the pinmux spreadsheet, the GPIO5 (PCC.02) used as “Baseboard Wifi Disable Control”. Is this correct?
I try to find the configuration for the “Baseboard Wifi Disable Control” to disable it, but no luck. Could you please show me, where is this setting?

They may be configured in device tree.
Please run the following command on your board and share extracted_proc.dts for further check.

$ sudo dtc -I fs -O dts -o extracted_proc.dts /proc/device-tree

Please configure them as following in pinmux spreadsheet.
image

Hi

Here is the dts
extracted_proc.dts.txt (321.4 KB)

I will try to update the pinmux spreadsheet then update you asap

They are included in the gpio@c2f0000 node of your device tree as following.

		gpio@c2f0000 {
			reg-names = "security\0gpio";
			gpio-controller;
			interrupts = <0x00 0x38 0x04 0x00 0x39 0x04 0x00 0x3a 0x04 0x00 0x3b 0x04>;
			compatible = "nvidia,tegra234-gpio-aon";
			#interrupt-cells = <0x02>;
			reg = <0x00 0xc2f0000 0x00 0x1000 0x00 0xc2f1000 0x00 0x1000>;
			phandle = <0x105>;
			#gpio-cells = <0x02>;
			gpio-ranges = <0x107 0x00 0x00 0x20>;
			interrupt-controller;

			camera-control-input {
				gpio-hog;
				label = "6911uxe-int";
				status = "okay";
				input;
				gpios = <0x12 0x00>;
			};

			cam-reset-output-high {
				gpio-hog;
				output-high;
				label = "cam-rst-pwup";
				gpios = <0x13 0x00>;
			};

			cam-mux-output-high {
				gpio-hog;
				output-high;
				label = "cammux-pwup";
				gpios = <0x10 0x00>;
			};
		};

Hi,

Yes,
This is the camera driver we are working on.
We designed to use the PCC.02 as an interrupt and the PCC.03 as a reset gpio for the camera.
The interrupt looks like does not work as expect, it always show " gpio-330 (PCC.02 |camera-control-input) in lo IRQ".

So I try to configure it as an normal input pin, then jump the PCC.02 to the PCC.03 by a wire, to check if the input pin can work normally or not. But it’s not work. For this setup, I will get:

 gpio-330 (PCC.02              |camera-control-input) in  lo 
 gpio-331 (PCC.03              |cam-reset-output-hig) out hi 

The current setup look good to me that PCC.02 is used as Input and PCC.03 is used as Output.
How did you control PCC.03?

They are used by gpio aon controller so that you can not use them by other driver or tool like gpiod.

Hi,

That is the problem. You can see that the PCC.03 is output high level, and the PCC.02 is an input. I connected them by a physical wire. I think if the input pin worked, the PCC.02 should by in high level, the same with PCC.03.

But the result was not expected. I don’t why.

I would suggest you verifying with following steps:

  1. configuring them from pinmux spreadsheet (as the screenshot I shared above)
  2. remove camera-control-input and cam-reset-output-high nodes in device tree
  3. use gpiod to control PCC.03 and get a scope to check if it could be driven
  4. connect PCC.03 and PCC.02 to verify

Hi,

Thank you for the suggestion. I will try then get back to you soon.
But how can to control the gpio using gpiod? Could you please give me some examples on this?

You can simply run the following commands to verify.

In Step3:
# gpioinfo|grep "PCC.03"
# gpioset --mode=wait `gpiofind "PCC.03"`=0
(measure PCC.03 voltage)
# gpioset --mode=wait `gpiofind "PCC.03"`=1
(measure PCC.03 voltage)

In Step 4:
# gpioinfo|grep -E "PCC.02|PCC.03"
# gpioget `gpiofind "PCC.02"`
# gpioset --mode=wait `gpiofind "PCC.03"`=0
# gpioget `gpiofind "PCC.02"`
# gpioset --mode=wait `gpiofind "PCC.03"`=1
# gpioget `gpiofind "PCC.02"`

Hi,

It looks like I have a problem with the spreadsheet pinmux, so I try to update the “tegra234-mb1-bct-gpio-p3767-dp-a03.dtsi” manually. I change to

gpio@c2f0000 {
		gpio-init-names = "default";
		gpio-init-0 = <&gpio_aon_default>;

		gpio_aon_default: default {
			gpio-input = <
				TEGRA234_AON_GPIO(EE, 2)
				TEGRA234_AON_GPIO(EE, 4)
				TEGRA234_AON_GPIO(CC, 2)
				>;
			gpio-output-low = <
				TEGRA234_AON_GPIO(CC, 0)
				TEGRA234_AON_GPIO(CC, 3)
				TEGRA234_AON_GPIO(AA, 4)
				>;
			gpio-output-high = <
				TEGRA234_AON_GPIO(CC, 1)
				TEGRA234_AON_GPIO(AA, 5)
				TEGRA234_AON_GPIO(BB, 3)
				>;
		};
	};

and the result is

root@ubuntu:/home/gremsy# gpioinfo|grep -E "PCC.02|PCC.03"
	line  14:     "PCC.02"       unused   input  active-high 
	line  15:     "PCC.03"       unused  output  active-high 

Then I try to toggle pin PCC.03 manually by using your suggestion commands. The VOM shows me that the voltage level change between 0-1.8V, but the pin PCC.02 always shows “0”

What’s wrong here?