Page 1 of 1

How to mount sdcard on S3 Lolin Pro via Micropython

Posted: Fri Dec 16, 2022 10:30 am
by frug2359
Hello

Any pointers to getting sdcard working on a Lolin S3 Pro?

I have tried


import os
from machine import Pin
from machine import SDCard
sd = SDCard(slot=2, sck=Pin(12), mosi=Pin(11), miso=Pin(13), cs=Pin(46))
os.mount(sd, "/sd")


but am getting

Traceback (most recent call last):
File "<stdin>", line 4, in <module>
OSError: (-258, 'ESP_ERR_INVALID_ARG')

Re: How to mount sdcard on S3 Lolin Pro via Micropython

Posted: Sun Dec 18, 2022 7:07 pm
by bidrohini
I think at first it's better to make sure that the SD card and card holder are good. Check the card separately along with the holder. If you have an arduino, you can check easily. Connect your SD card to the arduino and upload cardinfo example of the arduino ide. Thus you can at least find out if the problem is in your SD card or in your coding.

Re: How to mount sdcard on S3 Lolin Pro via Micropython

Posted: Mon Dec 19, 2022 11:27 am
by frug2359
The card works ( I tested independently.)

Just for anyone else:

What I found worked is this:

Code: Select all

import sdcard

sd = sdcard.SDCard(machine.SPI(N, sck=machine.Pin(12), mosi=machine.Pin(11),
                   miso=machine.Pin(13)), machine.Pin(46))

os.mount(sd, "/sd")
print(os.listdir("/sd"))
where N =1 or 2