Can't read spi messages on Jetson Agx Orin

Hello,

I am trying to send messages from Arduino mega to my Jetson Agx 64gb Development kit via SPI.

Whatever I send, I am getting same message:
Received Data: [255, 255, 255, 255, 255, 255, 255, 255]

I have used /opt/nvidia/jetson-io/jetson-io.py to configure the pins. After running sudo modprobe spidev the pins were configured.

Output of ls /dev/spi* is

/dev/spidev0.0 /dev/spidev0.1 /dev/spidev1.0 /dev/spidev1.1

Python code which I use:

import spidev
import time

spi = spidev.SpiDev()
spi.open(0,0) #I tried both (1,0) and (0,0)
spi.max_speed_hz = 200000 # Set maximum SPI speed
spi.mode = 0 # Set SPI mode (0 or 3)
while True:
x = [1,7,0,2,1,69,5,6]
received_data = spi.readbytes(8)
print(“Received Data:”, received_data)
time.sleep(0.2)

Hi antoninaignjatovic98,

What’s your Jetpack version in use?

Which SPI interface would you like to use?

Have you verified the SPI loopback test on your Jetson board before communicating with Arduino?

Hello,
Jetpack version is 5.1.1.
40pin header (19,21,23,24)
SPI 1
We are successfully sending SPI messages but not receiving them.

Do you mean you could not receive the data you sent in loopback test (short MOSI and MISO)?

I have managed to send SPI messages from Jetson Agx Orin to Arduino and that’s working.

I have problem when I send SPI messages from Arduino to Orin. Whatever I send, I am getting same message:

Received Data: [255, 255, 255, 255, 255, 255, 255, 255]

$ gcc -o spidev_test spidev_test.c
$ sudo ./spidev_test -D /dev/spidev0.0 -s 10000000 -v
spi mode: 0x0
bits per word: 8
max speed: 10000000 Hz (10000 KHz)
TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | …@…�…�.
RX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D | …@…�…�.

To be honest, this two RX and TX are the same, but it does not look good for me, any solution for this?

could you shared spidev_test.c ?

spidev_test.c (8.3 KB)
here you are

1 Like

Hi,

Any update how to read SPI messages from Arduino on my Jetson Agx Orin 64gb Dev Kit?

master_mega.ino (504 Bytes)
Hi,
I am uploading script which I use to send messages from Arduino to Jetson. Does anyone know why I don’t receive SPI messages on Jetson?

There is no update from you for a period, assuming this is not an issue any more.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

Do you short MISO and MOSI together?

Could you share the block diagram of your connection?