I’m using a stock Jetson Nano B01 DevKit with Jetpack 4.6.4 and am unable to get SPI working for either the SPI1 or SPI2 pins. Both fail the simple loopback test (spidev_test) referenced here: Jetson Nano trouble using SPI
sudo ./spidev_test -D /dev/spidev0.0 -g16 -zz
using device: /dev/spidev0.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: 10000000 Hz (10000 KHz)
no. runs: 1
Using seed:0x650bbad9
loop count = 0
using sequential pattern …
transfer bytes [16]
0000: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
transfer: Return actual transfer length: 16
receive bytes [16]
0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
mismatch index 1
^^^ 00 00 00 00 00 00 00 00 00 00 00 /dev/spidev0.0: TEST FAILED !!! (status:-1)
I’ve read through all of the forum posts I could find on this topic, but haven’t found a solution that works for me yet.
I started with a fresh installation of Jetpack 4.6.4 via SDKManager, then used jetson-io to enable SPI1 and SPI2, followed by rebooting.
I’ve confirmed that extlinux.conf FDT references the correct dtb filename.
When this didn’t work, I tried manually editing the file (kernel_tegra210-p3448-0000-p3449-0000-b00-user-custom.dtb) to replace the “rsvd*” references with “spi*” references and recompiling, as suggested in several posts. Still no luck.
Some relevant system state checks are below:
cat /etc/nv_tegra_release
R32 (release), REVISION: 7.4, GCID: 33514132, BOARD: t210ref, EABI: aarch64, DATE: Fri Jun 9 04:25:08 UTC 2023
dmesg | grep spi
[ 0.475131] iommu: Adding device 7000d400.spi to group 7
[ 0.475401] iommu: Adding device 7000d600.spi to group 8
[ 0.475678] iommu: Adding device 70410000.spi to group 9
[ 3.741574] tegra-qspi 70410000.spi: Prod settings list not found
[ 3.749795] qspi_mtd spi32766.0: MX25U3235F (4096 Kbytes)
[ 3.749803] qspi_mtd spi32766.0: mtd .name = spi32766.0, .size = 0x400000 (4MiB) .erasesize = 0x00001000 (4KiB) .numeraseregions = 0
dmesg | grep gpio
[ 0.588622] gpio gpiochip0: gpio-line-names specifies 240 line names but there are 256 lines on the chip
[ 0.589791] GPIO line 6 (system-suspend-gpio) hogged as output/high
[ 0.590318] gpiochip_setup_dev: registered GPIOs 0 to 255 on device: gpiochip0 (tegra-gpio)
[ 0.647464] gpiochip_setup_dev: registered GPIOs 504 to 511 on device: gpiochip1 (max77620-gpio)
[ 0.673179] extcon-gpio-states extcon:extcon@1: Cable state:0, cable id:0
[ 4.053338] i2c-mux-gpio cam_i2cmux: 2 port mux on Tegra I2C adapter adapter
[ 4.166693] FAN:gpio request success.
[ 5.326693] tegradc tegradc.1: No hpd-gpio in DT
[ 5.395946] input: gpio-keys as /devices/gpio-keys/input/input3
ls -lt /dev/gpio*
crw------- 1 root root 254, 1 Sep 20 14:08 /dev/gpiochip1
crw-rw---- 1 root gpio 254, 0 Sep 20 14:08 /dev/gpiochip0
ls -lt /dev/spi*
crw-rw---- 1 root gpio 153, 0 Sep 20 14:08 /dev/spidev0.0
crw-rw---- 1 root gpio 153, 1 Sep 20 14:08 /dev/spidev0.1
crw-rw---- 1 root gpio 153, 2 Sep 20 14:08 /dev/spidev1.0
crw-rw---- 1 root gpio 153, 3 Sep 20 14:08 /dev/spidev1.1
sudo cat /sys/kernel/debug/gpio | grep -i spi
gpio-12 (SPI1_MOSI )
gpio-13 (SPI1_MISO )
gpio-14 (SPI1_SCK )
gpio-15 (SPI1_CS0 )
gpio-16 (SPI0_MOSI )
gpio-17 (SPI0_MISO )
gpio-18 (SPI0_SCK )
gpio-19 (SPI0_CS0 )
gpio-20 (SPI0_CS1 )
gpio-232 (SPI1_CS1 )
sudo cat /sys/kernel/debug/tegra_gpio
Name:Bank:Port CNF OE OUT IN INT_STA INT_ENB INT_LVL
A: 0:0 64 40 40 24 00 00 000000
B: 0:1 f0 00 00 00 00 00 000000
C: 0:2 1f 00 00 18 00 00 000000
D: 0:3 00 00 00 00 00 00 000000
E: 1:0 40 00 00 00 00 00 000000
F: 1:1 00 00 00 00 00 00 000000
G: 1:2 0c 00 00 00 00 00 000000
H: 1:3 fd 99 00 60 00 00 000000
I: 2:0 07 07 03 02 00 00 000000
J: 2:1 f0 00 00 00 00 00 000000
K: 2:2 00 00 00 00 00 00 000000
L: 2:3 00 00 00 00 00 00 000000
M: 3:0 00 00 00 00 00 00 000000
N: 3:1 00 00 00 00 00 00 000000
O: 3:2 00 00 00 00 00 00 000000
P: 3:3 00 00 00 00 00 00 000000
Q: 4:0 00 00 00 00 00 00 000000
R: 4:1 00 00 00 00 00 00 000000
S: 4:2 a0 80 00 00 00 00 000000
T: 4:3 01 01 00 00 00 00 000000
U: 5:0 00 00 00 00 00 00 000000
V: 5:1 01 00 00 00 00 00 000000
W: 5:2 00 00 00 00 00 00 000000
X: 5:3 78 08 08 70 00 60 606000
Y: 6:0 06 00 00 02 00 00 000000
Z: 6:1 0f 08 08 04 00 06 020600
AA: 6:2 00 00 00 00 00 00 000000
BB: 6:3 01 00 00 00 00 00 000000
CC: 7:0 92 80 80 10 00 12 121200
DD: 7:1 01 00 00 00 00 00 000000
EE: 7:2 00 00 00 00 00 00 000000
FF: 7:3 00 00 00 00 00 00 000000
From what I could infer from several other posts, it seems like the issue might be with the gpios hanging onto the pins (e.g. C: 0:2 1f 00 00 18 00 00 000000).
I tried removing the gpio-input = <… 0x10 0x11 0x12 0x13 0x14…> as suggested in this post: Jetson Nano SPI Bus Not Working - #10 by KevinFFF, but SPI still doesn’t work and it had no impact on the sudo cat /sys/kernel/debug/tegra_gpio output.
I’m new to working with device trees and it’s unclear to me what to look for to find the root cause of this. Any guidance on next steps would be appreciated.