BUG: ESP32 dev board and reading sd card's (high power consumption + ESP32 hangs)

DrDoom
Posts: 5
Joined: Thu Dec 20, 2018 10:16 am

BUG: ESP32 dev board and reading sd card's (high power consumption + ESP32 hangs)

Postby DrDoom » Thu Dec 20, 2018 11:16 am

Hello everybody,

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.
SD Card Power Consumption.png
SD Card Power Consumption.png (7.58 KiB) Viewed 7820 times
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");
//.....
So the source code is nothing special. For testing I have a loop in which I stay for 120 minutes and read files. this is a stress test which usually does not react after 55-100 minutes.

DrDoom
Posts: 5
Joined: Thu Dec 20, 2018 10:16 am

Re: BUG: ESP32 dev board and reading sd card's (high power consumption + ESP32 hangs)

Postby DrDoom » Fri Dec 21, 2018 2:08 pm

I had some time today and have the behavior tested with an ESP8266. With the ESP8266 it is even so that after initializing the sd card directly consumes ~20mA (without io access to the card).
SD Card Power Consumption.png
SD Card Power Consumption.png (12.58 KiB) Viewed 7773 times
But: the ESP8266 does not hang and can always initialize the sd card.

Can anyone explain why sd cards on an ESP32 / ESP8266 idle consume much more power (compared to arduino) and why the ESP32 often does not initialize the sd card and eventually stops responding?

JimmyPedersen
Posts: 21
Joined: Sun Nov 15, 2015 4:14 am

Re: BUG: ESP32 dev board and reading sd card's (high power consumption + ESP32 hangs)

Postby JimmyPedersen » Mon Dec 24, 2018 11:41 am

Could it be that the esp8266 powers up the SD card on init while the ESP32 powers it up on first access?
The 18mA extra draw after using the SD card is probably from it being powered.
If you want to stop that I would assume that you need to power down the SD card and then do a re-init the next time you want to use it.

DrDoom
Posts: 5
Joined: Thu Dec 20, 2018 10:16 am

Re: BUG: ESP32 dev board and reading sd card's (high power consumption + ESP32 hangs)

Postby DrDoom » Tue Dec 25, 2018 9:39 pm

Hello jimmy,

Thanks for the answer. I would like to have more control over the functions, but I think that does not work with the functions of the SD library. The further, I read audio data (every 2 ms 32 byte for a mp3 module). therefore I can not shut down the sd card for 2 ms.

I still think that there is a bug on the ESP32. Otherwise the ESP32 would not freeze sometime.

Who is online

Users browsing this forum: No registered users and 137 guests