Jetson Nano SPI Bus Not Working

Please refer to the following steps for SPI loopback test

Step 1. Connect MOSI and MISO of SPI1
MOSI(PIN19 of 40-pin GPIO header)
MISO(PIN21 of 40-pin GPIO header)

Step 2. Remove GPIO usage of SPI pins
2-1. Check flash log to know which dtb you are using (ex. tegra210-p3448-0000-p3449-0000-b00.dtb)
2-2. Remove GPIO usage in that device tree
2-2-1. Method 1 - Remove from source
diff --git a/kernel-dts/porg-platforms/tegra210-porg-gpio-p3448-0000-b00.dtsi b/kernel-dts/porg-platforms/tegra210-porg-gpio-p3448-0000-b00.dtsi
index 1ea952f..49d4196 100644
--- a/kernel-dts/porg-platforms/tegra210-porg-gpio-p3448-0000-b00.dtsi
+++ b/kernel-dts/porg-platforms/tegra210-porg-gpio-p3448-0000-b00.dtsi
@@ -27,11 +27,6 @@
                gpio_default: default {
                        gpio-input = <
                                TEGRA_GPIO(BB, 0)
-                               TEGRA_GPIO(B, 4)
-                               TEGRA_GPIO(B, 5)
-                               TEGRA_GPIO(B, 6)
-                               TEGRA_GPIO(B, 7)
-                               TEGRA_GPIO(DD, 0)
                                TEGRA_GPIO(E, 6)
                                TEGRA_GPIO(S, 5)
                                TEGRA_GPIO(A, 5)
@@ -49,11 +44,6 @@
                                TEGRA_GPIO(J, 7)
                                TEGRA_GPIO(G, 2)
                                TEGRA_GPIO(G, 3)
-                               TEGRA_GPIO(C, 0)
-                               TEGRA_GPIO(C, 1)
-                               TEGRA_GPIO(C, 2)
-                               TEGRA_GPIO(C, 3)
-                               TEGRA_GPIO(C, 4)
                                TEGRA_GPIO(H, 2)
                                TEGRA_GPIO(H, 5)
                                TEGRA_GPIO(H, 6)

2-2-2. Method 2 - Remove from decompiled dtb
2-2-2-1 Find you dtb in Linux_for_Tegra/kernel/dtb/tegra210-p3448-0000-p3449-0000-b00.dtb

2-2-2-2 Dissemble the dtb to dts
dtc -I dtb -O dts -o temp.dts tegra210-p3448-0000-p3449-0000-b00.dtb

2-2-2-3 Modify the following line
-        gpio-input = <0xd8 0xc 0xd 0xe 0xf 0xe8 0x26 0x95 0x5 0xbc 0xbd 0xbe 0xc1 0xc2 0xa8 0xc8 0xca 0x4d 0x4e 0x4c 0x4f 0x32 0x33 0x10 0x11 0x12 0x13 0x14 0x3a 0x3d 0x3e 0x41 0xe4>;
+        gpio-input = <0xd8 0x26 0x95 0x5 0xbc 0xbd 0xbe 0xc1 0xc2 0xa8 0xc8 0xca 0x4d 0x4e 0x4c 0x4f 0x32 0x33 0x3a 0x3d 0x3e 0x41 0xe4>;

2-2-2-4 Assemble the dts back to dtb
dtc -I dts -O dtb -o tegra210-p3448-0000-p3449-0000-b00.dtb temp.dts

2-2-2-5 Flash the board

Step 3. Running Jetson-IO to enable SPI1
3-1. Run Jetson IO
$ sudo /opt/nvidia/jetson-io/jetson-io.py
3-2. Configure SPI1
Configure Jetson 40pin Header => Configure header pins manually => Select "spi1 (19,21,23,24,26)" => Back -> Save pin changes => Save and reboot to reconfigure pins
3-3. Check pinmux for SPI if the same as following
$  sudo cat /sys/kernel/debug/tegra_pinctrl_reg | grep -i spi
Bank: 1 Reg: 0x70003050 Val: 0x0000e044 -> spi1_mosi_pc0
Bank: 1 Reg: 0x70003054 Val: 0x0000e044 -> spi1_miso_pc1
Bank: 1 Reg: 0x70003058 Val: 0x0000e044 -> spi1_sck_pc2
Bank: 1 Reg: 0x7000305c Val: 0x0000e048 -> spi1_cs0_pc3
Bank: 1 Reg: 0x70003060 Val: 0x0000e048 -> spi1_cs1_pc4
Bank: 1 Reg: 0x70003064 Val: 0x00006044 -> spi2_mosi_pb4
Bank: 1 Reg: 0x70003068 Val: 0x00006044 -> spi2_miso_pb5
Bank: 1 Reg: 0x7000306c Val: 0x00006044 -> spi2_sck_pb6
Bank: 1 Reg: 0x70003070 Val: 0x00006048 -> spi2_cs0_pb7
Bank: 1 Reg: 0x70003074 Val: 0x00006048 -> spi2_cs1_pdd0

Step 4. Probe SPI driver
$ sudo modprobe spidev

Step 5. Download/build this test file:
5-1 Download
$ wget https://raw.githubusercontent.com/torvalds/linux/v4.9/tools/spi/spidev_test.c
5-2 Build on the board
$ gcc -o spidev_test spidev_test.c

Step 6. Run the command and check if the result is expected:
$ sudo ./spidev_test -D /dev/spidev0.0 -v -p "HelloWorld123456789abcdef"
Or 
$ sudo ./spidev_test -D /dev/spidev0.0 -s 10000000 -v
1 Like
Spidev shows up in devices, but no MOSI or CS activity when attempting to transmit
Jetson nano spi
Problems in enabling SPI and disabling GPIOB
Problem with connecting the SPI to the Jetson Nano
SPI0 interface configured as a slave in Jetson Xavier NX
怎么使用spi接口?
Nano SPI Not Working
Jetson Nano SPI Not Working
Jetson Nano SPI reporting 0's on Loopback
Jetson Nano SPI communication
Jetson Nano SPI not working
About SPI communication in jetson nano
The AD/DA HIGH PRECISION BOARD with Jetson Nano does not connect
Trying to get SPI2 working on Jetson NANO Production Module
SPI Device Driver on Jetson AGX Orin
SPI setup issues with Jetson Nano B01 DevKit
How to use MCP3008 in jetson nano
Problem Encountered When Transmitting Images to DISPLAY via SPI Communication on Jetson Nano
SPI stops working after sudo apt upgrade on a Jetson Nano
How to connect to jetson nano 2gb mcp2515 can board?
Some problems about enable SPI by modifying DTB
In order to use spi.use 'falsh.sh' to flash board
SPI Communication problem (spidev)
SPI for nrc7292 network device not working
Cannot use SPI
Jetson Nano and SPI - How to Actually fix it with an SD Card Image
SPI Local Loop on Jetson Nano B01 4GB
Orin NX TPM 2.0 SPI support
Jetson nano with MCP2515 CAN MODULE
No SPI output on IO, GPIO works
Connect RFID MFRC522 with Nvidia jetson nano
NVIDIA Orin Nano SPI loopback test not receiving data
SPI doesn’t work in NVIDIA Jetson Nano Development Kit A02
After configuring SPI, SPI cannot be used. MISO and MOSI are connected together
Whether there is any special config to enable SPI?
Problem with SPI in Jetson Nano
Spi pinmux changes not being implemented when compiling kernel on Jetson Nano
How to connect SPI on Jetson Nano B01 Dev Kit, version from January 2023
Help Configuring SPI in Device Tree for Jetson Orin NX (16GB)
Help Configuring SPI in Device Tree for Jetson Orin NX (16GB)
Problem with SPI in Jetson Nano
Jetson nano spi not workiing
SPI Communication problem (spidev)
SPI setup on jetson nano board
SPI-app.cMISO and MOSI on Header 40 Pin connector?
Trying to get SPI2 working on Jetson NANO Production Module
SPI-app.cMISO and MOSI on Header 40 Pin connector?
Help Configuring SPI in Device Tree for Jetson Orin NX (16GB)
Jetson nano 4GB SPI stopped working after reboot
How to use MCP3008 in jetson nano
SPI1 has no waveform signal on any function pins
Enable SPI Jetson AGX Orin for AD/DA board
Jetson nano 4GB A02 mcp2515 connect
Continuation : SPI1 seems to not be working, how to check if its configured properly?
Problem Encountered When Transmitting Images to DISPLAY via SPI Communication on Jetson Nano
SPI Local Loop on Jetson Nano B01 4GB
Cannot open SPI on Jetson Nano
SPI Communication between Jetson Nano & Arduino
[Jetson Nano SPI Issue] TX Data Present, RX Always Zero – Post-Reflash Debugging Steps & Observations
Cannot open SPI on Jetson Nano
Jetson Orin AGX JP6.0: use two mcp2515 on SPI1
Jetson agx orin SPI2
Jetson Nano trouble using SPI
Continuation : SPI1 seems to not be working, how to check if its configured properly?
Jetson Nano SPI not working — no /dev/spidev0.0 after enabling via device tree
Configure mcp2515 on jetpack 5.1
SPI1 seems to not be working, how to check if its configured properly?
Problem Getting SPI Working on Jetson Nano
SPI setup issues with Jetson Nano B01 DevKit
Jetson nano MCP2515 socket CAN transmit not working
Spi pinmux changes not being implemented when compiling kernel on Jetson Nano
Not Getting any output after running Jetson-MFRC522 python code
Communicating with CAN Port using Jetson Nano 4GB B01
SPI setup issues with Jetson Nano B01 DevKit
The trouble with work jetson-io.py to connect the can bus to the jetson nano devkit
How to enable SPI pins in my jetson nano A203 carrier board for the communication with RFID-RC522 and also steps to verify that our SPI is enabled?
Jetson agx orin JetPack_5.1.2 use SPI2
SPI Setup Problem between Arduino UNO & Jetson Nano
Jetson Nano SPI don't work
Problem with SPI in Jetson Nano
SPI setup issues with Jetson Nano B01 DevKit
Problem with connecting the SPI to the Jetson Nano