Dear Sara, Rui, first of all: your book Learn ESP32 with Arduino IDE is perfect. Everything works immediately and as promised. I’ve by now tested many programs and they are all OK.
However, I have a quite trivial problem with writing to an SD-card. I’m using two identical SD-card modules exactly like the ones you use in one of the programs on your web-site: the small 3,3V-ones. And I’m using 4 different (two different brands) ESP32 Devkit V1 in combination wih two different 32MB HC-1 microSD-cards. When I use your program in the library SD(esp32) SD-test, in each and every combination of my ESP32’s and SD card modules, in about 30% of the runs I get the message “card mount failed”. My question now is:
1) any idea why this is the case?
2) woud using the SD_MMC library and “configuration” (whatever that is) solve the problem?
3) could the size of the microSD-cards; 32MB HC-1, cause the problem?
4) most important: since your proram in the library “SD(esp32) SD-test” is quite complicated, is there a program for the combination ESP32/SD-card that simply writes and reads data without further stuff, like the ones that exist for the Arduino?
Thanks in advance for your reply, Ronald Keus
To be honest, I’m not sure why you get the “card mount failed” sometimes. I don’t think the SD_MMC library configuration will make a different. Please note that if you want to use SD_MMC, your microSD card module must support SD_MMC (the modules we use don’t have SD_MMC support). There are other microSD card modules that support SD_MMC.
As for the microSD card, they must be formatted as FAT32.
We have this tutorial about the microSD card with the ESP32 (this is probably the example you’ve already tested): https://randomnerdtutorials.com/esp32-microsd-card-arduino/#handlefilesmicrosdcard