Closed lukeburong closed 7 months ago
Thank you for reporting this issue. I've seen a few Pi 5 specific problems reported lately. Unfortunately I haven't had a Pi 5 available for testing to check these out myself, but I should have one coming in this or next week.
It does sound like your assessment of the cause of the problem is likely correct, but I'm hesitant to implement a fix I can't verify. You're welcome to submit a PR that addresses FUNCSEL being set to NULL (31) on the Pi 5, which I'm happy to merge so you can continue working on your project, and then release the update as soon as I'm able to check things on a Pi 5 myself.
Hello,
In some circumstances, the GPIO pin mode is not set correctly when creating an InputPin on the Raspberry Pi 5.
For example:
pinctrl 25
output before:pinctrl 25
output after:As you can see, the pull-down resistor on GPIO25 has been disabled, but the pin is not set as an input (and does not function as one).
I believe this may occur due to
rppal
not handling FUNCSEL in the relevant GPIO CTRL register being 31 (i.e. NULL, see https://datasheets.raspberrypi.com/rp1/rp1-peripherals.pdf page 22)This causes the following match expression to hit the wildcard pattern and return
Mode::Input
:https://github.com/golemparts/rppal/blob/77ec1098f0df1d295de9db0e481abe5e27d9ed2e/src/gpio/gpiomem/rp1.rs#L226
Meaning
InputPin::new
does not set the pin mode as it believes that it is already set to input:https://github.com/golemparts/rppal/blob/77ec1098f0df1d295de9db0e481abe5e27d9ed2e/src/gpio/pin.rs#L431-L435