← index #11000Issue #17961
Related · high · value 2.234
QUERY · ISSUE

docs: machine.SDCard: clarify, which SPI device is used

openby sebert007opened 2023-03-10updated 2025-11-06
docs

I am using this code here:

    sd = machine.SDCard(slot=SD_SLOT,
                        width=SD_WIDTH,
                        sck=SD_SCK_PIN,
                        mosi=SD_MOSI_PIN,
                        miso=SD_MISO_PIN,
                        cs=SD_CS,
                        freq=SD_FREQ)

However it's not clear, which hardware SPI device is used.

I am using the ESP32-S3 (quad SPIRAM). It seems that SPI id=2 is used.

Is it possible to clarify this on the documentation? Or even let the user specify a parameter?

CANDIDATE · ISSUE

can we share the SPI bus with SDCard?

closedby xllaopened 2025-08-20updated 2025-08-20
enhancement

Description

I am using M5Stack's M5Paper base on esp32 port.
it shares the spi bus with eink panel controller it8951e and tfcard reader using two cs lines.
I can communicate it8951e use SPI bus via eink_cs.
but when I want to create a TFCard object using same SPI bus, it raise error.

<pre>
SDCard(slot=3, width=1, cd=None, wp=None, sck=Pin.board.SPI_SCK, miso=Pin.board.SPI_MISO, mosi=Pin.board.SPI_MOSI,cs=Pin.board.TF_CS, freq=20000000)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: (-259, 'ESP_ERR_INVALID_STATE')

</pre>

the micropython manual about TFCard said "SPI mode makes use of a SPI host peripheral, which cannot concurrently be used for other SPI interactions."

I thought share the SPI bus with multiply peripherals is a common demands.

I have look the implement of TFCard of esp32 port, it initialize SPI bus while choose SPI mode, can we pass in a SPI bus directly instead of just pass in mosi/miso/clk/freq etc?

Code Size

No response

Implementation

I hope the MicroPython maintainers or community will implement this feature

Code of Conduct

Yes, I agree

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