I am new to this forum. I am writing here because I have / had several issues with the ESP32 and SD cards.
1. sd card reader keeps MISO line on HIGH -> other devices 'only' send 11111111 -> solved: faulty reader replaced
2. ESP32 stops responding, e.g. after 60 minutes reading from the sd card -> unresolved
3. SD card consumes a lot of power "after" the reading process -> unresolved
In order to analyze the problem 2 (ESP32 does not react any more), I measured the current, which is consumed by the sd card. So I came to Problem 3:
after initializing the sd card, 2.9mA are needed. Then I open a file and read the data. while reading about 20mA are consumed. After closing the file the sd card (idle) consumes about 23mA (!!!).
I then tested the behavior on an Arduino Pro Mini. There will be 2.2mA after init, about 13mA at the read, 2.2mA after closing the file. so everything ok.
I do not understand why the sd card after the 1st read always consumes 23mA although not read further. and the consumption is higher than during the transfer.
I do not know if the problem 2 and 3 has a connection. but after a reset (also completely disconnected from the power) I can very often no longer initialize the sd card.
######################
My system:
ESP 32 Dev Board
Arduino IDE 1.8.7
used board URL: https://dl.espressif.com/dl/package_esp32_index.json
Arduino IDE package: esp32 by Espressif Systems version 1.0.0
Arduino IDE settings: "ESP32 Dev Module" -> 512k upload speed -> Flash Freq 80Mhz -> Flash 4MB
SPI Speed: 20Mhz (sd card)
Sketch:
Code: Select all
//....
#include <SPI.h>
#include <SD.h>
const uint8_t PIN_SD_CARD_CS = 5;
//.....
Serial.print ("init ..."); while (! SD.begin (PIN_SD_CARD_CS, SPI, 20 * 1000 * 1000, "/ sd")) {Serial.print ("."); delay (1000); } Serial.println ("done");
//.....