I had a GPIO pin initialization issue on Jetson Nano.
-
Environment
- Hardware
Jetson Nano module (P3448-0002) + carrier board(P3449) - Software
JetPack_4.6.2- linux kernel “tegra-l4t-r32.7.1”
- Hardware
-
Problem
- GPIO13 (GPIO_PE6) does not goes to high
-
My modification and confirmation
- Modifying dts files, compile it, and pass it for kernel to use it.
- my gpio-default.dtsi file is as following
- Modifying dts files, compile it, and pass it for kernel to use it.
+++ b/kernel-dts/porg-platforms/tegra210-hoge-gpio-default.dtsi #include <dt-bindings/gpio/tegra-gpio.h> / { gpio: gpio@6000d000 { gpio-init-names = "default"; gpio-init-0 = <&gpio_default>; gpio_default: default { gpio-input = < TEGRA_GPIO(CC, 4) >; gpio-output-low = < TEGRA_GPIO(S, 7) TEGRA_GPIO(I, 2) >; gpio-output-high = < TEGRA_GPIO(E, 6) <= This is what I want to make it works TEGRA_GPIO(CC, 7) >; }; };
-
Confirmed that kernel uses the correct dtb file and my modification is applied
by following 3 ways- check dtsfilename
$cat /proc/device-tree/nvidia,dtsfilename - check by reverse-compiling wth dtc command
$dtc <my dtb file> - check by peeking the proc files
$hexdump /proc/device-tree/gpio@6000d000/default/gpio-output-high
- check dtsfilename
-
Check pin GPIO13(GPIO_PE6) status
- by measuring multimetor
- Check pin GPIO13 at carrier board does not goes high 3.3V. It is 0V.
- /sys/kernel/debug/tegra_gpio also said OE of GPIO_PE6 is set to
0 (not driven).
Even CNF is set to 0 (SPIO(non-GPIO pins))
- by measuring multimetor
$sudo cat /sys/kernel/debug/tegra_gpio Name:Bank:Port CNF OE OUT IN INT_STA INT_ENB INT_LVL A: 0:0 64 40 40 04 00 00 000000 B: 0:1 00 00 00 00 00 00 000000 C: 0:2 00 00 00 00 00 00 000000 D: 0:3 00 00 00 00 00 00 000000 E: 1:0 00 00 00 00 00 00 000000 F: 1:1 00 00 00 00 00 00 000000 G: 1:2 00 00 00 00 00 00 000000 H: 1:3 fd 99 00 60 00 00 000000 I: 2:0 07 07 03 02 00 00 000000 J: 2:1 00 00 00 00 00 00 000000 K: 2:2 00 00 00 00 00 00 000000 L: 2:3 00 00 00 00 00 00 000000 M: 3:0 00 00 00 00 00 00 000000 N: 3:1 00 00 00 00 00 00 000000
-
My findings
-
Actually, there is no code in the kernel tree (including
gpio driver: kernel-4.9/drivers/gpio/gpiolib-of.c,
at least the code of the tag: tegra-l4t-r32.7.1)
which handles these device tree properties- gpio-init-names
- gpio-input
- gpio-output-low
- gpio-output-high
-
I noticed that there is a patch exists, which enables this GPIO
initialization function, at kernel repository for android/tegra.
Diff - 728ef02726342d1a86ec5cfcef33d582bd135164^! - kernel/tegra - Git at Google -
I checked the linux kernel of Jetpack (git://nv-tegra.nvidia.com/linux-4.9.git),
but could not find out the same or simliar patch in any branch/tags in the
repository. -
I ported the patch to my kernel(linux4.9).
0001-gpio-of-add-support-for-configuring-GPIOs-default.patch (2.8 KB)Now I confirmed gpio initialization works as expected and GPIO13 (GPIO_PE6)
now goes to high.
-
-
Question to Nvidia
It seems there are lot’s of people facing the similar problem.Failed to initialize GPIO_H07 through device tree
GPIO and DeviceTree - #15 by kayccc
Device tree GPIO default ValueWould you please explain why my kernel does not contains the correct code ?
Am I missing some procedure to setup my environment ?
Does the the tag “tegra-l4t-r32.7.1” is not correct one for Jetpack 4.6 ?
(It’s described in the release note though.)It would be great if someone could clarify my mistakes or provide some reasonable answer.
Looking forward to hearing from you.
Makoto