How to configure SPI3 on Orin NX as a slave device?

Hello everyone, I’m working on NVIDIA Orin NX and encountered an issue with SPI3. I would appreciate any advice.
1、I need SPI3 to function as a slave, with the MCU on the other end acting as the master.
2、I have measured with an oscilloscope that the MCU’s SPI master output is normal.
3、I have modified the DTS on the Orin NX and confirmed that the kernel has successfully loaded the DTB (I am using my custom-designed carrier board).

                /* SPI3, 40pin header, Pin 37(MOSI), Pin 22(MISO), Pin 13(CLK), Pin 18(CS) */
                spi@3230000{
+                       compatible = "nvidia,tegra186-spi-slave";
                        status = "okay";
+
                        spi@0 {
                                compatible = "tegra-spidev";
                                reg = <0x0>;
                                spi-max-frequency = <50000000>;
                                controller-data {
-                                       nvidia,enable-hw-based-cs;
-                                       nvidia,rx-clk-tap-delay = <0x10>;
+                               //      nvidia,enable-hw-based-cs;
+                                       nvidia,rx-clk-tap-delay = <0x0>;
                                        nvidia,tx-clk-tap-delay = <0x0>;
                                };
                        };
                        spi@1 {
+                               status = "disabled";
                                compatible = "tegra-spidev";
                                reg = <0x1>;
                                spi-max-frequency = <50000000>;

nvidia@upai-pro02:~$ sudo dmesg | grep spi
[sudo] password for nvidia: 
[    9.048284] spi-tegra124-slave 3230000.spi: Adding to iommu group 1
[    9.048766] spi-tegra124-slave 3230000.spi: Dynamic bus number will be registered
[    9.049269] spi-tegra114 3210000.spi: Adding to iommu group 1
nvidia@upai-pro02:~$ ls /dev/spidev*
/dev/spidev0.0  /dev/spidev1.0

4、All the data I receive is 00. Which parts do I need to modify?

nvidia@upai-pro02:~$ sudo ./spidev_test -D /dev/spidev1.0 -v -s 2000000 -d 0 -H
spi mode: 0x1
bits per word: 8
max speed: 2000000 Hz (2000 KHz)
TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  | ......@....�..................�.
RX | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  | ................................

5、Linux kernel boot log
kernel.log (61.2 KB)

Hi lih1,

Are you using the devkit or custom board for Orin NX?
What’s the Jetpack version in use?

From the log you share, it seems SPI3 (3230000.spi) as slave is /dev/spidev0.0 since it is probed earlier than SPI1(3210000.spi) as master.

Please try using /dev/spidev0.0 instead or you can simply disable spi@3210000 from device tree.

Hi @KevinFFF
Thanks for your quick reply.

I’m using a custom board with the Orin NX module.

nvidia@upai-pro02:/$ cat /etc/nv_tegra_release
# R36 (release), REVISION: 4.4, GCID: 41062509, BOARD: generic, EABI: aarch64, DATE: Mon Jun 16 16:07:13 UTC 2025
# KERNEL_VARIANT: oot
TARGET_USERSPACE_LIB_DIR=nvidia
TARGET_USERSPACE_LIB_DIR_PATH=usr/lib/aarch64-linux-gnu/nvidia

I have already disabled the spi@3210000 node. Is there any problem with my device tree configuration? What else do I need to modify to make SPI3 work in slave mode?

137                 /* SPI1, 40pin header, Pin 19(MOSI), Pin 21(MISO), Pin 23(CLK), Pin 24(CS) */
138                 spi@3210000{
139                         status = "disabled";
140                         spi@0 {
141                                 compatible = "tegra-spidev";
142                                 reg = <0x0>;
143                                 spi-max-frequency = <50000000>;
144                                 controller-data {
145                                         nvidia,enable-hw-based-cs;                                                        
146                                         nvidia,rx-clk-tap-delay = <0x10>;
147                                         nvidia,tx-clk-tap-delay = <0x0>;
148                                 };
149                         };
150                         spi@1 {
151                                 status = "disabled";
152                                 compatible = "tegra-spidev";
153                                 reg = <0x1>;
154                                 spi-max-frequency = <50000000>;
155                                 controller-data {
156                                         nvidia,enable-hw-based-cs;
157                                         nvidia,rx-clk-tap-delay = <0x10>;
158                                         nvidia,tx-clk-tap-delay = <0x0>;
159                                 };
160                         };
161 
162                 };
163 
164                 /* SPI3, 40pin header, Pin 37(MOSI), Pin 22(MISO), Pin 13(CLK), Pin 18(CS) */
165                 spi@3230000{
166                         compatible = "nvidia,tegra186-spi-slave";
167                         status = "okay";
168 
169                         spi@0 {
170                                 compatible = "tegra-spidev";
171                                 reg = <0x0>;
172                                 spi-max-frequency = <50000000>;
173                                 controller-data {
174                                 //      nvidia,enable-hw-based-cs;
175                                         nvidia,rx-clk-tap-delay = <0x0>;
176                                         nvidia,tx-clk-tap-delay = <0x0>;
177                                 };
178                         };
179                         spi@1 {
180                                 status = "disabled";
181                                 compatible = "tegra-spidev";
182                                 reg = <0x1>;
183                                 spi-max-frequency = <50000000>;
184                                 controller-data {
185                                         nvidia,enable-hw-based-cs;
186                                         nvidia,rx-clk-tap-delay = <0x10>;
187                                         nvidia,tx-clk-tap-delay = <0x0>;
188                                 };
189                         };
190                 };

Hi @KevinFFF
All the data I receive is zeros. What could be the problem? My SPI master is an MCU (I measured with an oscilloscope and there is data).

nvidia@upai-pro02:~$ sudo ./spi_slave_revc 
=== SPI Slave (CS Poll Mode) ===
Device: /dev/spidev1.0
Mode  : 1 (CPOL=0, CPHA=1)
Speed : 2000000 Hz (2.0 MHz)
Bits  : 8
Waiting for master CS low...

RX[  1] | 00 00 00 00 00 00 00 00 00 00 | ..........
RX[  2] | 00 00 00 00 00 00 00 00 00 00 | ..........
RX[  3] | 00 00 00 00 00 00 00 00 00 00 | ..........
RX[  4] | 00 00 00 00 00 00 00 00 00 00 | ..........
RX[  5] | 00 00 00 00 00 00 00 00 00 00 | ..........
RX[  6] | 00 00 00 00 00 00 00 00 00 00 | ..........
RX[  7] | 00 00 00 00 00 00 00 00 00 00 | ..........
RX[  8] | 00 00 00 00 00 00 00 00 00 00 | ..........
RX[  9] | 00 00 00 00 00 00 00 00 00 00 | ..........
RX[ 10] | 00 00 00 00 00 00 00 00 00 00 | ..........
RX[ 11] | 00 00 00 00 00 00 00 00 00 00 | ..........
RX[ 12] | 00 00 00 00 00 00 00 00 00 00 | ..........
RX[ 13] | 00 00 00 00 00 00 00 00 00 00 | ..........
RX[ 14] | 00 00 00 00 00 00 00 00 00 00 | ..........

@KevinFFF Looking forward to your response.

Hi @KevinFFF
Are there any answers? Can you offer some help?

Could you try using spidev_test tool with -r option for SPI slave to wait the data sent from your MCU(SPI master)?

Is there still the /dev/spidev1.0 after you’ve disabled spi@3210000?

Hi @KevinFFF
1、This is the current status.

 17         aliases {
 18                 serial1 = &uarta;
 19                 serial2 = &uarte;
 20                 serial3 = &uartb;
 21                 spi1 = &spi1;
 22                 spi3 = &spi3;
 23         };

139                 /* SPI1, 40pin header, Pin 19(MOSI), Pin 21(MISO), Pin 23(CLK), Pin 24(CS) */
140                 spi1: spi@3210000{
141                         status = "disabled";
142                         spi@0 {
143                                 status = "disabled";
144                                 compatible = "tegra-spidev";
145                                 reg = <0x0>;
146                                 spi-max-frequency = <50000000>;
147                                 controller-data {
148                                         nvidia,enable-hw-based-cs;
149                                         nvidia,rx-clk-tap-delay = <0x10>;
150                                         nvidia,tx-clk-tap-delay = <0x0>;
151                                 };
152                         };
153                         spi@1 {
154                                 status = "disabled";
155                                 compatible = "tegra-spidev";
156                                 reg = <0x1>;
157                                 spi-max-frequency = <50000000>;
158                                 controller-data {
159                                         nvidia,enable-hw-based-cs;
160                                         nvidia,rx-clk-tap-delay = <0x10>;
161                                         nvidia,tx-clk-tap-delay = <0x0>;
162                                 };
163                         };
164 
165                 };
166 
167                 /* SPI3, 40pin header, Pin 37(MOSI), Pin 22(MISO), Pin 13(CLK), Pin 18(CS) */


168                 spi3: spi@3230000{
169                         status = "okay";
170                         compatible = "nvidia,tegra186-spi-slave";
171                         spi@0 {
172                                 status = "okay";
173                                 compatible = "spidev";
174                                 reg = <0x0>;
175                                 spi-max-frequency = <50000000>;
176                                 controller-data {
177                                 //      nvidia,enable-hw-based-cs;
178                                         nvidia,rx-clk-tap-delay = <0x0>;
179                                         nvidia,tx-clk-tap-delay = <0x0>;
180                                 };
181                         };
182                         spi@1 {
183                                 status = "disabled";
184                                 compatible = "tegra-spidev";
185                                 reg = <0x1>;
186                                 spi-max-frequency = <50000000>;
187                                 controller-data {
188                                         nvidia,enable-hw-based-cs;
189                                         nvidia,rx-clk-tap-delay = <0x10>;
190                                         nvidia,tx-clk-tap-delay = <0x0>;
191                                 };
192                         };
193                 };

nvidia@upai-pro02:~$ ls /dev/spidev*
/dev/spidev3.0
nvidia@upai-pro02:~$ sudo dmesg | grep spi
[    7.795890] spi-tegra124-slave 3230000.spi: Adding to iommu group 1

2、Is it this one?

Hi @KevinFFF

nvidia@upai-pro02:~/spi_li$ sudo ./spidev_test -D /dev/spidev3.0 -s5000000 -g10 -b8 -H -f pattern.txt -n1 -zzz -r
Disabling transmit
using device: /dev/spidev3.0
setting spi mode for read,write
setting spi bpw
setting max speed for rd/wr
spi mode: 1
bits per word: 8 bytes per word: 1
max speed: 5000000 Hz (5000 KHz)
no. runs: 1
Using seed:0x67b740b6
loop count = 0 


root@upai-pro02:/home/nvidia/spi_li# sudo ./spidev_test -D /dev/spidev3.0 -s2000000 -c 1 -g 10 -d 1000 -n -1 -zzz
using device: /dev/spidev3.0
setting spi mode for read,write
setting spi bpw
setting max speed for rd/wr
spi mode: 0
bits per word: 8 bytes per word: 1
max speed: 2000000 Hz (2000 KHz)
no. runs: -1
Using seed:0x67b74a05
start controller error: -1
/dev/spidev3.0: TEST PASSED 
====== Transfer stats ====
Transmit:
       total: 0B (0KiB 0MiB)
       total: 0P 
       ioerr: 0B (0KiB 0MiB)
       ioerr: 0P
 Rate:
  wire total: -1B/s (0KB/s)
       total: -1B/s (0KB/s)
  wire total: -1P/s
       total: -1P/s
Receive:
       total: 0B (0KiB 0MiB)
       total: 0P 
        good: 0B (0KiB 0MiB)
        good: 0P
       ioerr: 0P
     dataerr: 0P
 Rate:
        good: -1B/s (0KB/s)
        good: -1P/s
 packet drop: -1/10000

  Total time: 0.000042s

The SPI master is sending data. Could it be that the NX DTS configuration is incorrect?

Hi @KevinFFF
The project is quite urgent. Could you please provide more support? Thank you in advance

Hi @KevinFFF
Is there any progress? Could you give some updates (or a reply)?

Would it work if you run this command to disable transmit for SPI slave and keep it waiting for the data sent from your SPI master?

It seems there’s the data since you don’t add -r option to disable the transmit.

Hi @KevinFFF

It keeps getting stuck here and doesn’t receive any data. Could you provide some standard configuration methods for dts or other related settings?
I just want to know how to configure and use an SPI slave. Constantly @-mentioning you is annoying, sorry! I just want to solve the problem.

I’ve checked the device tree you shared, they look good to me.
As my understanding, you just need to configure the compatible string to get slave mode working.

Please note that I don’t have your custom board even your SPI master device, I cannot give you the exact cause of your issue immediately.

You can refer to the following link for the steps how we’ve verified spi-slave on the devkit through simply shorting SPI1(as master) and SPI3(as slave) with running spidev_test command(master with -t and slave with -r).
https://elinux.org/Jetson/L4T/peripheral/#Slave_Mode
Please also make sure you’ve configured the pinmux for SPI pins correctly before performing above workflow.

Okay, thanks. I’ll give it a try.