Skip to content

bump MSC buffer for RP2040 boards exposing SD-over-USB#10964

Open
mikeysklar wants to merge 1 commit intoadafruit:mainfrom
mikeysklar:pr-rp2040-sd-msc-bufsize
Open

bump MSC buffer for RP2040 boards exposing SD-over-USB#10964
mikeysklar wants to merge 1 commit intoadafruit:mainfrom
mikeysklar:pr-rp2040-sd-msc-bufsize

Conversation

@mikeysklar
Copy link
Copy Markdown

@mikeysklar mikeysklar commented Apr 21, 2026

Workaround for macOS bulk-IN endpoint stalls on RP2040 during multi-sector SD READ(10) probes with the default 1024-byte MSC buffer. SD card never mounts on macOS; Linux works. Bumping the buffer to 16 KB clears the stall.

Applied only when CHIP_VARIANT=RP2040 and CIRCUITPY_SDCARDIO=1. No RAM cost for RP2350 boards or non-SD RP2040 boards.

Tested (CP 10.1.4 stable)

Board Chip Default 1024 B This PR (16 KB on RP2040+SD)
Feather RP2040 Adalogger RP2040 macOS stalls, gives up after ~5 min Mounts first try
Metro RP2040 RP2040 LUN 1 never probed (separate bug — #10965) LUN 1 still never probed (separate bug — #10965)
Metro RP2350 RP2350 Works Not applied (unchanged)
Fruit Jam (3-LUN) RP2350 Works Not applied (unchanged)

Host OSes: macOS 26.x on Apple Silicon M2 (both Mac mini and MacBook Air), Ubuntu 24.04 (kernel 6.17). Linux is unaffected in every cell.

This is a stopgap

Metro RP2350 and Fruit Jam handle the same macOS traffic fine at 1024. The root cause is almost certainly in tinyusb's rp2 device driver or the RP2040 USB peripheral itself. Root-cause ticket: hathach/tinyusb#3607. Once fixed upstream, this conditional can be reverted.

Related

On Adafruit Feather RP2040 Adalogger and similar RP2040 boards that
expose an SD card as a second USB MSC LUN, the default 1024-byte MSC
buffer triggers bulk-IN endpoint stalls on macOS during multi-sector
READ(10) probes. macOS retries ~18 times over 5 minutes then gives up;
Linux handles the same firmware cleanly.

Bumping CFG_TUD_MSC_BUFSIZE to 16384 clears the stall. This PR only
applies the bump when CHIP_VARIANT=RP2040 and CIRCUITPY_SDCARDIO=1,
so RP2350 boards and non-SD RP2040 boards keep the small buffer and
the ~15KB RAM cost.

This is a stopgap workaround. Metro RP2350 and Fruit Jam (both RP2350)
handle the same macOS traffic fine at 1024 bytes, so the underlying
issue is almost certainly in the RP2040 USB peripheral or tinyusb's
rp2 device driver. Root-cause ticket will be filed separately.
@mikeysklar mikeysklar marked this pull request as ready for review April 21, 2026 19:45
@mikeysklar mikeysklar changed the title raspberrypi: bump MSC buffer for RP2040 boards exposing SD-over-USB bump MSC buffer for RP2040 boards exposing SD-over-USB Apr 22, 2026
@bablokb
Copy link
Copy Markdown

bablokb commented Apr 22, 2026

No RAM cost for RP2350 boards or non-SD RP2040 boards.

In py/circuitpy_mpconfig.mk you have: CIRCUITPY_SDCARDIO ?= $(CIRCUITPY_FULL_BUILD), so this will by default turn on CIRCUITPY_SDCARDIO unless it was explicitly disabled. And currently I see no RPxxxx board explicitly disabling this.

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.

2 participants