Cannot use SPI

I’ve been struggling with the use of spi. I’m just trying to use rfid via rc522. It’s just waiting and doesn’t read. reader’s red light is on. To eliminate probability that reader is broken, I tested on arduino uno and worked great.
I have two different jetson nano and both have same problem so probability of pins are broken is low.

I’ve short pinned pin 19 and 21 and this is result.
sudo ./mytestprogram -D /dev/spidev0.0 -v -p “HelloWorld123456789abcdef”
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
TX | 48 65 6C 6C 6F 57 6F 72 6C 64 31 32 33 34 35 36 37 38 39 61 62 63 64 65 66 __ __ __ __ __ __ __ | HelloWorld123456789abcdef
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 __ __ __ __ __ __ __ | …

sudo grep -C 4 spi1 /sys/kernel/debug/pinctrl/pinctrl-maps

device 700008d4.pinmux
state default
type MUX_GROUP (2)
controlling device 700008d4.pinmux
group spi1_cs1_pc4
function spi1

device 700008d4.pinmux
state default
type CONFIGS_GROUP (4)
controlling device 700008d4.pinmux
group spi1_cs1_pc4
config pull=2
config tristate=0
config enable-input=1

device 700008d4.pinmux
state default
type MUX_GROUP (2)
controlling device 700008d4.pinmux
group spi1_cs0_pc3
function spi1

device 700008d4.pinmux
state default
type CONFIGS_GROUP (4)
controlling device 700008d4.pinmux
group spi1_cs0_pc3
config pull=2
config tristate=0
config enable-input=1

device 700008d4.pinmux
state default
type MUX_GROUP (2)
controlling device 700008d4.pinmux
group spi1_sck_pc2
function spi1

device 700008d4.pinmux
state default
type CONFIGS_GROUP (4)
controlling device 700008d4.pinmux
group spi1_sck_pc2
config pull=1
config tristate=0
config enable-input=1

device 700008d4.pinmux
state default
type MUX_GROUP (2)
controlling device 700008d4.pinmux
group spi1_miso_pc1
function spi1

device 700008d4.pinmux
state default
type CONFIGS_GROUP (4)
controlling device 700008d4.pinmux
group spi1_miso_pc1
config pull=1
config tristate=0
config enable-input=1

device 700008d4.pinmux
state default
type MUX_GROUP (2)
controlling device 700008d4.pinmux
group spi1_mosi_pc0
function spi1

device 700008d4.pinmux
state default
type CONFIGS_GROUP (4)
controlling device 700008d4.pinmux
group spi1_mosi_pc0
config pull=1
config tristate=0
config enable-input=1


device 700008d4.pinmux
state 2
type MUX_GROUP (2)
controlling device 700008d4.pinmux
group spi1_mosi_pc0
function rsvd1

device 700008d4.pinmux
state 2
type CONFIGS_GROUP (4)
controlling device 700008d4.pinmux
group spi1_mosi_pc0
config pull=1
config tristate=1
config enable-input=0

device 700008d4.pinmux
state 2
type MUX_GROUP (2)
controlling device 700008d4.pinmux
group spi1_miso_pc1
function rsvd1

device 700008d4.pinmux
state 2
type CONFIGS_GROUP (4)
controlling device 700008d4.pinmux
group spi1_miso_pc1
config pull=1
config tristate=1
config enable-input=0

device 700008d4.pinmux
state 2
type MUX_GROUP (2)
controlling device 700008d4.pinmux
group spi1_sck_pc2
function rsvd1

device 700008d4.pinmux
state 2
type CONFIGS_GROUP (4)
controlling device 700008d4.pinmux
group spi1_sck_pc2
config pull=1
config tristate=1
config enable-input=0

device 700008d4.pinmux
state 2
type MUX_GROUP (2)
controlling device 700008d4.pinmux
group spi1_cs0_pc3
function rsvd1

device 700008d4.pinmux
state 2
type CONFIGS_GROUP (4)
controlling device 700008d4.pinmux
group spi1_cs0_pc3
config pull=1
config tristate=1
config enable-input=0

