Repository navigation
Conversation
rdon-key
marked this pull request as draft
October 13, 2026 12:28
Contributor
Author
|
I’m moving this back to draft for now. After looking into RP2350 more closely, it seems the BOOTSEL handling is much closer to RP2040 than I initially thought, and the relevant errata does not affect the QSPI pads. I’m going to add RP2350 support and test it on a Pico 2 before marking this ready for review again. |
Add machine.BootselButton() to read the BOOTSEL button state on RP2040 and RP2350 boards. Reading the button requires temporarily overriding the QSPI flash chip-select pin, which makes flash inaccessible during the read. The implementation uses the existing RP2 flash-safe mechanism to prevent the other core from accessing flash during the operation. The low-level reading function runs from RAM and follows the official Raspberry Pi Pico BOOTSEL example.
rdon-key
force-pushed
the
feture/rp2040-bootselsw
branch
from
October 13, 2026 15:35
74e957f to
cf08b34
Compare
rdon-key
marked this pull request as ready for review
October 14, 2026 02:29
Contributor
Author
|
RP2350 support has been added and tested on a physical Pico 2 with both scheduler=tasks and scheduler=cores. CI is also passing, so I’ve marked this ready for review again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add
machine.BootselButton()to read the BOOTSEL button state on RP2040 and RP2350 boards.Reading the BOOTSEL button requires temporarily overriding the QSPI flash chip-select pin, which makes flash inaccessible during the read. The implementation uses the existing RP2 flash-safe mechanism to prevent the other core from accessing flash during this operation.
The low-level reading function runs from RAM and follows the official Raspberry Pi Pico BOOTSEL example.
API note
This adds a new exported function,
machine.BootselButton() bool, to themachinepackage for RP2040 and RP2350 targets.Many RP2040 and RP2350 boards have a BOOTSEL button. On boards such as the Raspberry Pi Pico and Pico 2, it is the only user button. However, it cannot be read like a normal GPIO: reading it requires taking over the QSPI flash chip-select pin, running code from RAM, and keeping the other core away from flash. This is hard to do safely from application code, so I think it belongs in the
machinepackage.I'm happy to change the name or signature if there is a preferred convention.
Testing
Tested on physical Raspberry Pi Pico and Pico 2 boards.
Raspberry Pi Pico
-scheduler=tasks: PASS-scheduler=cores: PASSRaspberry Pi Pico 2
-scheduler=tasks: PASS-scheduler=cores: PASSBasic test
Run on RP2040 with:
Run on RP2350 with:
Multicore workload test
Run on RP2040 with:
Run on RP2350 with:
Example output on Pico:
Example output on Pico 2:
BOOTSEL press and release detection worked while the worker goroutine continued making progress. No hangs or failures were observed.
Note: this test does not verify that the worker goroutine actually runs on the second core.