-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad default value for SPI clock speed (max_speed_hz) messing up signalling #84
Comments
FWIW, according to the Raspberry Pi Foundation's documentation, RasPi devices can handle up to 125 MHz. Do you have a way to verify that the problem is the hardware and not something about your testing setup (e.g. oscilloscope)? |
I faced this same issue. I was interfacing Raspberry Pi with a 5V device using a bidirectional level converter (TXB0108), and was having issues with talking SPI to the 5V device. The hardware setup works with version 3.0 of the py-spidev library, but wouldn't work with version 3.3. Version 3.0 has a default speed of 500kHz. I also found out that the level converter has a max speed of 100MHz at the configuration I had. |
The library doesn't contain a default value for Lines 1317 to 1321 in f543ca1
I would venture that the solution for this problem is to always specify a I don't buy that 3.0 has a default speed whereas 3.3 does not- neither the code for reading or writing the max speed value has changed in 8 years: acde79b |
Thank you for your reply. Good to know that Regarding the version of the library, I should have mentioned that v3.0 was on Raspbian jessie and this problem I encountered was on Raspbian buster with v3.3. |
The default value for the clock speed causes some severe issues with the signalling on my system. I could verify this on the logic analyser and fix it by setting the speed to a sensible value.
Version info for my raspberry pi zero W:
Test script:
When I try this without setting the speed explicitly, I get the following result
and as output
Trying 125MHz is a very odd default value for the de facto standard library for a raspberry pi, who has to struggle for anything more than 500kHz.
If I set it explicitly set spi.max_speed_hz to 500kHz by uncommenting line 6-7, I get a correct clock and data on the logic analyser
The default should be changed to an 'always works' value such as 100kHz or similar, otherwise the 'Usage' example from the readme doesn't work and that's needlessly frustrating to newbies.
The text was updated successfully, but these errors were encountered: