rp2: Fix RP2350 and RP2350B pin alt functions. #17692
Open
+106
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
RP2350 builds were using the incomplete rp2_af.csv alt function table which broke pins > 31 in RP2350B (48-pin QFN-80) builds:
UART_AUX
(alt function 11) andPIO2
(alt function 8, directly conflicting the RP2040 functionGPIO_FUNC_GPCK
) were also missing.Changes
boards/*._af.csv
: Add separate alt-functions tables for RP2040,RP2350 and RP2350B.
CMakeLists.txt
: Pick correct _af.csv to pass into make-pins.py.boards/make-pins.py
: handle CORESIGHT and XIP_CS1 alt functions.machine_pin.c
: Add PIO2, CORESIGHT and XIP_CS1 alt functions.Testing
UART_AUX
I tested UART_AUX on an RP2350B board with the following code and a Raspberry Pi Debug Probe:
The pins are correctly configured as
UART_AUX
(presumably this always worked?) thanks to the use ofUART_FUNCSEL_NUM
, but configuring as UART AUX is now enabled inmachine.Pin
too.To be totally sure this worked, I set up UART 0 on pins 0 and 1, then changed them with
machine.Pin()
:B-variant Build
I set up a generic B-variant for testing, built against the vanilla
RPI_PICO2
board with:And the following config:
ports/rp2/boards/RPI_PICO2/mpconfigvariant_B.cmake
ports/rp2/boards/RPI_PICO2/pico2b.h
:ports/rp2/boards/RPI_PICO2/pins_b.csv
:Trade-offs and Alternatives
I'm not sure we need
CORESIGHT
andXIP_CS1
alt functions but they are included for completeness. They needed fixups inmake-pins.py
because it naively chops the first portion of the signal name off and tries to use that as the GPIO function.UART_AUX
is more interesting, it gives some more UART options on alt-function 11, but also needs special casing to ensureGPIO_FUNC_UART_AUX
is used in place ofGPIO_FUNC_UART
. eg:The addition of a
PIO2
alt function constant might be a separate and important fix for RP2350 variants in general (and may conflict, I need to check that but I've run out of day). Edit: I checked. I don't think anyone has caught this, though there are other outstanding issues with PIO2.