I can’t connect a microSD card to either the Arduino or the ESP32. It needs to be connected to the ESP32; I just tested it on the Arduino to see if it works at all.

Equipment: ESP32 devkit v1, Arduino Nano, MicroSD card adapter, MicroSD card SanDisk 64gb eXFat.

Software: Arduino IDE, library SdFat (version: 2.2.2). The sketch is an example from the sdfat library - (sdinfo).

Connection to pin: SD adapter pin - CS, SCK, MOSI, MISO, VCC, GND
Arduino to SD Adapter - (CS, D10) (SCK, D13) (MOSI, D11) (MISO, D12) (VCC, +5V) (GND, GND)
ESP32 to SD Adapter - (CS, D27) (SCK, D14) (MOSI, D12) (MISO, D13) (VCC, VIN) (GND, GND)

Result ESP32:

configsip: 0, SPIWP:0xee
mode:DIO, clock div:1
entry 0x400806ac

Result Arduino:

SdFat version: 2.2.2

Assuming the SD is the only SPI device.
Edit DISABLE_CS_PIN to disable an SPI device.

Assuming the SD chip select pin is: 10
Edit SD_CS_PIN to change the SD chip select pin.

type any character to start

These are the full port monitor results.

1 Answer 1


Found out what's wrong

  1. Common for connecting to any equipment

SdFat doesn't work for me, I still don't understand what's wrong with this library so it's better to use standard SD library

  1. Common for connecting to any equipment

SD card (no name, SDHC, 32 GB)

Formatting an Sd card for an SD library (possibly for SdFat) should be in Fat32 with a msdos partition table
I found the answer here (https://forum.arduino.cc/t/yet-another-sd-initialization-fail/286017)
Due to an incorrect partition table, my card could not be read

  1. ESP32 pin connection
    ESP32 to MicroSD Adapter - (CS , D5) (SCK , D18) (MOSI , D23) (MISO , D19) (VCC , VIN) (GND , GND)

  2. Arduino Pin Connection
    Arduino to MicroSD Adapter - (CS , D4) (SCK , D13) (MOSI , D11) (MISO , D12) (VCC , +5V) (GND , GND)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.