SPI Local Loop on Jetson Nano B01 4GB

I planning to communicate between Jetson Nano & Arduino UNO with SPI.
I set SPI in GPIO using “Jetson-io” just like below.

Before connecting Arduino and Jetson Nano, I tried Local Loop test on Jetson Nano. (Connect pin 19 & pin 21)

import spidev
spi = spidev.SpiDev()
spi.open(0,0)
spi.xfer([0x01])

After running the Local Loop code, it repeats [0].
Is there any other things to setup? (device-tree or etc)

Jetson Nano Developer Kit B01 4GB RAM
Jetpack: 4.6.1
python: 3.6.9
spidev: 3.5

Hi jeyong8217,

Please refer to Jetson Nano SPI Bus Not Working - #10 by KevinFFF for the loopback test on Jetson Nano.

Thank you for your fast reply.

I also have some questions that where I can find dtb file on Jetson Nano?
Can you tell me the root for dtb?
And also is it necessary for backup original dtb file?

You can check /boot/extlinux/exlinux.conf for which kernel image and dtb in use.

Normally, it would be /boot/dtb/kernel_xxxx.dtb, Or /boot/xxxxx-custom.dtb if you’ve ever used Jetson-IO to configure some functions.

I followed the sequence that you showed me.

After finish the process, I tried local loop for cheking activation of SPI.


But the result showe that spi didnt activate.

Is there any solutions for that? Also what does it mean “2-2-2-5 Flash the board”?

P.S.
I double-checked the kernel_tegra210-p3448-0000-p3449-0000-b00.dtb file on /boot/dtb that gpio-input changed.

Below is my extlinux.conf of my jetson nano.
should I change “/boot/kernel_tegra210-p3448-0000-p3449-0000-b00-user-custom.dtb” rather than “/boot/dtb/kernel_tegra210-p3448-0000-p3449-0000-b00.dtb” ?

> 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 [2024-08-14-154032]>
	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

The step 2-2-2 should be done on the host.
Please flash the board from host to apply the change.

This is the current DTB in use since you’ve run Jetson-IO.

How can I do the “flash” on jetson nano?
Is there any method to flash?


This for;
sudo cat /sys/kernel/debug/tegra_pinctrl_reg | grep -i spi

And this is for ls /dev/spi*

But still no connection on SPI local loop…
I activate spi1 & spi2 on jetson-io using

  1. Configure for compatible hardware
  1. MCP251x CAN Controller

Please run the command like the following from host to flash the board.

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

Your pinmux registers look expected to be used for SPI.

Please do not use MCP251x driver since there’s no MCP251X module by default.
Maybe you should run sudo modprobe spidev to load the driver and short MISO/MOSI to verify SPI loopback test first.

Thanks for your reply.

I was trying to find linux_for_tegra folder in my jetson nano, but I can’t find it.
When I search on google, it need sdk manager to use linux_for_tegra folder.

In my question, is it necessary connecting pc & jetson nano with “l4tbr0” or opening ssh?

Also, really really important question…
Is it okay to use sdk manager without reset sd-card?
If sdk manager resets sd card, it would be heart-breaking to restart all the works that I did…

It is a directory which we call it the root directory for the BSP package.
You can download it from our release page or it would be installed in your host PC when you use SDK Manager to flash the devkit.

Reflash the board means that the data in your SD card will be erased no matter you use SDK manager or flash command.

Could you share the result of the following command on your board?

$ sudo cat /sys/kernel/debug/tegra_gpio

This is the result of

$ sudo cat /sys/kernel/debug/tegra_gpio

I untar the BSP package on jetson nano and I run the ./flash on your reply.

Is this error saying that I should flash on host pc connecting with jetson nano with L4Tbr0?

Another question, where can I find dtsi file on jetson nano?
Jetson Nano SPI BUS Not Working - #10 by KevinFFF

Okay, it seems you have to remove the GPIO usage for SPI pins.

Have you entered into force recovery state before running the command to flash the board?
You can short REC/GND and power up the board to enter force recovery state.

You can either decompile the dtb to dts or download the kernel source to build kernel image/dtb manually.

Thank you for your reply.

Now, I’m trying to install sdkmanager on my virtual machine
(I recently knew that WSL doesn’t provide sdkmanager…)

I boot jetson nano on recovery mode as you can see

I have a question that can I get Linux_for_Tegra file after install jetpack 4.6.5 using SDK manager? Cause when I manually install BSP package, I got Linux_for_Tegra file but flash got failed…


I flahsed and updated jetson nano but still same as above I mentioned…

Is there any method to remove GPIO usage?
I decompile dtb file and modify “gpio-input” as you mentioned on other post.

Really need help…

I installed BSP source on Jetson nano and I modified tegra210-porg-gpio-3448-0000.b00.dtsi.

After I modifed the file, I started to build the kernel with ./nvbuild.sh
But I got the error below.

Missing kernel image /dir/to/kernel_out

What is this error happen?
After got this error, I found that kernel_out file is empty…

I saw you open another topic for the similar issue. ( Cannot open SPI on Jetson Nano - Jetson & Embedded Systems / Jetson Nano - NVIDIA Developer Forums)
Let’s just discuss there.

1 Like

Okay, see you on the other post

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