How to mount sdcard on S3 Lolin Pro via Micropython

frug2359
Posts: 2
Joined: Fri Dec 16, 2022 10:18 am

How to mount sdcard on S3 Lolin Pro via Micropython

Postby frug2359 » Fri Dec 16, 2022 10:30 am

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')

bidrohini
Posts: 202
Joined: Thu Oct 27, 2022 12:55 pm

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

Postby bidrohini » Sun Dec 18, 2022 7:07 pm

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.

frug2359
Posts: 2
Joined: Fri Dec 16, 2022 10:18 am

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

Postby frug2359 » Mon Dec 19, 2022 11:27 am

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

Who is online

Users browsing this forum: No registered users and 66 guests