Skip to content

support DigitialInOutProtocol for CS of sdcardio.SDCard#11053

Open
bablokb wants to merge 2 commits into
adafruit:mainfrom
bablokb:cs_sd_proto
Open

support DigitialInOutProtocol for CS of sdcardio.SDCard#11053
bablokb wants to merge 2 commits into
adafruit:mainfrom
bablokb:cs_sd_proto

Conversation

@bablokb

@bablokb bablokb commented Jun 12, 2026

Copy link
Copy Markdown

This fixes #11047. The implementation is basically a copy&paste&edit of what fourwire.FourWire does.

Tested on an upcoming Waveshare board that uses SD_CS behind an ioexpander, and on a Pico with a normal SD breakout attached.

@bablokb

bablokb commented Jun 13, 2026

Copy link
Copy Markdown
Author

With my last fix, all builds are now successful.

@dhalbert , @mikeysklar : I don't have the hardware to test the automount feature (I never bothered to route the sd-card-detect pin on my pcbs). It would be great if one of you could do a test on one of the boards with integrated sd-card that use this feature (e.g. adalogger, fruit-jam).

@mikeysklar

Copy link
Copy Markdown
Collaborator

checking now on a Metro RP2350

@mikeysklar

Copy link
Copy Markdown
Collaborator

I tried this PR on a Metro RP2350 and connected it two different hosts macOS and Linux.

CircuitPython 10.3.0-alpha.2-31-g6285efc59e-dirty

I'm not seeing the microSD drive pass through correctly. Tried both exFAT (64GB) and FAT32 (16GB) cards.

On macOS I get this error.

"The disk you attached was not readable by this computer."

The disk device is visible, but the filesystem fails to mount.

It looks like this is passing an address instead of an object.

common_hal_digitalio_digitalinout_never_reset(MP_OBJ_TO_PTR(&sdcard.cs));

should be:

common_hal_digitalio_digitalinout_never_reset(MP_OBJ_TO_PTR(sdcard.cs));

Will confirm.

@mikeysklar

mikeysklar commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Yep, that fixed it:

Ubuntu 24.04.4 LTS:

/dev/sdb1          15328     1724     13604  12% /media/sklarm/CIRCUITPY
/dev/sdc1       61794304    14336  61779968   1% /media/sklarm/64GB_SD

macOS Tahoe 26.5.1:

/dev/disk4s1        30660      3452     27208    12%       0          0     -   /Volumes/CIRCUITPY
/dev/disk5s1    123588864     28928 123559936     1%       1          0  100%   /Volumes/64GB_SD

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.

sdcard.SDCard: cs does not support digitalio.DigitalInOutProtocol

2 participants