-
Notifications
You must be signed in to change notification settings - Fork 100
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
Raspberry Pi5 #127
Comments
Thanks for the offer! I've added all the basics, but there is only so much I can do without a physical device, or access to technical documentation. I'm not that worried about SPI, I2C, UART and PWM support as these are handled by linux devices. GPIO however, reads/writes to the registers directly through The error you received likely means one of the relevant devices in the Since you mentioned you're relatively new to Rust, I suggest running the examples one by one to figure out which ones work, and which ones return an error, so we can narrow down what's causing the problem. For instance, to test the GPIO status example, run |
i'm not sure if /dev/gpiomem exists anymore as the new bookworm update to pios (public release due mid-october) has fully moved to libgpio. update: just checked and yes no /dev/gpiomem BUT there is a /dev/rp1-gpiomem which i'm guessing is what we (ok you :) ) need update1: |
Hmm, I wonder if running bookworm on a Pi 4 or older will still get you a I think at this point the options are to wait for documentation and access to a Pi 5 at release, or consider libgpiod, assuming performance doesn't lag too far behind directly accessing the registers. |
Did you update your local rppal clone with the latest commit? Just curious if the file not found error was caused by the lack of |
just did a git pull and get the same |
Thanks for all the testing so far. I think it's time to dive into raspberrypi/linux#5618 and see what exactly has changed. Hopefully that'll give me a better picture of what I can do at this point. My best guess is that I'm trying to look for the wrong driver name, but speculation will only get me so far 😁. I'll give that PR a read and will ping you when there's more to test. I appreciate the help! |
@ukscone would you mind giving https://github.com/golemparts/gpiochip a run on your Pi 5 and paste the results? It should give you a list of all available gpiochip driver names and the number of lines, similar to this
We should be seeing |
sorry for the delay. I overslept
|
sorry that's a mess recopying ukscone@glooston: $ git clone https://github.com/golemparts/gpiochip.git |
the above matches exactly what we get from libgpio's gpiodetect ukscone@glooston:/gpiochip $ gpiodetect |
Awesome. I'll have it grab The next hurdle is |
Things seem to have improved a lot with the v2 API. Let's see if moving away from directly accessing |
that's great. hopefully you'll be able to get everything Pi5 compatible by the time people start getting them in their paws. *the python/pip/venv stuff on bookworm makes it a bit harder to quickly knock up a script |
Great to hear rppal has been useful to you! I've only dabbled in python - my background lies in C++. When I started this project ~7 years ago (it actually started out as part of the blinkt crate) I was still relatively new to Rust, and I'm still as excited about the language as when I first heard about it. I think we'll be okay with Pi5 support for the launch date with your help. I've reached out to Raspberry Pi to see if they have any leftover review units available (and for future device releases as well), but I haven't heard back from them yet. So for now we'll have to rely on your testing, which has been invaluable so far. |
did a git pull just now just for the hell of it and tried gpio_status and that's looking much better :) ukscone@glooston: |
Solved the file not found error at least 😁 . I wouldn't trust the GPIO data at the moment though, since the |
After checking out the As far as I can tell, When a Additionally, it looks like It basically boils down to Assuming there are no easy fixes for the above, that leaves me with a few options.
If I had a Pi 5 here I'd probably grab the Open to any other suggestions if you have some. |
Just mulling over a 4th option, since I might be able to determine a GPIO line isn't configured as a GPIO anymore based on the name instead. For instance, GPIO 9, 10, 11 are set to Alt0 for SPI. I could add some restrictions to what a |
Looks like the names are hardcoded. After disabling SPI and rebooting, the names remain the same even though they're not configured for SPI anymore. |
I'm not sure if it's any use but gpiozero v2 is compatible with the Pi5 so it might be worth looking in there to see if there is any info that'll give clues. |
Thanks for the link. While I'm not experienced with python, I gave it a quick look. It seems to be using |
Hm... Option 5, switch to |
Btw, I've updated https://github.com/golemparts/gpiochip with the code I've been testing. If you look at https://github.com/golemparts/gpiochip/blob/main/src/main.rs, you'll see a commented out section that'll retrieve the GPIO pin levels. Uncommenting it causes any alt-configured pins to be changed to inputs. |
oh btw not sure if you realized that once pios (bookworm) is released libgpio and thus gpiochip (&gpiomem probably) will be the way for the gpio on the pi (all models) any other methods will go away. i think you are ok with the pi1 to pi4 but just wanted to make sure you were aware :) |
remote: Enumerating objects: 13, done. |
Yeah, thankfully I moved away from using sysfs years ago. I think I'll just have to switch to |
I've also come across https://github.com/raspberrypi/utils/tree/master/pinctrl after spotting Gadgetoid's fancy new CLI tool that uses its data. Unfortunately it requires sudo, so not really an option, but its source is a good starting point for eventual |
Oh wow. I thought we weren't getting any RP1 documentation for weeks. That is going to be very helpful for adding Would you mind checking if |
ukscone@glooston:/dev $ ls -al /dev/rp1-gpiomem |
Just to give you a quick update, I've had a busy week because of unrelated work stuff, but I should have some time over the next few days to get this up and running. I've made some initial internal changes to use a different Based on what I found in the DTs and the documentation I think I have an accurate idea of the |
i'll be out and about on Saturday but apart that that i'm at your beck and call :) |
@ukscone I implemented all the needed functionality to work with While reading from the registers should be safe, there is a risk when changing modes / levels / bias. Values could be written to the wrong register, causing unexpected results. If you'd rather stick to only testing read operations, I completely understand. When you have some time, you can update your local rppal repo and run Should we run into any unsolvable issues, I'll probably ask you to dump the contents of EDIT: That should be |
heh you are not going to believe this. switched to bookworm release image rather than the beta image i had been using and the rp1-gpiomem has gone away :) ukscone@glooston:~/rppal $ cargo run --example gpio_status smh we now have 5 gpiomems -- gpiomem0-4 |
Well, on the bright side, at least that matches with the |
Should be good to go now. |
the libgpiod tool gpioinfo shows this on the release image ukscone@glooston:~/rppal $ gpioinfo |
Nice! GPIO 9, 10 and 11 marked as Alt0 is exactly as it should be when you have SPI enabled. Looks like it's reading the correct data. |
it seems to be doing all the right things. i've asked in the pi forums what's up with the rp1-gpiomem vanishing and multiple gpiomems. it makes life easier in the end not to have to have two different gpiomems to have to check for but i don't recall it being mentioned anywhere and i thought the rp1 doc mentioned rp1-gpiomem |
Considering read operations work as expected, that leaves write operations. That will either require some coding (or using any of your existing code), or using the Let me know if you need any help with writing up some sample code. |
i'll dig out some leds, jumper wires and breadboard |
Yeah the whole naming convention is a bit vague to me, but I can at least see the point in using a different name for |
gpio_blinkled & gpio_blinkled_signals are blinking an led :) so gpio23 is working :) |
Awesome! Thanks for the quick test results. I'm glad it's all going smoothly. That means both mode changes and level changes are working. That just leaves checking an input pin's level with the level getting changed between high and low by some external source, and checking the voltage on an input pin with pull-up/pull-down enabled, both of which will require some coding and external parts/multimeter (happy to help if needed). It sounds like it's all working as expected though. After you get a chance to check the above-mentioned, that should be the entire GPIO module ready for the Pi 5! While I don't expect any major issues with the other peripherals, if you have any hardware lying around that would let you perform some tests on SPI/I2C/PWM/UART, it would be good to confirm they're still working before launch day. BTW, the new GPIO registers also give us access to a few new toys (change output drive strength, input Schmitt trigger hysteresis, output slew rate limiter, debounce), but I'll wait until I have my hands on a Pi 5 as well before adding support for those, so something to look forward to for 0.16.0. 😁 |
i'll dig out all my bits and pieces tomorrow and start playing. i have a few i2c & spi displays & sure i have a few pwm thingies just a matter of finding them |
dug out my ds3231 and the example i2c_ds3231.rs seems to work as expected |
Great to hear! I wasn't expecting any problems, but it's always good to check. It looks like rppal is ready for the Pi 5. I'll get 0.15.0 out the door within the next day or two. Thanks again for all the help! |
great. i'm looking forward to the release as then i'll be able to try porting one of my last python programs left to rust (& tauri) Pity we don't seem to have a rust equivilent of the python module luma but we can't have everything :) |
RPPAL v0.15.0 with Raspberry Pi support is now available! |
@golemparts I'm getting the same error in most recent version :(
|
Hi @Jezorko. The error you're getting likely means your Raspberry Pi doesn't have a If you do have a |
Thank you @golemparts, this worked!
|
I found this issue after I reported mine #154 Was the HW pwn tested and where there OS settings I might have missed that where not documented? |
I'm not sure if I can be of any use to you but I have a Raspberry Pi5 already in my hands as I was part of the test group for it. If you'd like any testing done on it i'm happy to help. I did try to get things running today from your github repo but i'm still a very newbie rust user so didn't get past the
'''
Error: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })
'''
running the examples which i believe is an error on how i built the library rather than the library itself
The text was updated successfully, but these errors were encountered: