rpi-firmware
rpi-firmware copied to clipboard
SPI stopped working on Rpi B1 from 4.9.43+ onwards
Hello, SPI stopped working for me in the latest Raspbian stretch update. So I went back through the kernel versions here bisecting until I found the latest working version. Latest working version for me is 4.9.41+, it does not work in 4.9.43+ anymore. Is there a benign explanation? Did I miss a required configuration change? Best regards, Max
File this in https://github.com/raspberrypi/linux/issues and I'll be happy to help.
Giving the timing I think you have been negatively affected by this commit: https://github.com/raspberrypi/linux/commit/3b1e49ba1a8e5853c75914eee12000aa18ada46d
Unfortunately the SPI subsystem doesn't allow a default value to be specified - the maximum is used instead - so increasing the maximum has also increased the default.
Which SPI library are you using? Whichever it is, it is failing to choose a sensible bus speed.
I followed the instructions here years ago https://www.raspberrypi-spy.co.uk/2014/08/enabling-the-spi-interface-on-the-raspberry-pi/ and also remember using this one https://github.com/lthiery/SPI-Py.git but I am not actually sure. Which SPI library is recommended or up to date?
Some application must be failing, otherwise you wouldn't know that SPI is broken. Which application is it?
pip install spidev -U updated to latest version 3.2 Still not working.
It is a simple python script reading from mcp3008 A/D chip
import spidev
import time
import os
# Open SPI bus
spi = spidev.SpiDev()
spi.open(0,0)
# Function to read SPI data from MCP3008 chip
# Channel must be an integer 0-7
def ReadChannel(channel):
adc = spi.xfer2([1,(8+channel)<<4,0])
data = ((adc[1]&3) << 8) + adc[2]
return data
....
Add:
spi.max_speed_hz = 500000
after spi.open to restore the old default/maximum speed.
That fixed it. Thank you!
This issue has been resolved and the GitHug user account has been deleted, therefore it says @ghost. Please close this issue.