fix(bsp/rp2040): use MAX3421_SPI in spi_write_read_blocking#3521
Merged
HiFiPhile merged 1 commit intoMar 5, 2026
Conversation
The write+read path in tuh_max3421_spi_xfer_api() hardcodes spi0 instead of using the MAX3421_SPI define. This causes a hang on boards wired to spi1 (e.g. Feather RP2040 USB Host + MAX3421E FeatherWing) since spi_write_read_blocking() blocks forever on an uninitialized SPI peripheral. The read-only and write-only paths already use MAX3421_SPI correctly.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an RP2040 BSP bug where the MAX3421E SPI write+read transfer path in tuh_max3421_spi_xfer_api() incorrectly uses spi0 instead of the board-configured MAX3421_SPI, which can hang on boards wired to spi1.
Changes:
- Replace hardcoded
spi0withMAX3421_SPIin thespi_write_read_blocking()branch.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
The write+read path in
tuh_max3421_spi_xfer_api()hardcodesspi0instead ofMAX3421_SPI. The read-only and write-only branches are fine — just this one got missed.Causes a hang on any board using
spi1for the MAX3421E (e.g. Feather RP2040 USB Host with a MAX3421E FeatherWing on SPI1).spi_write_read_blocking()blocks forever sincespi0was never initialized.One-line fix, consistent with the other two branches right above it.