-
Notifications
You must be signed in to change notification settings - Fork 345
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
Feature-request: Support PocketBeagle #100
Comments
Beaglebone black and pocket would be a great addition! |
thanks for the fast feedback! |
sweet! @makermelissa may also be interested |
Yup, I’m interested. |
update → PlatformDetect already supports PocketBeagle:
( i have added the Is this a Beagle? question in my copy of the detect.py just for testing..) only problem currently is for reading the board id you need root privileges. i will have a look at adding a board tomorrow. |
Awesome. You’re making great progress. I’ll get my pocket Beagle setup tonight so I can help test if you finish soon. |
had to try it today ;-) example:
but for the PocketBeagle i would need
how to do this? (i did not find a similar case in one of the other board mappings..) i did not check the underlying / internal signal names yet - looking forward for your thoughts & input ;-) |
yeah, we should have the PX_XX names in the chip, then the board defines the 'pretty names' - do you want to try that? we'll hvae to 'fix' BBB (but nobody is using it yet) |
i will try. |
one is fine - whatever you like! |
additions are done. |
@s-light thanks for adding PocketBeagle to Blinka! Now that Adafruit is distributing the PocketBeagle I'm sure there will be people interested in leveraging Blinka to utilize CircuitPython libraries. I think these changes make sense including moving the SPI and I2C pins to the board files. I'll test out the BeagleBone Black and PocketBeagle with PR #101 |
i have added PR #102
and also tested I2C with APDS9960 and the lib and the basic tests all went fine :-) i have not tested SPI or UART. *1: i don't fully understand how the libraries work here -
|
i have pushed some more updates - the simple
result:
|
today i tried and tested spi with an actual hardware:
i had first to fix the pin-mode. and also checked this:
i also tried with sudo - but this did not change anything (i installed the libraries as both - sudo and non sudo) so it seems there is something other wrong with this currently... |
regarding the pin names i just found #62 and specially tannewts comment #62 (comment) |
I have installed the branch for #102 on my PB and run the examples/pb_digitalio.py OKAY. There does not seem to be any regressions so I will merge this to avoid having a large changeset in the future. I think there is still more testing to do for BeagleBone and PocketBeagle including adding more example scripts (or maybe even use pytest like in Adafruit_BBIO) to make it easier to spot regressions. I think that we may need to refactor how I2C and SPI are handled given the different header schemes. I'll post a followup comment with more thoughts about that. |
@s-light Thanks for creating the PocketBeagle tests repo! They look very useful and I think are good candidates to include in the Adafruit_Blinka examples directory. Maybe they could even be improved to test both PocketBeagle and BeagleBone. Regarding For example, running blinka_test.py with strace:
|
@s-light don't have an OLED with me, but I was able to get the same error and run strace:
From strace, I see that the error is that
Here are the spidev files that do exist:
For camparison, Adafruit_BBIO opens
from strace:
I need to investigate the spidev numbering. It might be related to adafruit/adafruit-beaglebone-io-python#216 I am also looking at |
@s-light so this comment from @RobertCNelson reminded me that there is an issue with spidev indexes changing between kernels: More context in this Adafruit_BBIO issue: |
@s-light I chatted with @RobertCNelson in our BeagleBoard.org slack (let me know if you want an invite: drew@beagleboard.org) and there has been issue of spidev indexes changing depending on the kernel version. Robert advised me that /dev/spidevX.Y is not a stable interface. We have devised a new scheme to have stable consistent spidev naming in future kernel builds. Something similar was done for PWM: https://github.com/rcn-ee/repos/blob/master/bb-customizations/suite/buster/debian/81-pwm-noroot.rules#L15-L39 the result will be something like:
where corresponding to SPI0 and SPI1. These will be symlinks to the correct spidev device node files. I will follow up with more information as this solution proceeds. |
@s-light for a short term fix, moving to kernel 4.19 will provide the expected spidev indexes. You could install 4.19 and then Blinka should be ok:
reboot and check:
The oled_display.py program then is able to open the device:
however I do encounter this error:
I am not sure if that is because I don't have the hardware or if it a seperate issue. Though invalid argument does make me think there might be some API mismatch. I should try some tests with SPI hardware that I have with me. |
So far i've pushed out 7 builds for this:
These kernels utilze the symlink..
I'll work more tomorrow on v4.19.x and all the bone variants.. Regards, |
@RobertCNelson thanks for doing that so fast! For reference, here is a commit to add the /dev/spi/X.Y properties to device tree: And udev script that create the corresponding symlinks: |
FYI - I ran:
after reboot, I have the new /dev/spi/X.Y symlinks:
|
I2C testing notes
|
@s-light it appears that there is a regression in Adafruit_Blink SPI support for the BeagleBone Black. It also prevents SPI from working on the PocketBeagle. The oled_display.py script for the SSD1306 OLED in SPI mode results in Adafruit_Blink tries to set the SPI bus mode to have no CS. However, the Linux SPI driver used on the PocketBeagle and BeagleBone does not support this mode. For comparison, I am able to get the older https://github.com/adafruit/Adafruit_Python_SSD1306/ to work OK. That library uses Adafruit_GPIO.SPI which uses does not try to set no CS mode. I am going to open a new issue with much more information. |
@s-light after merging PR #105 for issue #104, I tested OK with BME280 connected to SPI0 on PocketBeagle. Could you try testing SPI again? Details from the BME280 test:Make sure pins are configured for SPI0 plus P1.6 as GPIO for CS:
import board
import busio
import adafruit_bme280
import digitalio
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
bme_cs = digitalio.DigitalInOut(board.P1_6)
bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, bme_cs)
print("\nTemperature: %0.1f C" % bme280.temperature)
system version info:
|
Successful test of SSD1306 OLED via SPI on PocketBeagle
system version info:
|
However, the above examples were running
|
fyi - I have opened #106 for cover the inconsistent spidev path issue that I mention above. |
PR #107 has resolved issue #106 by changing
@s-light when you have time, it would be good to know if SPI now works OK on your PocketBeagle. thanks! |
thanks for your patience with this ;-)
but basically it seems to work :-) |
more tests on I2C:
i also added a combined example with I2C and SPI: so i think that this is solved! |
Thank you for testing this so thoroughly. :) |
i would like to test a project written in / for CircuitPython on my (new) PocketBeagle :-)
the Beagle Board Black is already in the system. but the PocketBeagle is not there yet.
Are there any official roadmaps what boards are consider to be added by Adafruit?
or is the concept more 'the community adds what they need' ? (iam totally fine with this concept ;-))
and if the second way is the way to go -
is there any documentation how to do this?
what is needed to add a new Board?
i think
this 'should be' an easy thing?
only add some good pin-mappings?!
if this is the case iam happy to try to add it ;-)
The text was updated successfully, but these errors were encountered: