Skip to content

fix(bsp/rp2040): use MAX3421_SPI in spi_write_read_blocking#3521

Merged
HiFiPhile merged 1 commit into
hathach:masterfrom
RobertDaleSmith:fix/max3421-spi-xfer-api
Mar 5, 2026
Merged

fix(bsp/rp2040): use MAX3421_SPI in spi_write_read_blocking#3521
HiFiPhile merged 1 commit into
hathach:masterfrom
RobertDaleSmith:fix/max3421-spi-xfer-api

Conversation

@RobertDaleSmith
Copy link
Copy Markdown
Contributor

The write+read path in tuh_max3421_spi_xfer_api() hardcodes spi0 instead of MAX3421_SPI. The read-only and write-only branches are fine — just this one got missed.

Causes a hang on any board using spi1 for the MAX3421E (e.g. Feather RP2040 USB Host with a MAX3421E FeatherWing on SPI1). spi_write_read_blocking() blocks forever since spi0 was never initialized.

One-line fix, consistent with the other two branches right above it.

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.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 spi0 with MAX3421_SPI in the spi_write_read_blocking() branch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Collaborator

@HiFiPhile HiFiPhile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you !

@HiFiPhile HiFiPhile merged commit 115581a into hathach:master Mar 5, 2026
258 of 260 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants