MicroSD card module and mounting error

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
ehyre
Posts: 2
Joined: Sun Sep 26, 2021 7:39 pm

MicroSD card module and mounting error

Post by ehyre » Sun Sep 26, 2021 8:01 pm

Hello,
recently I bought MicroSD card module but I have issue to make it work.
At the beginning I've connected it according to the manual using "slot 3" but I get en error:

MicroPython v1.16 on 2021-06-23; ESP32 module with ESP32
Type "help()" for more information.
>>>
>>> import os, machine
>>> sd=machine.SDCard(slot=3)
>>> os.mount(sd, "/sd")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: 16
>>>


Then I've changed connections to different pins:

sd=machine.SDCard(miso=12, mosi=13, sck=14, cs=15)

but with no luck.
I also changed frequency to lower than default one (e.g. 2Mhz, 1Mhz, 500KHz or 100KHz) but I get the same error.
Card is 2GB Kingston, formatted to FAT32, having 1 partition - mounted on computer it works.

Do you have any idea what could be root cause of this error ?

Saul
Posts: 10
Joined: Wed Jun 10, 2020 10:20 pm

Re: MicroSD card module and mounting error

Post by Saul » Mon Sep 27, 2021 6:08 am

Hi @ehyre,

Seems like it can be any number of things :) like a faulty wire or bad module or finicky SD card. Have you tried another SD card?

I have my SD card wired to the slot 2, pins (ESP32 devkitc):
SD_SCK 18
SD_MISO 19
SD_MOSI 23
SD_CS 5

And when I try to mount slot 3 I get similar error code:

Code: Select all

MicroPython v1.15-835-g1fcd6e97f-dirty on 2021-08-21; ESP32 module (spiram) with ESP32
Type "help()" for more information.
>>> import os, machine
>>> sd=machine.SDCard(slot=3)
>>> os.mount(sd, "/sd")
E (30329) sdmmc_sd: sdmmc_init_sd_if_cond: send_if_cond (1) returned 0x108
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: 16
When I mount slot 2 it works for me:

Code: Select all

MicroPython v1.15-835-g1fcd6e97f-dirty on 2021-08-21; ESP32 module (spiram) with ESP32
Type "help()" for more information.
>>> import os, machine
>>> sd=machine.SDCard(slot=2)
>>> os.mount(sd, "/sd")
>>> os.listdir('/')
['sd', 'boot.py']

ehyre
Posts: 2
Joined: Sun Sep 26, 2021 7:39 pm

Re: MicroSD card module and mounting error

Post by ehyre » Mon Sep 27, 2021 6:22 pm

Hi,
problem was / is with this 2GB card. Other 8GB or even 64GB works.
Thank you for your replay.

Saul
Posts: 10
Joined: Wed Jun 10, 2020 10:20 pm

Re: MicroSD card module and mounting error

Post by Saul » Tue Sep 28, 2021 4:49 am

Nice! Glad to hear its working :D

Post Reply