intro
i want to use multiple SPI busses at the same time.
but when i use to use SPI 4 and SPI 5 at the same time it crashes the whole system
it doesn't crash instantly sometimes it takes 10 seconds sometimes 10 minutes
it works fine if i use any other combination with spi 0,1,4,5
and it only crashes when 4 and 5 are used at the same time
the code
#! /usr/bin/env python3
import random
import spidev
spi = spidev.SpiDev()
spi.open(5, 0)
spi.max_speed_hz = 1500000
spi.mode = 0
data = [0]*120
while True:
spi.writebytes(data)
spi.close()
when looking for the source of the bug i reduced the code to its minimum
to produce the error i run it in 2 separate terminals
in one terminal i use spi.open(5, 0)
and the other spi.open(4, 0)
the rest of the code is the same
the error
https://pastebin.com/We8C0t0N
the raspberry pi is working headless, i run the code and receive the error through ssh
i think ssh crashes before the whole error is transmitted so sometimes the error is shorter, i put the longest version on pastebin
when i connect a monitor to the pi it shows the same message but its scrolling past very fast and i cant scroll back
i have tried
- using a different raspberry pi 4
- replacing the spidev with busio and similar code
- enabling spi using the command line
dtoverlay spi5-1cs
or by addingdtoverlay=spi5-1cs
to/boot/config.txt
- using these functions to transfer the data
spi.writebytes
spi.writebytes2
spi.xfer
spi.xfer2
spi.xfer3
- changing the data
data = [0]*120
ordata = random.choices(range(0,255), k=120)
- sending 10, 120 or 4096 bytes
- setting the CPU governor to performance
- setting max_speed_hz to 1500000 or not setting it at all