Comments (8)
nice - yes id rather mess with the pins/spi index definition than the core blinka SPI code. lets keep that neat and organized :)
from adafruit_blinka.
Short-term workaround for spidev path:
Install bone
instead of ti
kernel:
sudo /opt/scripts/tools/update_kernel.sh --bone-kernel --lts-4_14
reboot
SPI0 is now /dev/spidev0.0
:
debian@beaglebone:~$ ls -ltar /dev/spidev*
crw-rw---- 1 root spi 153, 0 Apr 13 13:35 /dev/spidev0.0
crw-rw---- 1 root spi 153, 2 Apr 13 13:35 /dev/spidev1.1
crw-rw---- 1 root spi 153, 1 Apr 13 13:35 /dev/spidev1.0
from adafruit_blinka.
Long-term solution
@RobertCNelson added udev rules to add symlinks that will not change:
SPI0.0
will always be/dev/spi/0.0
SPI0.1
will always be/dev/spi/0.1
SPI1.0
will always be/dev/spi/1.0
SPI1.1
will always be/dev/spi/1.1
For reference the udev rule:
debian@beaglebone:/etc/udev/rules.d$ cat 10-of-symlink.rules
# vim: ft=udevrules
#From: https://github.com/mvduin/py-uio/blob/master/etc/udev/rules.d/10-of-symlink.rules
# allow declaring a symlink for a device in DT
ATTR{device/of_node/symlink}!="", \
ENV{OF_SYMLINK}="%s{device/of_node/symlink}"
ENV{OF_SYMLINK}!="", ENV{DEVNAME}!="", \
SYMLINK+="%E{OF_SYMLINK}", \
TAG+="systemd", ENV{SYSTEMD_ALIAS}+="/dev/%E{OF_SYMLINK}"
With symlink
properties added to the device tree, these symlinks are created by udev:
debian@beaglebone:~$ ls -la /dev/spi/
total 0
drwxr-xr-x 2 root root 100 Apr 13 13:35 .
drwxr-xr-x 16 root root 3180 Apr 13 13:35 ..
lrwxrwxrwx 1 root root 12 Apr 13 13:35 0.0 -> ../spidev0.0
lrwxrwxrwx 1 root root 12 Apr 13 13:35 1.0 -> ../spidev1.0
lrwxrwxrwx 1 root root 12 Apr 13 13:35 1.1 -> ../spidev1.1
from adafruit_blinka.
Issue with long-term solution
I'm uncertain of the correct approach to add logic in Adafruit_Blinka to use the /dev/spi/X.Y
for BeagleBone and PocketBeagle. Currently, Adafruit_Blinka generic_linux SPI implementation just uses py-spidev
Python module and I don't believe has a way to communicate the /dev/
path to use.
In theory, this logic could be added to py-spidev
but I am not sure if the maintainer would approve of this approach, and how long it would take to get merged.
from adafruit_blinka.
Possible solution: create SPI class for am335x chip
Currently in busio, detector.board.any_beaglebone
uses adafruit_blinka.microcontroller.generic_linux.spi
:
def configure(self, baudrate=100000, polarity=0, phase=0, bits=8):
if detector.board.any_raspberry_pi:
from adafruit_blinka.microcontroller.bcm283x.pin import Pin
from adafruit_blinka.microcontroller.generic_linux.spi import SPI as _SPI
elif detector.board.any_beaglebone:
from adafruit_blinka.microcontroller.am335x.pin import Pin
from adafruit_blinka.microcontroller.generic_linux.spi import SPI as _SPI
However, it is possible to create adafruit_blinka.microcontroller.am335x.spi
and then do this:
elif detector.board.any_beaglebone:
from adafruit_blinka.microcontroller.am335x.pin import Pin
from adafruit_blinka.microcontroller.am335x.spi import SPI as _SPI
I think that adafruit_blinka.microcontroller.am335x.spi
could just implement the logic to handled the SPI port index and not re-implement everything in adafruit_blinka.microcontroller.generic_linux.spi
. I need to experiment and see if that is possible.
from adafruit_blinka.
hiya the beaglbone maintainers need to fix onto one SPI naming, no other linux board changes the SPI port name - we'll go with whatever the latest is.
from adafruit_blinka.
@ladyada this situation pisses me off too, from 3.8.x to 4.4.x we dealt with uart/gpio/mmc renaming due to mainline changes. And now spi bit us in the butt with 4.14.x (but i reverted that change) to give us time to build a fix/workaround for 4.19.x. Since for me it's all personal time on this, if i have a choice between mainline and our hacks, i'll drop our patch like a rock (thank god the patchset is getting smaller). Now @jadonk, is proposing a workaround that would also a similar api naming for the incoming BeagleBone AI, such we can lock in something, while mainline will keep renaming things..
https://elinux.org/Beagleboard:BeagleBone_cape_interface_spec
Regards,
from adafruit_blinka.
@RobertCNelson thanks for the explanation.
@ladyada
thanks, your comment made me realize that I can adjust the indexes in spiPorts
inside microcontroller/am335x/pin.py
SPI0 is /dev/spidev1.x
and SPI1 is /dev/spidev2.x
on both:
- the current recommended BeagleBoard.org Debian image: Debian 9.5 (Stretch) from 2018-10-07
- the newest Debian 9.8 (Strecth) snapshot from 2019-04-07
I think spiPorts
should changed from:
# ordered as spiId, sckId, mosiId, misoId
spiPorts = (
(0, SPI0_SCLK, SPI0_D1, SPI0_D0),
(1, SPI1_SCLK, SPI1_D1, SPI1_D0),
)
to:
# ordered as spiId, sckId, mosiId, misoId
spiPorts = (
(1, SPI0_SCLK, SPI0_D1, SPI0_D0),
(2, SPI1_SCLK, SPI1_D1, SPI1_D0),
)
By the way, the new BeagleBone AI should hopefully launch this Summer. It uses a much more powerful TI Sitara AM5729 SoC but keeps the traditional P8/P9 BeagleBone headers. @jadonk has been working on BeagleBone cape interface spec so that we can have consistency between the new and old BeagleBones.
from adafruit_blinka.
Related Issues (20)
- Adafruit_CircuitPython_MCP2515 not working correctly
- Raspberry Pi 5 PWMOut needs updating to libgpiod HOT 1
- Requesting support for Geniatech xpi-3566-zero
- Is the Rock 4SE not supported? HOT 4
- UnexpectedMakers ProS3 HOT 3
- Issue with Adafruit-PlatformDetect on Windows
- SSD1306 is not working on a Raspberry Pi 5 HOT 7
- CE1 busy on Pi 5 HOT 1
- Banana Pi M2 Berry
- Adafruit-PlatformDetect version 3.60.0 was unable to identify the board HOT 13
- Please support RP2040-LCD-1.28 HOT 1
- adafruit HOT 2
- KB 2040 board HOT 2
- Open drain output on a Raspberry Pi requires value setting of an input pin HOT 2
- GPIO Access Support for linux (kernel > 4.7) HOT 7
- These are very inexpensive and I think would be good boards to support -- LuckyFox Pico Mini HOT 1
- Jetson Nano resulting in AttributeError: module 'adafruit_platformdetect.constants.chips' has no attribute 'JH71x0' HOT 30
- Use HW PWM for pins that support it
- Please support for orange pi win plus!!! HOT 1
- Support for Orange Pi Zero 2W HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adafruit_blinka.