device 700008d4.pinmux
state 2
type MUX_GROUP (2)
controlling device 700008d4.pinmux
group spi1_cs1_pc4
function rsvd1

device 700008d4.pinmux
state 2
type CONFIGS_GROUP (4)
controlling device 700008d4.pinmux
group spi1_cs1_pc4
config pull=1
config tristate=1
config enable-input=0

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: 0x00006046 → spi2_mosi_pb4
Bank: 1 Reg: 0x70003068 Val: 0x00006046 → spi2_miso_pb5
Bank: 1 Reg: 0x7000306c Val: 0x00006046 → spi2_sck_pb6
Bank: 1 Reg: 0x70003070 Val: 0x00006046 → spi2_cs0_pb7
Bank: 1 Reg: 0x70003074 Val: 0x00006045 → 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

cat /etc/nv_tegra_release

R32 (release), REVISION: 7.1, GCID: 29818004, BOARD: t210ref, EABI: aarch64, DATE: Sat Feb 19 17:05:08 UTC 2022

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 20 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

my wiring schema is:

I’ve spi1 activated using jetson-io. Also I have flashed sd cards using balena in windows with official image

It seems you’re L4T R32.7.1 release, are you using Jetson Nano devkit or the other one?
We need to know which Jetson module you’re using, then can provide correct suggestions.

Thanks

Jetson Nano developer kit.

Hi mustafasoyadsiz,

Could you help to refer to the following thread to verify SPI loopback test step-by-step?
Jetson Nano SPI Bus Not Working - #10 by KevinFFF

Well at the remove GPIO pins step I do not have flash logs and do not have dtsi files. but using method 2.2.2 my configuration different than described one.

	default {
		gpio-input = <0x5 0xbc 0xbd 0xbe 0xc1 0xa9 0xca 0x3a 0x3d 0x3e 0x41 0xe4>;
		gpio-output-low = <0x97 0x98 0xcb 0x38 0x3b 0x3c 0x3f 0x40 0x42>;
		gpio-output-high = <0x6 0xbb 0xe7>;
		linux,phandle = <0x41>;
		phandle = <0x41>;
	};

However as our aim to remove gpio usage from SPI pins I converted into this:

	default {
		gpio-input = <>;
		gpio-output-low = <>;
		gpio-output-high = <>;
		linux,phandle = <0x41>;
		phandle = <0x41>;
	};

now there are the results after compile → reboot ->jetson-io → spi1 activated → reboot and

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: 0x00006046 → spi2_mosi_pb4
Bank: 1 Reg: 0x70003068 Val: 0x00006046 → spi2_miso_pb5
Bank: 1 Reg: 0x7000306c Val: 0x00006046 → spi2_sck_pb6
Bank: 1 Reg: 0x70003070 Val: 0x00006046 → spi2_cs0_pb7
Bank: 1 Reg: 0x70003074 Val: 0x00006045 → 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

sudo ./tester -D /dev/spidev0.0 -v -p “HelloWorld123456789abcdef”
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
TX | 48 65 6C 6C 6F 57 6F 72 6C 64 31 32 33 34 35 36 37 38 39 61 62 63 64 65 66 __ __ __ __ __ __ __ | HelloWorld123456789abcdef
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 __ __ __ __ __ __ __ | …

Are you using Jetson Nano devkit with SD or eMMC module?

It may remove every pins on your board w/o using as GPIO.

Could you help to provide the flash log to check which dtb is in use?

Using Devkit SD module. However, as i mentioned earlier I do not know where are flash logs. I just flash sd card with balena in windows. However I add this extlinux.conf if it helps anyway

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 [2023-08-14-165247]>
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=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0

Since you are using Jetson Nano devkit with SD card module, could you use SDKM to flash your board and you would get the flash log in SDKM through export the log.

Or using the flash.sh command to flash your board and you would get flash log on the terminal of your host PC.

$ cd <Linux_for_Tegra>
$ sudo ./flash.sh jetson-nano-devkit mmcblk0p1

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.