Spi1(spi@3210000) can't work on AGX ORIN with JP6.4

Hi

I’m trying debug the spi1 interface on our custom board. I am using the spidev_test as the first way of testing if loopback works (by shorting MISO and MOSI)-while doing this I am also monitoring the clock .

here is the result of SPI1 testing(use the spidev0.0);

dmesg info

image

and I am using an oscilloscope to measure MOSI and CLK, no data is detected.

Also we have checked the pinmux and dtb ,here is it

image

using sudo cat /sys/kernel/debug/pinctrl/2430000.pinmux/pinconf-groups check

79 (spi1_cs0_pz6): 
    pull=1
    tristate=1
    enable-input=1
    open-drain=0
    io-reset=0
    rcv-sel=0
    io-hv=0
    schmitt=0
    pull-down-strength=0
    pull-up-strength=0
    drive-type=0
    gpio-mode=1
    function=spi1

81 (spi1_miso_pz4): 
    pull=1
    tristate=1
    enable-input=1
    open-drain=0
    io-reset=0
    rcv-sel=0
    io-hv=0
    schmitt=0
    pull-down-strength=0
    pull-up-strength=0
    drive-type=0
    gpio-mode=1
    function=spi1

83 (spi1_sck_pz3): 
    pull=1
    tristate=1
    enable-input=1
    open-drain=0
    io-reset=0
    rcv-sel=0
    io-hv=0
    schmitt=1
    pull-down-strength=0
    pull-up-strength=0
    drive-type=0
    gpio-mode=1
    function=spi1
85 (spi1_cs1_pz7): 
    pull=1
    tristate=1
    enable-input=1
    open-drain=1
    io-reset=1
    rcv-sel=1
    io-hv=1
    schmitt=0
    pull-down-strength=0
    pull-up-strength=0
    drive-type=0
    gpio-mode=0
    function=rsvd1
86 (spi1_mosi_pz5): 
    pull=1
    tristate=1
    enable-input=1
    open-drain=0
    io-reset=0
    rcv-sel=0
    io-hv=0
    schmitt=0
    pull-down-strength=0
    pull-up-strength=0
    drive-type=0
    gpio-mode=1
    function=spi1

Does anyone have any idea on what the problem might be?

Thank you in advance.

Hi QOP,

What’s the Jetpack version in use?

You can also refer to https://elinux.org/Jetson/L4T/peripheral/#Loopback_test for the similar steps to verify SPI loopback test. It should be a little different as it is an example on Jetson Nano with the devkit.

Please share the full dmesg and device tree as file for further check.

Hi

I am using the R36.4.3(JP6.2) . Orin devkit

and what demg you want ,I just print the log in “tegra_spi_start_transfer_one“

and here is the dtb

dtb.txt (362.1 KB)

Please run sudo dmesg on your board and share the messages output.

Have you referred to the link in my previous step to verify SPI loopback test?

Yes,here is the log

dmesg.log (71.9 KB)
and yes I have check the SPI loopback test.

Hi tianyuw1,

Are you working with QOP?

From the dmesg you shared, both SPI1(3210000.spi) and SPI3(3230000.spi) have been probed correctly.

[    9.224570] spi-tegra114 3210000.spi: Adding to iommu group 1
..
[    9.242914] spi-tegra114 3230000.spi: Adding to iommu group 1

Is the loopback test working?
Please share the commands you run and the results.

Yes I working with him.

I use the cmd “./spidev_test -D /dev/spidev0.0 -v“


as you can watch is that the loopback test failed. And what confuses me even more is that when I use an oscilloscope to measure the clock and MOSI signals, no waveforms are generated.

It is not the expected result to me.

Have you confirmed that you shorted the correct pin for MISO/MOSI of SPI1?

Do you have custom design on SPI or 40-pins expansion header different from the devkit?
Do you have the devkit to reproduce the similar issue?

Hi Kevin

I found something strange ,after I use the /opt/nvidia/jetson-io/jetson-io.py

to watch the cat /sys/kernel/debug/pinctrl/2430000.pinmux/pinmux-pins (for I can’t find this /sys/kernel/debug/tegra_pinctrl_reg point)

but I can’t get the spi function

Sorry, due to the forum’s restrictions on new users, I will still use the QOP account to communicate with you.

I dtc the device-tree found that the pinmux just modify the only one pin (SPI1_CS1_PZ7),so we can watch it on pinmux-pins.So I try to add the point on my overlay dtbo like this:

#include <dt-bindings/gpio/tegra234-gpio.h>
#include <dt-bindings/pinctrl/pinctrl-tegra.h>
#include <dt-bindings/tegra234-p3737-0000+p3701-0000.h>
/ {

    fragment-camera-pinmux@0 {
        target = <&pinmux>;
        __overlay__ {
            pinctrl-names = "default";
            pinctrl-0 = <&jetson_io_pinmux>;
            jetson_io_pinmux:exp-header-pinmux {
                hdr40-pin19 {
                    nvidia,pins = "spi1_mosi_pz5";
                    nvidia,function = "spi1";
                    nvidia,pin-label = "spi1_dout";
                    nvidia,tristate = <TEGRA_PIN_DISABLE>;
                    nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                };
                hdr40-pin21 {
                    nvidia,pins = "spi1_miso_pz4";
                    nvidia,function = "spi1";
                    nvidia,pin-label = "spi1_din";
                    nvidia,tristate = <TEGRA_PIN_DISABLE>;
                    nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                };
                hdr40-pin23 {
                    nvidia,pins = "spi1_sck_pz3";
                    nvidia,function = "spi1";
                    nvidia,pin-label = "spi1_sck";
                    nvidia,tristate = <TEGRA_PIN_DISABLE>;
                    nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                };
                hdr40-pin24 {
                    nvidia,pins = "spi1_cs0_pz6";
                    nvidia,function = "spi1";
                    nvidia,pin-label = "spi1_cs0";
                    nvidia,tristate = <TEGRA_PIN_DISABLE>;
                    nvidia,enable-input = <TEGRA_PIN_ENABLE>;
                };
            };
        };
    };

   ....
        };
    };
};

but when I use the opt/nvidia/jetson-io/config-by-hardware.py -n 2=Jetson Camera leopard-IMX728 to apply it the error has occurred

how I change the overlay.dts can fix the error

thanks

It seems you configured something error in overlay dtsi.

I think jetson-io will do those works and generate /boot/jetson-io-hdr40-user-custom.dtbo after reboot.
You don’t need to modify them in device tree manually.