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.

Hi Kevin

I have created my own DTBO to adapt to our custom requirements, so I need to add relevant content in our own overlay.and I will send you our custom dtsi,(leopard-overlay.txt and leopard-camera-modules-imx728-overlay),I can use the overlay before I add the “fragment-camera-pinmux@0” part.

I am not only dtc the jetson-io-hdr40-user-custom.dtbo but also ref the source code “tegra234-p3737-0000+p3701-0000-hdr40.dts” to check my changes.But still has the error.

So I need your help to solve it . here is the dtb

leopard-overlay.txt (4.7 KB)

leopard-camera-modules-imx728-overlay.txt (3.3 KB)

Although I still don’t understand why directly setting the function of these pins to SPI in the pinmux configuration file didn’t take effect, I want to first try using the overlay method to configure them and see if it can resolve the issue.

Thanks

I would suggest you run the following command and check if the overlay has been applied correctly in.
(i.e. if your customizations have been included in extracted_proc.dts).

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

Have you also verified if SPI loopback test working on the AGX Orin devkit to clarify if the issue is specific to your custom board or if your verification steps are correct?

HI kevin

here is the extracted_proc.dts

extracted_proc.txt (349.3 KB)

and I think I know why the config-by-hardware.py take error log ;If I want to change the pinmux function I must use this “jetson-header-name = “Jetson 40pin Header”;“ in dts. How we can combine the pin config with csi config?

Thanks.

It seems you pinmux configuration for SPI not included in pinmux@2430000 {.

I will suggest you just flashing clean JP6.2(r36.4.3) and use Jetson-IO to enable SPI function.
You should be able to see them configured in pinmux@2430000 {.

Or do you have custom design of 40pins header on the custom carrier board?
If so, Jetson-IO tool may not work for your case.

yes,I have flashed the clean JP6.2(r36.4.3) and use Jetson-IO to enable SPI function.And it can work.but we have custom design of 40pins header on the custom carrier board.I have a question about PINMUX config file

we use the file “Orin-jetson_agx_orin-pinmux.dtsi” to config the custom board ,and check a lot pinmux function result like uart ,gpio .They all worked ,but only the spi1 dont work.

if I dont config the spi in pinmux@2430000{ ,it will use the pinmux.conf ?

I need your answer.

Thanks

If it can work, you can add the similar configuration for your custom carrier board.

Pinmux dtsi is loaded in early boot stage(MB1) to configure the default pinmux.

The answer here is YES.
The configuration under pinmux@2430000 is loaded by pinctrl driver and it would be configured during kernel boot.

You can also run the following command to check their pinmux register to check if your configurations have been applied correctly.

$ sudo busybox devmem 0x0243d028 //SPI1_SCK
$ sudo busybox devmem 0x0243d018 //SPI1_MISO
$ sudo busybox devmem 0x0243d040 //SPI1_MOSI
$ sudo busybox devmem 0x0243d008 //SPI1_CS0

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