Hello,
I am trying to get the Jetson Nano (2GB) to communicate with the MSP430FR6989 chip using SPI with help from the Python spidev package. I’ve got the Nano configured for SPI1 with the help of jetson-io and I am able to send and receive.
However, the Nano receives garbage values from the MSP430 and the MSP430 also receives garbage values from the Nano. Does anyone have experience with the spidev Python package and could offer any insight as to what could be the issue?
The function in question:
def easy_spi_test():
failed = False
# SPI settings
bus = 0
device = 1
speed = 8000000
# Enables SPI Communication
spi = spidev.SpiDev()
# SPI Setup
try:
print("Attempting to open SPI port {0}, device {1}...".format(bus, device))
spi.open(bus, device)
print("Connection established")
print("Applying settings...")
spi.max_speed_hz = speed
spi.lsbfirst = False
spi.mode = 0b10
print("Settings applied successfully!")
except Exception as e:
print("Failed to apply settings")
print(e)
failed = True
if not failed:
print("Attempting transmission...")
while True:
# spi.writebytes2([0x62, 0x79, 0x74, 0x65])
spi.xfer2([0x62, 0x79, 0x74, 0x65])
print(spi.readbytes(10))
print("Transmission complete")
if spi:
spi.close()
Output of MSP430 to Nano:
msp-to-nano-output.txt (5.6 KB)
This output shows when the transmission occurs from the MSP to the Jetson.
Output of Nano to MSP430 is just a bunch of garbage characters.
On the Nano I’ve got the SPI connections at pin’s:
19 - SPI_1_MOSI
21 - SPI_1_MISO
23 - SPI_1_SCK
24 - SPI_1_CS1
I am using the spidev function: xfer2
spi.xfer2([0x62, 0x79, 0x74, 0x65)]
From my understanding, the spidev package sends and reads an array of bytes. However, I’m not sure why the Nano would read a 3 digit byte such as 255, 149, etc.
Any help would be appreciated.
Edit: This is on Jetpack 4.6, L4T 32.6.1