try this Lib : #include "SD_MMC.h" // SD Card ESP32
By default, the pin mapping for SPI is:
| SPI | MOSI | MISO | CLK | CS |
|---|---|---|---|---|
| VSPI | GPIO 23 | GPIO 19 | GPIO 18 | GPIO 5 |
| HSPI | GPIO 13 | GPIO 12 | GPIO 14 | GPIO 15 |
MicroSD Card Connections
The following pins are used to interface with the microSD card when it is on operation.
| MicroSD card | ESP32 |
|---|---|
| CLK | GPIO 14 |
| CMD | GPIO 15 |
| DATA0 | GPIO 2 |
| DATA1 / flashlight | GPIO 4 |
| DATA2 | GPIO 12 |
| DATA3 | GPIO 13 |

RV mineirin
FYI Which pins to use for SD card acces? (SD/SPI vs HSPI/JTAG/SD vs VSPI/SPI-Mode) - ESP32 Forum