How to connect SPI on Jetson Nano B01 Dev Kit, version from January 2023

Hi team,
I use Jetpack version 4.6-b199.
image
Jetson Nano B01 Dev Kit (I use the hardware Dev Kit version from January 2023).

My setup on Jetson Nano B01:
From the instructions, first fix the init functions:
$ sudo find /opt/nvidia/jetson-io/ -mindepth 1 -maxdepth 1 -type d -exec touch {}/init.py ;

Run jetson-io.py and Enable SPI1.
$ sudo /opt/nvidia/jetson-io/jetson-io.py
image
Check configured the spi pinmux:
$ sudo cat /sys/kernel/debug/tegra_pinctrl_reg | grep -i spi
image
$ sudo cat /sys/kernel/debug/tegra_gpio
image
$ ls /dev/spidev*
image


Install libraries and software:

$ sudo apt-get update
$ sudo apt-get -y install python3-pip
$ pip3 –version
$ sudo pip3 install Jetson.GPIO
$ sudo apt-get install python-dev
$ sudo apt-get install python3-dev
$ sudo apt-get update
$ sudo apt-get install git
$ git clone GitHub - doceme/py-spidev
$ cd py-spidev
$ sudo apt-get install -y python-setuptools
$ sudo apt-get install -y python3-setuptools
$ sudo python setup.py install
$ sudo python3 setup.py install
$ sudo modprobe spidev


Previously when I used this setup with older versions of Jetson Nano B01 Dev Kit, SPI worked fine, but when I set up and tested with versions from January 2023, SPI didn’t work.
Can you guide me how to fix it?
Thank you so much!

My python code for test SPI:
#!/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.max_speed_hz = 500000

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()

Hi phamxuanvi93,

Please help to share the result of the following command for Jetpack version in use

$cat /etc/nv_tegra_release

Your result seems unexpected. Do you save the pinmux configuration in Jetson-IO and reboot the board to apply?

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

Hi @KevinFFF ,

I apologize for not describing the images the check result of this command was taken after rebooting the Jetson Nano B01.

  • I will read more about the SPI loopback test and give you more feedback.
    Looking forward to hearing from you soon!

Hi @KevinFFF ,
Can you guide me in more detail for step 2?
Thank you so much!

Hi @KevinFFF ,
The result of SPI loopback test.

Congrat.! It seems your SPI loopback test works.

Thank you for your support!

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