Skip to content
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

SD_MMC works but after a random time fails until I power it off #4082

Closed
hepa94meca opened this issue Jun 11, 2020 · 6 comments
Closed

SD_MMC works but after a random time fails until I power it off #4082

hepa94meca opened this issue Jun 11, 2020 · 6 comments
Labels
Status: Stale Issue is stale stage (outdated/stuck)

Comments

@hepa94meca
Copy link

hepa94meca commented Jun 11, 2020

Hardware

  • ESP32_Wroover B
  • uSD 32GB
  • LAN8720
  • IDE Arduino
  • Upload Speed 921600
  • Flash 80Mhz

Description
I follow the instructions of the connection on the next link.. https://github.com/espressif/esp-idf/tree/master/examples/storage/sd_card#note-about-gpio12

  • D2 - GPIO 12 (PULL_UP by code => pinMode(12, INPUT_PULLUP)
  • D3 - GPIO 13 (10Kh pull-up)
  • CMD -GPIO 15 (10Kh pull-up)
  • VSS -GND
  • VDD -3.3V
  • CLK -GPIO 14 (10Kh pull-up)
  • VSS -GND
  • D0 -GPIO2 (10Kh pull-up)
  • D1 -GPIO4 (10Kh pull-up)

When I try just the SD_MMC it works great without problem, I tasted 7 days continuously, but when I add Ethernet (LAN8720) after 2 or 3 days sometimes after 1 or 2 hours the SD stops working, I have to restart the ESP by powering off other ways such as restarting by code doesn’t initialize the SD and it fails from the beginning .

I try also with SPI_SD protocol and happens more less the same, after some days the SD fails.

Steps to reproduce.
Use SD_MMC with Ethernet Connection, append some data on a file and wait until it fails

The LAN8720 connection is the follow...
https://sautter.com/blog/ethernet-on-esp32-using-lan8720/

Debug Messages
E (30975) sdmmc_cmd: sdmmc_read_sectors_dma: sdmmc_send_cmd returned 0x107
E (30975) diskio_sdmmc: sdmmc_read_blocks failed (263)
E (32012) sdmmc_req: sdmmc_host_wait_for_event returned 0x107
E (32012) sdmmc_cmd: sdmmc_read_sectors_dma: sdmmc_send_cmd returned 0x107
E (32023) diskio_sdmmc: sdmmc_read_blocks failed (263)
E (33082) sdmmc_req: sdmmc_host_wait_for_event returned 0x107
E (33082) sdmmc_cmd: sdmmc_read_sectors_dma: sdmmc_send_cmd returned 0x107
E (33093) diskio_sdmmc: sdmmc_read_blocks failed (263)
[E][vfs_api.cpp:265] VFSFileImpl(): fopen(/sdcard/dbin.csv) failed

Code
`
void setup(void)
{
Serial.begin(9600);

pinMode(12, INPUT_PULLUP);
if(!SD_MMC.begin()){
    Serial.println("Card Mount Failed");
    return;
}

WiFi.onEvent(WiFiEvent);
ETH.begin(ETH_ADDR, ETH_POWER_PIN, ETH_MDC_PIN, ETH_MDIO_PIN, ETH_TYPE, ETH_CLK_MODE);
InitServer();
InitWebSockets();
}
long contador=0;
long previousMillisSD=0;
#define Minuto 60000
void loop(void)
{

unsigned long currentMillis = millis();
if (currentMillis - previousMillisSD >=Minuto*10) {
previousMillisSD = currentMillis;
appendFile(SD_MMC, "/hello.txt", "World!\r\n");
}

}

void appendFile(fs::FS &fs, const char * path, const char * message){
Serial.printf("Appending to file: %s\n", path);

File file = fs.open(path, FILE_APPEND);
if(!file){
    Serial.println("Failed to open file for appending");
    return;
}
if(file.print(message)){
    Serial.println("Message appended");
} else {
    Serial.println("Append failed");
}

}
`

@cgmckeever
Copy link

Did you ever have a resolution of this -- seeing a similar issue

@stale
Copy link

stale bot commented Sep 27, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Sep 27, 2020
@stale
Copy link

stale bot commented Oct 11, 2020

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Oct 11, 2020
@hall1235
Copy link

hall1235 commented Jan 5, 2021

I got the same issue, how can you fix ?

@hepa94meca
Copy link
Author

The problem was solved, it was a power supply issue, my current was not enough.

@hall1235
Copy link

Thank you so much hepa94meca

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale Issue is stale stage (outdated/stuck)
Projects
None yet
Development

No branches or pull requests

3 participants