Page 1 of 1

ESP-IDF sd_card example can't mount SD card

Posted: Wed Aug 14, 2019 9:20 am
by sshydlovskyi

Recently I have tried to access SD card for my ongoing project. I'm using ESP32-LyraT board, version 4.3.

The build process itself runs fine and the image can be uploaded without issues. However, when the app starts, I'm getting an error message like this: "Failed to mount filesystem. If you want the card to be formatted, set format_if_mount_failed = true." I have found that variable in mount configuration structure, changed its value to "true", but this doesn't help.

Also, in the README for the example, there's a description of another error: Card fails to initialize with `sdmmc_check_scr: send_scr returned 0xffffffff` error. This message is also present in the log and the explanation looks like "Connections between the card and the ESP32 are too long for the frequency used. Try using shorter connections, or try reducing the clock speed of SD interface." But I didn't figure out how to make connections shorter or reduce SD interface clock speed.

At the same time, if I use ESP-ADF peripherals API for SD card, everything is fine: SD card can be initialized and mounted, and some file can be created.

So my question is, actually, consists of two parts.

1. What I am missing while using ESP-IDF API? Maybe, it is SD card itself (size/type/etc.)? I have found that only FAT32 filesystem can be used and formatted the card this way. If not, is it possible that interface clock speed matters? If so, how to change it?

2. What the difference between ESP-IDF and ESP-ADF approach to SD card access, so I can use the latter but not former? I know that ADF is the superset of IDF, so it should use underlying IDF calls.

Thanks in advance for the answers.

Re: ESP-IDF sd_card example can't mount SD card

Posted: Thu Aug 15, 2019 11:05 am
by sshydlovskyi
Answering my own question, I would like to describe the way to make sd_card example work properly.

After checking the documentation for ESP32-LyraT v. 4.3 board I have found that DIP switches block affects the way SD card is used. In my case, all the switches are turned off, except #7 that is on to allow AUX input connect detection. In such configuration, SD card is used in 1-line mode. But to utilize this, 1-line is also should be chosen in the source by uncommenting "slot_config.width = 1;" line. After that, everything is OK.