Skip to content

SD Card power usage in deep sleep (or when idle) #2958

Closed
@ducalex

Description

@ducalex

Hardware:

Board: Lolin32
Core Installation version: ESP-IDF: v3.3-beta3-103-ga9d266b92, Arduino as a component: 7d78247
IDE name: VS Code
Flash Frequency: 40Mhz
PSRAM enabled: no
Upload Speed: 15200
Computer OS: Windows 8.1

Description:

When I use the SD library and then go into deep sleep the SD Card uses an absurd amount of power (10-12mA). This does not occur if I use esp_vfs_fat_sdmmc_mount instead of the SD library even if I do not uninitialize it before sleeping.

I've investigated and the IO pins are freed correctlty (although card->ssPin isn't done explicitely). So the SD Card must be left in a weird state because of a wrong or incomplete command in the driver.

I fixed my problem by adding: sdTransaction(pdrv, GO_IDLE_STATE, 0, NULL); in sdcard_uninit

But the real problem is probably elsewhere.

Sketch: (leave the backquotes for code formatting)

#include <Arduino.h>
#include <SD.h>
#include <esp_sleep.h>

void setup() {
    SD.begin();
    SD.end();
    esp_sleep_enable_timer_wakeup(10 * 1000 * 1000);
    esp_deep_sleep_start();
}

void loop() {
}

Debug Messages:

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: StaleIssue is stale stage (outdated/stuck)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions