Error about spi

Hi nvidia developers

i use the tools/spidev_test.c make spidev_test, But it report error

root@dev-desktop:~/lab# ./spidev_test -D /dev/spidev0.0
can't open device: Cannot allocate memory
Aborted (core dumped)

I dont know why it occurs this error

Please give some advice or answers
Thank you

Could you try the binary from below link.

Hi i use your exe. And the same situation

root@dev:~/lab# ./spidev_test -D/dev/spidev0.0 -s18000000 -n100 -g30 -p4
can't open device: Cannot allocate memory
Aborted (core dumped)

What’s your version.
cat /etc/nv_tegra_release

R32 (release), REVISION: 5.1, GCID: 26202423, BOARD: t186ref, EABI: aarch64, DATE: Fri Feb 19 16:50:29 UTC 2021

Should i update the jetson version to the latest version?

That’s weird I run on this version without any problem.
Do you try on original system image?

yes,i change the version to the original system image.
use the command - ./flash.sh jetson-xavier mmcblk0p1
update the board,but still have this problem.
now 2 board has this problem

Looks like your SPI didn’t enable. Have a check confirm by “ls /dev/spidev0.0”
Also you can enable the SPI function by jetson-io

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/hw_setup_jetson_io.html

root@dev-desktop:~/lab/spi# ls /dev/spidev0.*
/dev/spidev0.0  /dev/spidev0.1
root@dev-desktop:~/lab/spi# ./spidev_test -D/dev/spidev0.0 -s18000000 -n100 -g8,3968 -u2000,8000
can't open device: Cannot allocate memory
Aborted (core dumped)

Have enabled the SPI function by jetson-io

I got this message when -D to device node didn’t exit.

nvidia@nvidia-desktop:~$ ll /dev/spidev0.*
crw-rw---- 1 root gpio 153, 0  六   8 10:50 /dev/spidev0.0
crw-rw---- 1 root gpio 153, 1  六   8 10:50 /dev/spidev0.1
nvidia@nvidia-desktop:~$ ./spidev_test_ -D /dev/spidev3.0 -s18000000 -n100 -g30 -p4
can't open device: No such file or directory
Aborted (core dumped)
nvidia@nvidia-desktop:~$ ./spidev_test_ -D /dev/spidev0.0 -s18000000 -n100 -g30 -p4
/dev/spidev0.0: TEST FAILED !!!!! (status:-1)

this is different

root@dev-desktop:~/lab# ./spidev_test -D /dev/spidev0.0 -s18000000 -n100 -g30 -p4
can't open device: Cannot allocate memory
Aborted (core dumped)
root@dev-desktop:~/lab# ./spidev_test -D /dev/spidev3.0 -s18000000 -n100 -g30 -p4
can't open device: No such file or directory
Aborted (core dumped)

if the problem reason is about the cfg.
…/Linux_for_tegra/bootloader/t186ref/BCT/tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg

i change the spi cfg

pinmux.0x0243d040 = 0x00000400; # spi1_sck_pz3: rsvd1, pull-down, tristate-enable, input-enable, lpdr-disable	#zp changed
pinmux.0x0243d020 = 0x00000450; # spi1_miso_pz4: rsvd1, pull-down, tristate-enable, input-enable, lpdr-disable
pinmux.0x0243d058 = 0x00000400; # spi1_mosi_pz5: rsvd1, pull-down, tristate-enable, input-enable, lpdr-disable
pinmux.0x0243d010 = 0x00000400; # spi1_cs0_pz6: rsvd1, pull-up, tristate-enable, input-enable, lpdr-disable
pinmux.0x0243d050 = 0x00000400; # spi1_cs1_pz7: rsvd1, pull-up, tristate-enable, input-enable, lpdr-disable

i git checkout the old version ,it is ok, I will checkout the reason of this problem later.
maybe because i change the dtsi about the usb.

Hi shaneccc @ShaneCCC
I use the old version, it is ok now,and i think the reason of the problem may be related to my fault operation - deleted the dtb($L4T_DIR/kernel/dtb/) except tegra194-p2822*.dtb.

Thank you so much for your help
Best regards!
zhou