How can I enable SPI communication on Jetson Nano Module?

Hi team,
I use SDK Manager flash OS with Jetpack 4.5 for Jetson Nano Module, but when I use command : sudo /opt/nvidia/jetson-io/jetson-io.py , I don’t see : Jetson Expansion Headter Tool for setup SPI.
I don’t know How to setup SPI for Jetson Nano Module. Can you guide me how to do it?
Thank you so much!

Have reference to below topic to modify the device tree for it.

hi @ShaneCCC ,
I have followed the instructions in the following picture, but the SPI on Jetson Nano Module still doesn’t work. Can you guide me step by step for modify the device tree for Jetson Nano Module with Jetpack 4.5 or 4.6?

Thank you so much!

Try this device tree for r32.6

nano-spi.dtb (233.6 KB)

Hi @ShaneCCC ,

I have setup with below step : (on Jetson Nano Module with Jetpack Version: 4.6.2-b5)
Step 1:
$ sudo apt-get update
$ sudo apt-get -y install python3-pip
$ sudo pip3 install Jetson.GPIO

Step 2: run command copy nano-spi.dtb (the file you sent) to boot folder on Jetson Nano Module:
$ sudo cp nano-spi.dtb /boot/

Step 3:
$ sudo apt-get install nano
$ sudo nano /boot/extlinux/extlinux.conf
And a paste below line to extlinux.conf file :

LABEL JetsonIO
MENU LABEL Custom Header Config: <HDR40 User Custom [2022-09-29-210441]>
LINUX /boot/Image
FDT /boot/nano-spi.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

Step 4 : install py-spidev library
$ sudo apt-get install python-dev
$ sudo apt-get install python3-dev
$ git clone GitHub - doceme/py-spidev
$ cd py-spidev
$ sudo apt-get install -y python-setuptools
$ sudo python setup.py install
$ sudo python3 setup.py install
$ sudo modprobe spidev # Load the spidev driver by below command first

The result, Jetson Nano Module still can’t comumication via SPI.

Can you help me check if i am doing wrong or missing any step?
How do I install the nano-spi.dtb file you sent?

Thank you so much!

My python code SPI test:
#!/usr/bin/python3

import spidev
import time
import binascii

spi = spidev.SpiDev() # Tạo đối tượng cho SPI
spi.open(0, 0) # mở port 0, device (CS) 0
#spi.open(1, 0) # mở port 0, device (CS) 0
spi.max_speed_hz = 500000
#spi.max_speed_hz = 11000000

try:
while True:
print(“abc”)
resp = spi.xfer2([0x61,0x62,0x63,0xA]) # [‘a’,‘b’,‘c’,‘\n’]
time.sleep(1) # sleep for 1 seconds
except KeyboardInterrupt:
spi.close()

Yes, modify the extlinux.cof to apply the dtb.

Check the pins status by below command.

sudo cat /sys/kernel/debug/tegra_pinctrl_reg | grep -i spi
sudo cat /sys/kernel/debug/tegra_gpio

Hi @ShaneCCC ,
the result first command line test:

The second command line test:

You need to modify the DEFAULT to JetsonIo extlinux.conf instead of primary to apply the nano-spi.dtb

Hi @ShaneCCC ,
Can you guide me How to “modify the DEFAULT to JetsonIo extlinux.conf instead of primary to apply the nano-spi.dtb”?
Thank you so much!

Hi @ShaneCCC ,
Thank you for your support.
I test SPI communication on Jetson Nano Module, it work DONE!

Can you give me the source of “nano-spi.dts” file?
Thank you so much!

Here you are.

nano-spi.dts (326.6 KB)

Hi @ShaneCCC ,
Thank you so much!

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