ESP32 does not work with all micro sdcards

pythagoras
Posts: 2
Joined: Mon Feb 27, 2023 1:02 pm

ESP32 does not work with all micro sdcards

Postby pythagoras » Thu Mar 09, 2023 9:23 am

I'm using idf.py v5.0.1 on an ESP32-Wroom-32E module connected to an micro sdcard via SPI. It usually works with most 32GB micro sd cards but I have a micro sdcard that it doesn't. The sd card is a SanDisk Ultra 32GB HCI class 10 A1. I was wondering if this card doesn't support spi or if it is just a question of setup.
I turned on debugging and this is what I got:
I (1357) SDCard: Initializing SD card
I (1367) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
V (1377) sdmmc_cmd: sending cmd slot=1 op=52 arg=80000c08 flags=1c00 data=0x0 blklen=0 datalen=0 timeout=1000
I (1387) sdspi_transaction: cmd=52, R1 response: command not supported
D (1387) sdmmc_cmd: cmd=52, sdmmc_req_run returned 0x106
V (1397) sdmmc_cmd: sending cmd slot=1 op=0 arg=0 flags=20 data=0x0 blklen=0 datalen=0 timeout=1000
V (1407) sdmmc_cmd: cmd response 00000000 00000000 00000000 00000000 err=0x0 state=0
V (1437) sdmmc_cmd: sending cmd slot=1 op=0 arg=0 flags=1c20 data=0x0 blklen=0 datalen=0 timeout=1000
V (1437) sdmmc_cmd: cmd response 00000001 00000000 00000000 00000000 err=0x0 state=0
V (1457) sdmmc_cmd: sending cmd slot=1 op=8 arg=1aa flags=1c30 data=0x0 blklen=0 datalen=0 timeout=1000
V (1457) sdmmc_cmd: cmd response 000001aa 00000000 00000000 00000000 err=0x0 state=0
V (1457) sdmmc_cmd: sending cmd slot=1 op=5 arg=0 flags=1030 data=0x0 blklen=0 datalen=0 timeout=1000
I (1467) sdspi_transaction: cmd=5, R1 response: command not supported
D (1477) sdmmc_cmd: cmd=5, sdmmc_req_run returned 0x106
V (1477) sdmmc_cmd: sending cmd slot=1 op=59 arg=1 flags=1c00 data=0x0 blklen=0 datalen=0 timeout=1000
V (1487) sdmmc_cmd: cmd response 00000001 00000000 00000000 00000000 err=0x0 state=0
V (1497) sdmmc_cmd: sending cmd slot=1 op=55 arg=0 flags=1c00 data=0x0 blklen=0 datalen=0 timeout=1000
V (1507) sdmmc_cmd: cmd response 00000001 00000000 00000000 00000000 err=0x0 state=0
V (1517) sdmmc_cmd: sending cmd slot=1 op=41 arg=40ff8000 flags=1030 data=0x0 blklen=0 datalen=0 timeout=1000
V (1527) sdmmc_cmd: cmd response 00000001 00000000 00000000 00000000 err=0x0 state=0
.
.
.
E (5007) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107
D (5007) sdmmc_init: sdmmc_card_init: sdmmc_init_ocr returned 0x107
E (5007) vfs_fat_sdmmc: sdmmc_card_init failed (0x107).
I (5017) gpio: GPIO[13]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
E (5027) SDCard: Failed to initialize the card (ESP_ERR_TIMEOUT). Make sure SD card lines have pull-up resistors in place.
ESP_ERROR_CHECK failed: esp_err_t 0x107 (ESP_ERR_TIMEOUT) at 0x400d9d10

It seems that spi is fine and the esp32 is communicating with the sdcard but is rejecting the setup commands.
Has anyone come across this problem?

Cheers

daelta
Posts: 1
Joined: Tue May 02, 2023 1:54 pm

Re: ESP32 does not work with all micro sdcards

Postby daelta » Tue May 02, 2023 1:59 pm

Hi, has anyone updates about this topic?

i have the same problem. I have a SanDisk Ultra 16GB Micro SD Card -> works fine. my 32GB SanDisk Ultra Micro SD Card is not working. The card changes after the ACMD41 command not to the ready state.

vbPhil
Posts: 1
Joined: Fri Sep 08, 2023 8:59 pm

Re: ESP32 does not work with all micro sdcards

Postby vbPhil » Fri Sep 08, 2023 9:18 pm

Yes I have the same issue with the SanDisk Ultra Plus 32 GB A1 MicroSD Card.
Replaced the card with a San Disk Industrial 8 GB and all is fine.
this was my first attempt at using the MicroSD with my ESP32 Devkit. I'm not exactly sure what version Kit it is. From Amazon,

ESP32 ESP32S Board ESP-WROOM-32 Development Board, Aideepen ESP32S ESP-WROOM-32 Board 2.4GHz Dual-Core Compatible with Arduin, Nodemcu, and MicroPytho


The adapter card is this, also from Amazon,
UMLIFE Micro SD SDHC TF Card Adapter Reader Module with SPI Interface Level Conversion Chip Compatible with Arduino Raspberry

This a snippet from the Monitor showing the error messages. The code used is from the Espressif SDCard Example.

I'm using Espressif 5.1 with VSCode and the ESP-IDF extension.

Code: Select all

E (1446) sdmmc_common: sdmmc_init_ocr: send_op_cond (1) returned 0x107
E (1446) vfs_fat_sdmmc: sdmmc_card_init failed (0x107).
I (1446) gpio: GPIO[4]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
E (1456) example: Failed to initialize the card (ESP_ERR_TIMEOUT). Make sure SD card lines have pull-up resistors in place.
I (1466) main_task: Returned from app_main()

Who is online

Users browsing this forum: GeoffL and 32 guests