SteveA
Posts: 32
Joined: Sat Mar 14, 2015 11:18 am
Location: South Yorkshire, England

Buster update to Linux 5.4.51 v71+ Mon Aug 10 2020 - stops SPI

Fri Aug 21, 2020 9:53 am

I use RPI4 running Buster with my project, which is programmed in C, and everything has been working fine, eg SPI and I2C interface boards sending/receiving data. I have regularly updated the OS using the standard:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get autoremove
sudo apt-get clean

Today, 21-8-20, I have done the update as above and it shows the version as:
Linux version 5.4.51-v7l+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1333 SMP Mon Aug 10 16:51:40 BST 2020

I rebooted as required and to my dismay the SPI has stopped working - when I init SPI (SPI0_0 and SPI0_1) it gives errors. Nothing in my program has been changed. It works on the previous Linux version 4.x (which is was until today's update was done).

I have checked using sudo raspi-config to ensure that SPI (and I2C) are enabled, which they are. (Also, when I log in via SSH I sometimes get 'Wi-Fi is currently blocked by rfkill.' even though the WLAN country is set to GB, but that is not the issue I mention here.)

ll has been OK for yearsuntil today's update.

When I look in the /dev/ folder I see that /dev/spidev0.0 and /dev/spidev0.1 files are missing, which is the cause of the problem, even though 'dtparam=spi=on' is in 'config.txt'.

Info: to enable me to use my own CE lines (I have 4 SPI units on the RPI and will add more) to stop the CE0 and CE1 from operating, in my config.txt I have

dtoverlay=spi0-cs,cs0_pin=26,cs1_pin=26

which sets both CE0 and CE1 to an unused GPIO pin 26. I can then toggle my own defines CE lines. This has worked OK for years.

When I remove that line and reboot, the missing spi files, /dev/spidev0.0 and /dev/spidev0.1 appear in /dev/ (but then I naturally get clashes with my CEs.

When I add back in that overlay line, on reboot the /dev/spidev0.0 and /dev/spidev0.1 disappear again.

The recent update has stopped this working. Does anyone know of a workaround?


Thanks

SteveA
Posts: 32
Joined: Sat Mar 14, 2015 11:18 am
Location: South Yorkshire, England

Re: Buster update to Linux 5.4.51 v71+ Mon Aug 10 2020 - stops SPI

Sat Aug 22, 2020 4:31 pm

Sorted:
The new OS update does not like defining the same (my spare unused) pin for both CE0 and CE1, whereas the previous Buster versions allowed it. I previously only used 1 pin so as not to take up GPIO, which could be used for other things. The cure is to define cs0 to a spare pin and cs1 to another spare pin.

Thanks to Paeryn for pointing this out to me.

Return to “Raspberry Pi OS”