Q on GPIO initialization issue on Jetson Nano

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”
  • 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
  +++ 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

    1. check dtsfilename
      $cat /proc/device-tree/nvidia,dtsfilename
    2. check by reverse-compiling wth dtc command
      $dtc <my dtb file>
    3. check by peeking the proc files
      $hexdump /proc/device-tree/gpio@6000d000/default/gpio-output-high
  • 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))
    $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 Value

    Would 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

hello mharada,

please looking for Jetpack Archive for the Jetpack and its L4T release versions.
so, it should be JetPack 4.6.1 for the l4t-r32.7.1 release.

Jerry,
Thanks for your response. But, it’s not the answer I expected.
It seems my question is not clear. Sorry for that.

my question is why the kernel which tagged with “tegra-l4t-r32.7.1” has no code to handle GPIO initialization as I described above ?

It looks the dts files are written based on the assumption that these GPIO property (gpio-init-names, gpio-input, gpio-output-low and gpio-output-high) works, but actually it’s not. So, I’m wondering what’s wrong…

Would you please kindly double check with developer ?

hello mharada,

let me check this internally, I’ll update this thread after we have conclusions.

hello mharada,

it deleted gpio initialization from kernel, and it’s suppose to be done by bootloader.
for Nano series, it’s done through BCT files.

please refer to developer guide, Jetson Nano Adaptation and Bring-Up to make change in uboot for gpio initialization.

JerryChang,

Thanks for the answer !!

Makoto

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.