ESR32-WROOM with SD Breakout

Hi everyone. Experienced electronics engineer here but just starting to dip my toe into the Arduino world. Working on a small project that requires logging data to as SD card. I am using a ESP32-WROOM-32UE board:

I have wired this up (correctly I believe) to:

Running through some very basic code I keep getting errors and the card will not initialize (the card is formatted to FAT32). Here is the sample code:

#include <SPI.h>
#include <SD.h>

const int chipSelectPin = 17; // Change to your CS pin

void setup() {
  Serial.begin(115200);
  pinMode(chipSelectPin, OUTPUT);

  if (!SD.begin(chipSelectPin)) {
    Serial.println("SD card initialization failed!");
    while (1);
  }

  Serial.println("SD card initialized successfully!");
}

void loop() {
  // This loop can be left empty for the test

  delay(1000); // Add a delay if desired
}

The output error I get is:

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:13260
load:0x40080400,len:3028
entry 0x400805e4
E (159) esp_core_dump_flash��ɕ�dump data check failed:
Calculated checksum='3936a6d4'
Image checksum='ffffffff'
SD card initialization failed!

As I've been going through this project I've learnt a lot about the Arduino ecosystem and overcome so (probably basic for everyone here) issues but this is the first one that has really stumped me.

Thanks in advance for any advice.

Your application seems to have crashed. I have no experience with the ESP so can't help with that.

To my knowledge the ESP is a 3.3V device as is the SD card. So my questions is why you use a module with level shifting?

Well, there is no way to verify this without the actual connections. Please provide a (hand) drawn schematic (Not Frtzing !!) to show us how you have actually wired it up.

An ESP32 has 2 SPI ports, by default VSPI is used, and the usage of the default HSPI pins can cause some issues, but SPI pins can be re-assigned in needed.

That is correct, you don't need level-shifting.

It is giving some error initially, but it does get to the line where

SD card initialization failed!

is printed. A tad odd i must say.

I will get the schematics drawn out in a couple of days when I get back to working on this project. I thought that the level shifting would work even if the board in use already ran off 3V3?

That is possible, but there is no need for level shifting at all, don't provide anything higher than 3.3v to the level-shifter or it may increase the logic HIGH level to that Vcc.

First things first: have you been able to get a basic program example running on the ESP32 board, without the SD module connected? If not, start with a blink LED test.

The "core dump flash" error message is a concern, and probably has nothing to do with the SD module.

Yes, I've had a number of other programs to work (load cell amp, temp sensor, CAN module) working and they still work when I go back to using those specific progrms.

Please post a wiring diagram, showing how you connected the SD module.

SD cards can draw over 100 mA during write operations, so make sure the power supply is adequate.

I'm using a custom ESP32-S3 audio board (not using SPI), and I've started getting the core dump flash error message as well. It just started doing so arbitrarily after some upload or the other.

Flashing example sketches doesn't make it go away. For what it's worth, upload seems successful (I see "Hash of data verified" at the end).

Given the recency of this thread, perhaps there is a bug in the new ESP32 Arduino Core version or something?

E (88) esp_core_dump_flash: Core dump data check failed:
Calculated checksum='53805682'
Image checksum='ffffffff'

Sorry if my issue was unrelated, but my problems were likely due to power brown-out during flashing. I enabled the "Erase All Flash Before Upload" option for one upload, and lo and behold, the error is gone.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.