Cannot process SPI Slave Communication In JP 6.0

Hi.
I’m using Jetson AGX Orin 64GB devkit, JP 6.0.
By following some topics in this forum, I did these process to enable spi slave communication.

  1. Apply pinmux by template spreadsheet.
  2. Double-check to apply pinmux by using Jetson-IO script (/opt/nvidia/jetson-io/jetson-io.py).
  3. Decompile DTB (/boot/dtb/kernel_tegra234-p3737-0000+p3701-0000-nv.dtb) , find spi@3210000 - which is 40-pin header spi address, and modify compatible = “nvidia,tegra210-spi” into compatible = “nvidia,tegra210-spi-slave”. Then compile it and reboot.
    3-1. Or, modify SOURCE/hardware/nvidia/t23x/nv-public/tegra234.dtsi, which leads to same result.
  4. In dmesg, I can confirm spi-tegra124-slave module has been loaded.

But when I test SPI slave mode by python3-spidev or spidev_test, there is no interrupt at all. Devkit doesn’t receive any data.
Below is my test method.

  1. Connect externel MCU board that has been configured SPI master into 40-pin header.
  2. Run simple python script to open spidev and get data. This is it:
    slave.txt (373 Bytes)
  3. Or, use spidev_test of this comment: Jetson Nano trouble using SPI - Jetson & Embedded Systems / Jetson Nano - NVIDIA Developer Forums

But neither of them doesn’t receive anything.

Strange thing is when I downgrade JP version by 6.0 into 5.1.3, and do upper process as same, It works. Both of scripts receive test data by externel MCU very well. Then I checked this topic: Jetson AGX Orin: Issues with minimum SPI speed and byte send order after update to Jetpack 6 - Jetson & Embedded Systems / Jetson AGX Orin - NVIDIA Developer Forums

But there is no any information about slave mode problem. I understand there is some kind of SPI speed problem, and checked it in SPI master mode. But in slave mode, speed was not problem - I can’t receive anything at any of speed rate.
I tried port spi-tegra124-slave.c driver of JP 5.1.3 into JP 6.0, but didn’t work, too.

So this is my question: Is there any way to enable SPI slave communication in JP 6.0? Due to some requirements in my project, I want to use JP 6.0 as far as I can.

Kind regards,
Byeongil

Hi mby7138,

Can you share the full dmesg for further check?

Do you mean that it works as expected with the exact same configuration (connection, device tree, pinmux…etc) in JP5.1.3 but not work in JP6.0GA?
If so, have you tried to port spi-tegra124-slave.c driver from JP5 to JP6?

Hi KevinFFF,
This is full dmesg log.
dmesg.txt (73.7 KB)
And Yes, you are right. I did exactly same configuration in both version. In JP5.1.3, SPI slave worked. But not in JP6.0. (I’m little confused, but JP6.0GA means JP6.0 (L4T 36.3) right?)
Yes, I tried to port spi-tegra124-slave.c driver from JP5 to JP6. But didn’t work.

[   10.458535] spi-tegra124-slave 3210000.spi: Adding to iommu group 1
[   10.458586] spi-tegra124-slave 3210000.spi: Dynamic bus number will be registered

I can’t find the errors in your dmesg about spi-slave.
Have you run sudo modprobe spidev to load the spidev driver?

Please share all the configuration you modified to get it work in JP5.1.3.

Yes. I tried sudo modprobe spidev, even though it is already loaded in boot. Also did unload it by rmmod and load it again. I did it to spi-tegra124-slave module, too. But all of them didn’t work.

The configuration I modified at JP5.1.3 was same as JP6.0.

  1. Apply pinmux by using Jetson-IO script.
  2. Modify spi@3210000 {compatible = "nvidia,tegra210-spi" into compatible = "nvidia,tegra210-spi-slave". In this time, I’m not sure about if JP5.1.3 use same dtsi file as JP6.0, so I just decompile dtb file in /boot/dtb and modified it. And compiled into dtb, again.

Oh, and I forgot to tell - there was modify in /arch/arm64/configs/defconfig file to add CONFIG_SPI_SLAVE=y. I did it to both of JP version as same, of course.

In JP5.1.3, spidev module didn’t loaded at boot time, so I manually loaded it by modprobe. But everything else was same.

Please tell me if you need any further information. Thanks.

Do you just perform this on the devkit?
You may not apply the change with that since we load dtb from uefi-dtb in JP6.

Please share the extracted_proc.dts after you run the following command on your board.

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

This is it.
extracted_proc.txt (446.3 KB)

I thought using Jetson-IO script changes /boot/extlinux/extlinux.conf so it allows linux to load dtb from /boot/dtb.

When testing JP6, I can assure SOURCE/hardware/nvidia/t23x/nv-public/tegra234.dtsi will be included in build-time, so I modified that, too. Module spi-tegra124-slave has loaded at boot time again, but no effects.
(When testing JP5.1.3, source file tree structure was so different that I can’t sure what dts files will be included.)

I forgot to say again - my python script just using bus 0, but as “Dynamic bus number will be registered” message shown in dmesg, I tested both of SPI bus 0.0 and 1.0 (as I testing CS0 pin). But it didn’t work anyway.

In Jetpack 5, it seems CONFIG_SPI_TEGRA124_SLAVE is configured as y.

But it is configured as following in the Makefile of Jetpack 6.

obj-m += spi-tegra124-slave.o

Could you try to run the following command to load it manually?

$ sudo modprobe spi-tegra124-slave

I did, but didn’t work.
Is there any difference between master and slave pinmux?
And could you please let me know if slave works in your JP6, if possible? thanks.

I’m checking SPI slave function in JP6.0 with internal, and will update to you once I get the result.

Is there any update?

We have found the potential issue in SPI slave driver of JP6.0. I’m still working with internal for the possible fix, please wait for my update by next week.