← index #12636PR #16289
Off-topic · high · value 2.871
QUERY · ISSUE

how to add sdcard multi partition support on esp32 and esp32 s3

openby MichaelDu9226opened 2023-10-09updated 2023-10-09
enhancement

Is there any chance to add sdcard multi partition support on ESP32 or esp32 s3?

I noticed that stm32 supports sdcard multi partition
https://github.com/micropython/micropython/issues/2730

Any suggestions will be thanks

CANDIDATE · PULL REQUEST

esp32: support SD card on ESP32C6

closedby lheckemannopened 2024-11-22updated 2025-03-13
port-esp32

Summary

I wanted to use an SD card with my ESP32C6! This required making SDMMC support optional, since the ESP32C6 only has SPI.

I'm not sure about all of this code, especially the slot defaults and the condition combinations that I've implemented here, feedback is very welcome!

Testing

I've tested initialising an SD card and reading and writing data to and from it directly using readblock and writeblock. This seems to behave correctly, but formatting it using vfs.VfsFat.mkfs fails with EIO (and I don't understand why, as all the calls into machine_sdcard.c that I've traced so far have been successful). Maybe someone else can shed some light on this problem?

Trade-offs and Alternatives

This increases size a bit.
before:

bootloader  @0x000000    18064  (   14704 remaining)
partitions  @0x008000     3072  (    1024 remaining)
application @0x010000  1926480  (  105136 remaining)
total                  1992016

after:

bootloader  @0x000000    18064  (   14704 remaining)
partitions  @0x008000     3072  (    1024 remaining)
application @0x010000  1953376  (   78240 remaining)
total                  2018912

I don't think there are any very relevant alternatives besides not implementing SD support.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied