Skip to content
Discussion options

You must be logged in to vote

By copying in the sdcard.py from micropython/micropython-lib/micropython/drivers/storage/sdcard.py, and using the SDCard class from there, I finally got it to work with SoftSPI:

from machine import Pin, SoftSPI
from sdcard import SDCard
import uos
spi = SoftSPI(baudrate=100000, sck=Pin(11,Pin.IN,Pin.PULL_UP), miso=Pin(16,Pin.IN,Pin.PULL_UP), mosi=Pin(15,Pin.IN,Pin.PULL_UP))
sd=SDCard(spi=spi, cs=Pin(42,Pin.IN,Pin.PULL_UP))
uos.mount(sd, '/sd')
uos.listdir("/sd")

It also works with machine.SPI using SPI instance 2:
spi = SPI(2, baudrate=400000, sck=Pin(11,Pin.IN,Pin.PULL_UP), miso=Pin(16,Pin.IN,Pin.PULL_UP), mosi=Pin(15,Pin.IN,Pin.PULL_UP))
but the first attempt at mount gave me:

>>> uos.…

Replies: 5 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@brianwyld
Comment options

Comment options

You must be logged in to vote
2 replies
@brianwyld
Comment options

@WolleKette
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by brianwyld
Comment options

You must be logged in to vote
3 replies
@lbuque
Comment options

@brianwyld
Comment options

@lbuque
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
ESP32
Labels
None yet
3 participants