-
Notifications
You must be signed in to change notification settings - Fork 220
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
SPI not working in BeagleBone Black #344
Comments
The version.sh is
|
Thanks for reporting, I will try to reproduce and investigate |
Hi everyone. Any update on this issue? I am facing the same problem: SPI is not working in BeagleBone Black. I have followed this to properly setup the SPI pins, but using print(spi.xfer2([32, 11, 110, 22, 220])) gives me values [255,255,255,255,255] Thank you very much, The version.sh is: |
The version.sh is git:/opt/scripts/:[b39ec679648a6be8f25f48bd1c9784c1fc5a0c46] |
No updates what so ever... I dropped working on it as there is so many differences in the documentation. |
Ok, Thanks. Could you recommend another library? Did you find a similar one, for Python or C++? Thanks in advance, Regards. |
i'm afraid cant. like i said i dropped working on it because of the lack of support and documentation |
Hi caxefaizan, I just wanted to tell you that although print(spi.xfer2([32, 11, 110, 22, 220])) gives me values [255,255,255,255,255], the SPI interface is apparently working well. I tried sending data using spi.writebytes([0x61]) and analyzing the outgoing signals (CLK, CS, D0, and D1) in the oscilloscope to see what I got. I have attached a picture with the transmission in action on the oscilloscope (blue-> chip select signal, green -> clock signal, pink-> data sent (0x61), yellow -> received data, Best regards, Dayrene |
I'm testing with the Buster IoT Image 2021-01-11 image:
Run #!/bin/bash
echo set SPI0 pins
config-pin p9.17 spi_cs
config-pin p9.21 spi
config-pin p9.18 spi
config-pin p9.22 spi_sclk
echo set SPI1 pins
config-pin p9.20 spi_cs
config-pin p9.28 spi_cs
config-pin p9.19 spi_cs
config-pin p9.42 spi_cs
config-pin p9.29 spi
config-pin p9.30 spi
config-pin p9.31 spi_sclk
Here are the spidev device files that exist:
I run debian@beaglebone:~$ cat test_spi.py
from Adafruit_BBIO.SPI import SPI
#spi = SPI(bus, device) #/dev/spidev<bus>.<device>
# /dev/spidev0.0
spi = SPI(0,0)
print(spi.xfer2([32, 11, 110, 22, 220]))
spi.close()
# /dev/spidev0.1
spi = SPI(0,1)
print(spi.xfer2([32, 11, 110, 22, 220]))
spi.close()
# /dev/spidev1.0
spi = SPI(1,0)
print(spi.xfer2([32, 11, 110, 22, 220]))
spi.close()
# /dev/spidev1.1
spi = SPI(1,1)
print(spi.xfer2([32, 11, 110, 22, 220]))
spi.close() The output:
so this does seem to indicate a problem as this is supposed to be a loopback test. I'll investigate further. |
It seems the issue may not be with Adafruit_BBIO. Here is a loopback test with the generic python spidev module which incorrectly reads
I get the same seemingly incorrect results for the spidev test from Derek Molloy's book:
@jadonk @RobertCNelson have you noticed any spi problems on newer images? For reference:
|
I've talked to @RobertCNelson and it looks like there might have been a regression in SPI since the last official image release (AM3358 Debian 10.3 2020-04-06 4GB SD IoT). It's possible the issue could have occurred between 4.14 and 4.19 kernel. |
Update: I've been advised by @RobertCNelson to try earlier 4.19 kernel builds going back to the April 2020 build. They are all in our debian repo so it is matter of apt-get and then rebooting and retesting. I'll update when I am able to complete that progress. An alternative solution is to move ahead to the 5.8 kernel build in the beagle repo via apt-get. It has been confirmed by @MarkAYoder that SPI is working ok with that kernel. |
Hi. i am using BBB to get values in SPI mode but am not able to find a proper documentation to make it work. I have connected the pins for SPI0 with the Ic from which i want to get the values.
so my code includes
from Adafruit_BBIO.SPI import SPI
then i initialize the spi as
spi = SPI(1,0)
followed by
spi.open(1,0)
spi.writebytes([address])
since it was not working i tried the tutorial on github.
but using
print(spi.xfer2([32, 11, 110, 22, 220]))
gives me values[0,0,0,0,0]
also doesnt seem to work.i used
config-pin
to setup SPI pins and also tried editing theuEnv.txt to
includespidev1.0
The text was updated successfully, but these errors were encountered: