Jetson Nano SPI don't work

Jetson Nano SPI don’t work

Development Environment

Hardware Platform:
Jetson Nano Devkit Board B01(P3450) 4GB

SD Image:
jetson-nano-jp461-sd-card-image.zip

used this command to update softpack
‘sudo apt-get update
sudo apt-get upgrade’

now jetpack version is 4.6.5(r32.7.6)

'@ubuntu:~/ws$ cat /etc/nv_tegra_release
 # R32 (release), REVISION: 7.6, GCID: 38171779, BOARD: t210ref, EABI: aarch64, DATE: Tue Nov  5 07:46:14 UTC 2024'

through ssh to control jetson with headless mode.

After apt upgrade down, I reboot jetson,

then use ‘sudo /opt/nvidia/jetson-io/jetson-io.py’ to enable spi,

reboot jetson,
and use ‘sudo modprobe spidev’, it makes ‘ls /dev/spi*’ show ‘/dev/spidev0.0 /dev/spidev0.1 /dev/spidev1.0 /dev/spidev1.1’,
use spidev_text.c,rec 00, I comfirm the pin-19 and pin-21 connected,
and the voltage on them is 0 volt.

'$ ./spidev_test -D /dev/spidev0.0
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
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  | ................................

then,I followed this to modify dtb

Step1: Dissemble the dtb to dts
dtc -I dtb -O dts -o temp.dts kernel_tegra210-p3448-0000-p3449-0000-b00-user-custom.dtb

Step2: 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>;

Step3: Change the spi pin function
- nvidia,function = "rsvd1";
+ nvidia,function = "spi1";

Step4: Assemble the dts back to dtb
dtc -I dts -O dtb -o kernel_tegra210-p3448-0000-p3449-0000-b00-user-custom.dtb temp.dts
spi1_mosi_pc0 {
    nvidia,pins = "spi1_mosi_pc0";
    nvidia,function = "spi1";
    nvidia,pull = <0x1>;
    nvidia,tristate = <0x0>;
    nvidia,enable-input = <0x1>;
};

spi1_miso_pc1 {
    nvidia,pins = "spi1_miso_pc1";
    nvidia,function = "spi1";
    nvidia,pull = <0x1>;
    nvidia,tristate = <0x0>;
    nvidia,enable-input = <0x1>;
};

spi1_sck_pc2 {
    nvidia,pins = "spi1_sck_pc2";
    nvidia,function = "spi1";
    nvidia,pull = <0x1>;
    nvidia,tristate = <0x0>;
    nvidia,enable-input = <0x1>;
};

spi1_cs0_pc3 {
    nvidia,pins = "spi1_cs0_pc3";
    nvidia,function = "spi1";
    nvidia,pull = <0x2>;
    nvidia,tristate = <0x0>;
    nvidia,enable-input = <0x1>;
};

spi1_cs1_pc4 {
    nvidia,pins = "spi1_cs1_pc4";
    nvidia,function = "spi1";
    nvidia,pull = <0x2>;
    nvidia,tristate = <0x0>;
    nvidia,enable-input = <0x1>;
};

reboot jetson, and the result is same, receive all 0.

$ ./spidev_test -D /dev/spidev0.0 -v
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 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  | ................................
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.6 LTS
Release:        18.04
Codename:       bionic

Pin mux outputs like this

$ 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
Bank: 1 Reg: 0x70003078 Val: 0x0000e015 -> spi4_mosi_pc7
Bank: 1 Reg: 0x7000307c Val: 0x0000e015 -> spi4_miso_pd0
Bank: 1 Reg: 0x70003080 Val: 0x0000e015 -> spi4_sck_pc5
Bank: 1 Reg: 0x70003084 Val: 0x0000e015 -> spi4_cs0_pc6
Bank: 1 Reg: 0x70003088 Val: 0x00002040 -> qspi_sck_pee0
Bank: 1 Reg: 0x7000308c Val: 0x00002000 -> qspi_cs_n_pee1
Bank: 1 Reg: 0x70003090 Val: 0x00002040 -> qspi_io0_pee2
Bank: 1 Reg: 0x70003094 Val: 0x00002040 -> qspi_io1_pee3
Bank: 1 Reg: 0x70003098 Val: 0x00002040 -> qspi_io2_pee4
Bank: 1 Reg: 0x7000309c Val: 0x00002040 -> qspi_io3_pee5
Bank: 0 Reg: 0x70000b70 Val: 0x00000001 -> drive_qspi_comp_control
Bank: 0 Reg: 0x70000b78 Val: 0x00000001 -> drive_qspi_lpbk_control
Bank: 0 Reg: 0x70000a78 Val: 0x00808000 -> drive_qspi_comp

I don’t know what I can do now, there anyone succeeded with jetson nano spi with B01?

Hi londoge,

Please share the result of cat /etc/nv_boot_control.conf on your devkit.

Could you refer to Jetson Nano SPI Bus Not Working - #10 by KevinFFF to setup and verify SPI loopback test?

It seems the pinmux configurations are correct for SPI usage.

I would also like to check the result of sudo cat /sys/kernel/debug/tegra_gpio on your devkit currently.

1 Like

Thanks for your reply,KevinFFF.

$ cat /etc/nv_boot_control.conf
TNSPEC 3448-400-0000-F.0-1-0-jetson-nano-qspi-sd-mmcblk0p1
COMPATIBLE_SPEC 3448-300-0000--1--jetson-nano-devkit-
TEGRA_CHIPID 0x21
TEGRA_OTA_BOOT_DEVICE /dev/mtdblock0
TEGRA_OTA_GPT_DEVICE /dev/mtdblock0
$ 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 04 00 00 000000
 B: 0:1 f0 00 00 00 00 00 000000
 C: 0:2 1f 00 00 00 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 02 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

Are you referring to ‘2-2-1. Method 1 - Remove from source’? I didn’t do that step.
I disassembled using ‘$dtc -I dtb -O dts -o tegra210-p3448-0000-p3449-0000-b00.dts tegra210-p3448-0000-p3449-0000-b00.dtb’ and modified gpio-input like this:

I don’t think there is much difference between the two? Do I need to start from source?

‘tegra210-p3448-0000-p3449-0000-b00.dtb’ should be ‘kernel_tegra210-p3448-0000-p3449-0000-b00-user-custom.dtb’,Generated by Jetson-io.

Is it your custom board config?
If so, what do you customize there?
I would suggest just using default jetson-nano-devkit.conf as board config to verify.

Please share the /boot/extlinux/extlinux.conf for further check

TIMEOUT 30
DEFAULT JetsonIO

MENU TITLE L4T boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      INITRD /boot/initrd
      APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4
console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0

# When testing a custom kernel, it is recommended that you create a backup of
# the original kernel and add a new entry to this file so that the device can
# fallback to the original kernel. To do this:
#
# 1, Make a backup of the original kernel
#      sudo cp /boot/Image /boot/Image.backup
#
# 2, Copy your custom kernel into /boot/Image
#
# 3, Uncomment below menu setting lines for the original kernel
#
# 4, Reboot

# LABEL backup
#    MENU LABEL backup kernel
#    LINUX /boot/Image.backup
#    INITRD /boot/initrd
#    APPEND ${cbootargs}

LABEL JetsonIO
        MENU LABEL Custom Header Config: <HDR40 User Custom [2025-05-30-114730]>
        LINUX /boot/Image
        FDT /boot/kernel_tegra210-p3448-0000-p3449-0000-b00-user-custom.dtb
        INITRD /boot/initrd
        APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=extt
4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0


No, I don’t know anything about ‘board config’, there is a spi-flash on board?
My board is second-hand,and this is my first time try to use spi with jetson.


I would try to search about this,thank you.

If it was flashed by previous user, it may be used custom board config for their use case.

It seems you are using the devkit, you can simply use SDK manager to flash it and I believe you would see jetson-nano-devkit used as board config after you run cat /etc/nv_boot_control.conf to check again.

Before flashed image into SDcard,I used SD Card Formatter to erase the entire card.In this case, does previous users still influence me?

I flashed SD card again, configured spi through jetson-io,dissemble and asmble the dtb.
I try to flash image by sdkmanager, but its failed when sdk update because i dont have a wired ethernet connection.

$ cat /etc/nv_boot_control.conf
TNSPEC 3448-200-0000-F.0-1-0-jetson-nano-qspi-sd-mmcblk0p1
COMPATIBLE_SPEC 3448-200-0000--1--jetson-nano-devkit-
TEGRA_CHIPID 0x21
TEGRA_OTA_BOOT_DEVICE /dev/mtdblock0
TEGRA_OTA_GPT_DEVICE /dev/mtdblock0

I have a question: if spi configured success, the board pin 21 and 19(bcm pin 9 and 10) still can be used as GPIO?


Dose this mean that the configuration failed?
Thank you for your reply!

I borrowed another jetson nano dev kit B01 and reconfigured it, including flashed the sd card image, setting jetson-io, and adjusting the device tree. The same result appeared, pins 21 and 19(bcm pin 9 and 10) can be operated and read as GPIO.

I find a way to solve this spi problem!
ANYONE want to use spi0/1 in jetson nano dev kit sd-card version should try this link.
(Jetson Nano and SPI - How to Actually fix it with an SD Card Image)
From the github project mentioned by heyho123.

The sdCard image from this link,can successfully run SPI Loop test.

$ ./spidev_test -v -D /dev/spidev0.0
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 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 | 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  | ......@....▒..................▒.

This is a useful method for those who do not want to use sdkmanager.
I’ll try the SDK manager and see if that fixes the issue as well?
And Thanks for your help in this topic,KevinFFF.

Yes, SD is used for rootfs/kernel image/dtb..etc.
However, there’s an QSPI in the module and have to reflash it. (either using SDK manager or flash command)

Good to hear that and thanks for your sharing.