Never be able to make sd_card example work

jcc147
Posts: 3
Joined: Wed Feb 10, 2021 4:25 am

Never be able to make sd_card example work

Postby jcc147 » Wed Feb 10, 2021 4:40 am

I need helps.
I try to use the sd_card example provided by esp_idf to read a sd card from a adapter.
From unknown reason, I have never been able to make it work.
This is the sd card adapter I got it from Amazon.
https://www.amazon.com/HiLetgo-Adater-I ... ics&sr=1-4


This is the message I got after SPI initiated:

I (344) example: Using SPI peripheral
I (354) gpio: GPIO[5]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (364) sdspi_transaction: cmd=52, R1 response: command not supported
I (414) sdspi_transaction: cmd=5, R1 response: command not supported
W (424) sdmmc_common: sdmmc_init_csd: SDSC card reports capacity=15949824. Limiting to 8388608.
E (424) sdmmc_sd: sdmmc_check_scr: send_scr returned 0x109
E (424) vfs_fat_sdmmc: sdmmc_card_init failed (0x109).
I (434) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
E (444) example: Failed to initialize the card (ESP_ERR_INVALID_CRC). Make sure SD card lines have pull-up resistors in place.

I've tried to map different IO pins, pull up registers. No one works for me.
Please help.

Thanks in advance.

Josh

ESP_Minatel
Posts: 364
Joined: Mon Jan 04, 2021 2:06 pm

Re: Never be able to make sd_card example work

Postby ESP_Minatel » Wed Feb 10, 2021 11:50 am

Hi,

Can you share your ESP-IDF version and how you are connecting the SD Card module to the board?

Be careful about this module power supply. The ESP32 is 3V3 and this modules should work on 5V (Arduino compatible). I think this is the issue.

jcc147
Posts: 3
Joined: Wed Feb 10, 2021 4:25 am

Re: Never be able to make sd_card example work

Postby jcc147 » Wed Feb 10, 2021 6:07 pm

The version of ESP-IDF is v4.2

The esp-wroom-32 dev board https://www.amazon.com/MELIFE-Developme ... 7a9c0027d0

The SD CARD adapter https://www.amazon.com/HiLetgo-Adater-I ... 218&sr=8-4


The connections:

D19 ---- MISO
D23 ---- MOSI
D18 -----SCK
D5 ---- CS
VIN (5V+) ----VCC
GND ---- GND


The dev board, sd card adapter hardware and the connections work fine on microPython.
But I have never make them work with sd_card_example.c provided in esp-idf.

Thanks,
Josh

amoghjain
Posts: 16
Joined: Mon Nov 30, 2020 9:04 am

Re: Never be able to make sd_card example work

Postby amoghjain » Sun Jul 24, 2022 6:30 am

Hello,

Were you ever able to make sd card work on esp_idf 5.0. Even though on arduino SD card is detected and works, but with esp_IDF i keep getting errors

Code: Select all

V bus_lock: dev 4 acquired.
D (2997) spi_master: device4 locked the bus
V bus_lock: SPI dev changed from -1 to 4
V (3007) spi_master: polling trans
V (3017) spi_master: polling trans done
V (3017) spi_master: polling trans
V (3017) spi_master: polling trans done
V (3027) spi_master: polling trans
V (3027) spi_master: polling trans done
V (3027) spi_master: polling trans
V (3037) spi_master: polling trans done
D (3037) spi_master: device4 release bus
V (3047) bus_lock: dev 4 released.
V (3047) sdspi_transaction: r1 = 0x7f hw_cmd.r[0]=0xffffffff
D (3057) sdspi_transaction: cmd=55, R1 response: command CRC error
D (3057) sdmmc_cmd: cmd=55, sdmmc_req_run returned 0x109
E (3067) sdmmc_sd: sdmmc_check_scr: send_scr returned 0x109
D (3067) sdmmc_init: sdmmc_card_init: sdmmc_check_scr returned 0x109
E (3077) vfs_fat_sdmmc: sdmmc_card_init failed (0x109).
I (3087) gpio: GPIO[5]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
E (3087) SD_MMC: Failed to initialize the card (ESP_ERR_INVALID_CRC). Make sure SD card lines have pull-up resistors in place.
I set all SPI pins as pull ups, but soon as SPI bus is initialized, all the pullups change from 1 to 0 :-(

Thanks

Songluu
Posts: 5
Joined: Fri Nov 04, 2022 4:26 am

Re: Never be able to make sd_card example work

Postby Songluu » Thu Nov 17, 2022 4:00 pm

Hello,did you find the solution?I have encountered the same problem.

Who is online

Users browsing this forum: No registered users and 232 guests