Thanks to visit codestin.com
Credit goes to github.com

Skip to content

SD card USB presentation problems #10632

@dhalbert

Description

@dhalbert

Between 10.0.0-alpha.4 and alpha.5, this code.py started failing on SAMD51, specifically PyPortal:

import board
import sdcardio
import storage
import time

spi = board.SPI()
cs = board.SD_CS

print("mounting sd card...")
sdcard = sdcardio.SDCard(spi, cs)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/sd")
print("sd card mounted")

while True:
    print("sleep 1")
    time.sleep(1)

On Linux: It prints sleep 1 once and then the USB connection hangs up. Then it reconnects after tens of seconds, , prints "sleep 1 again once, then disconnects again, and then starts printingsleep 1` regularly on the display, but there is no USB connection.

On Window 11 and macos 26.0: Similar behavior, but it prints sleep 1 much more slowly, with many seconds in between.

I'm testing on other ports as well. On an RP2040 Metro it does not crash, but often I get "no SD card", and it requires a hard power-cycle. Also on RP2040, a drive for the SD card appears on Linux, but is not mounted.

#10351 is a possibly relevant PR that was included in alpha.5. I think this all has to do with problems with auto-USB-presentation of secondary mounts. EDIT: #10351 prevented it from mounting at all, so I think it's something else.

Metro RP2350 acts like a Fruit Jam and seems to work OK, maybe because it always presents something?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions