SPI doesn't work in NVIDIA Jetson Nano Development Kit B01

Hi,

I’m trying to enable SPI1 in my Jetson Nano Development Kit B01 (with SD Card) and I’m struggling a lot. First, I tried to:

  • enable SPI 1 and SPI 2 through jetson-io
  • enable the spidev through modprobe
  • run the spidev-test in a loopback (MOSI connected to MISO)

image

It fails. Then, I tried to modify my device-tree files, I’ve changed all the spi pins in pinmux from rsdv to spi. It seems to be correct:

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

The spidev-test in a loopback still fails. Then I’ve followed some instructions that I found at this post: Jetson Nano SPI Bus Not Working - #9 by jcl9309

And nothing of spidev-test in a loopback succeeding. If I do:

sudo dtc -I fs -O dts -o extracted_proc.dts /proc/device-tree

I get on my .dts:

gpio-input = <0x26 0x95 0x5 0xbc 0xbd 0xbe 0xc1 0xc2 0xa8 0xc8 0xca 0x4d 0x4e 0x4c 0x4f 0x32 0x33 0x3a 0x3d 0x3e 0x41 0xe4>;

Which seems to be correct, but:

sudo cat /sys/kernel/debug/tegra_gpio

gives me:

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 c0 00 00 000000
C: 0:2 1f 00 00 18 00 00 000000

Enabling such a basic serial interface should be easy. Don’t you think? Actually, it should be enabled by default. I’ve never faced problems with such a simple peripheral before. Am I doing something wrong? Could you please clarify what the problem is?

Hi brenda.jacomelli,

Are you using Jetson Nano or TX1(in current category of this topic)?
What’s your Jetpack version in use?

Have you referred to every steps in this thread for SPI loopback test?
It has been verified from us and many developers on Jetson Nano.

Could you check if the steps shared from the following thread help for your case?
SPI setup issues with Jetson Nano B01 DevKit - #129 by iflybri2

It seems there’s still gpio usage for your spi pins.

How did you update this?

Please share the /boot/dtb/kernel_XXXX.dtb from your board for further check.

Hi Brenda - I saw that Kevin referred you to my post. Hopefully the solution there is helpful to you and you are able to get things working more quickly than I was. It’s a very long thread, but I summarized the steps that ended up working for me in the “solution” post so you shouldn’t have to read through everything before that entry. I think the most important bit of advice I can give is that the ONLY thing that worked for me was editing the dtb files on a host PC and then using SDK manager to re-flash the Nano with a fresh installation of Jetpack using the edited files. Editing locally on the Jetson Nano seems to have no effect. Happy to answer questions on my post if any of the steps in my solution aren’t clear.

1 Like

Hi, @KevinFFF.

I’m using Jetson Nano, and I realized I selected the incorrect topic.

I’m using the latest Jetpack version. I updated the device tree following my usual procedure:

  • I built it with the modifications.
  • I changed the file kernel_tegra210-p3448-0000-p3449-0000-b00.dtb.

I’ve provided the disassembled device tree for your review: :
kernel_tegra210-p3448-0000-p3449-0000-b00.txt (318.8 KB)

Then, I applied an overlay for using the UART and a specific GPIO pin. I successfully applied all modifications to both the device tree and the overlay, as I tested all the pins before and after it.

Hi @iflybri2! Thank you for so much for your response.

I guess I’ll need to follow all the steps that are in your post. To be honest, I really wanted it to work locally, but it looks like that such a simple peripheral enabling needs so much unnecessary work. Hopefully, it seems that you found out how to manage it to work. If something goes wrong in your solution steps, I’ll comment on your post. Thank you again!

1 Like

To those who are facing these same problems with jetson nano SPI as me:

@iflybri2 observation is indeed correct. The spi changes on the device tree are only being correctly applied if you flash it. Changing only the device tree on sd card’s boot directory have no effect at all. Strangely, I have successfully enabled other peripherals like sdmmc, GPIOs, and UART through device tree editing on the SD card or using overlays. I’ve never faced such a weird bug with a simple serial interface like SPI in any other hardware platform, is quite unusual, and I would recommend that Nvidia review it as soon as possible.

However, I encountered numerous difficulties while attempting to follow the recommended solution steps, mainly because of limitations in the SDK Manager functionalities. To access a specific jetpack you need to use it in a specific version of Ubuntu, it’s terrible. I couldn’t manage to the docker solution work either. So, I figure another way out using Yocto Project and I want to share it with you:

1 - You’ll need to prepare your Yocto enviroment to use meta-tegra. This wiki details the steps:

2 - Then you generate a core-image-minimal for jetson-nano-devkit machine. If you have the opportunity use it, in my case I needed to maintain the image provided by NVIDIA.

3 - You’ll generate a compacted folder: core-image-minimal-jetson-nano-devkit-20231107175247.tegraflash.tar.gz. Extract it and change the dtb file inside it for the one that you generated with the enabling spi modifications. (in my case it was tegra210-p3448-0000-p3449-0000-b00.dtb)

4 - Finally, you can boot your jetson in recovery mode and then run the dofash script that is the tegraflash folder :
sudo ./doflash.sh --spi-only

In my case re-flash the Nano with a fresh installation of Jetpack wasn’t necessary. I just flashed a new image on my sd card. I would like to share my generated image for those who are not familiar with Yocto, but I can’t post it in here due to its size.

1 Like

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