ESP32 does not work with all micro sdcards
Posted: 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
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