-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
De-initialize/Reset SD Card to save power #351
Comments
I Found a nice solution here: https://forum.arduino.cc/t/resolved-how-can-i-reboot-an-sd-card/349700 sending 0xFF over SPI often enough will cause the SD Card to reset and send 0xFF back. this simple code
reduces the power consumption to sub 1mA after sd.end. Would it be possible to add this to the sd.end code or add a sd.reset() function to also use it to reset a sd card if sd.begin fails? |
Some cards remain active after chips select is high until they see a few clocks. Try sending a 0XFF byte something like this with SD chip select high.
I will experiment with the sd.end() call to see if adding a transfer of an extra byte improves sleep. You can't really put a card back in the initial power on state. You can only reinitialize a card. For example once a card is in SPI mode you must cycle power to use 4-bit SDIO mode. |
looks like i was a minutes faster with the solution. Would look to have a sd.reset function added. Might be helpful for some people when they have a system crash. i can test this with a couple of sd cards. i have around 7 different types of sd cards here |
Found a solution. could this be tags as a feature request ?
Hi,
I'm working with an ESP32 based board that has already an inbuild SD Card Slot.
Looking into sleep current I noticed that the SD Card takes more power after sd.end than before sd.begin.
If I completely remove the sd card code but have the SD Card plugged in I get ~1mA (might be lower, limited by decimal points of measurement)
when I init the sd card and de-init it again, i get around 13-20 mA.
here is the interesting thing: in deep sleep, when i take out the sd card and put it in again it goes down to ~1mA.
Thus I conclude the sd card is after sd.end still held in some initialized state.
Is there a way besides cutting the power to the sd card with a transistor (which is not possible as the board is a given) to reset/de-init the sd card.
I read another thread from earlier that just stopping communicating with the sd would put it into a sleep state, I'm not seeing this. I tried putting all sd spi spins in input/input_pullup/input_pulldown and it didn't really help
The text was updated successfully, but these errors were encountered: