Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By daveb1014
#50503 Hi,

I am getting WDT resets every time I try to use a remove() or exists() on arduino with the ESP8266. Reading and writing is working fine. Does anybody know why that might be?

It's an 8GB card, formatted for FAT32. I have verified that files are created correctly by viewing them on a PC. But a call to SD.remove() or SD.exists() results in output similar to the following:


ets Jan 8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v60000318
~ld

...and the device resetting.

Any help would be appreciated! Great forums. I have searched but can't find anything related... apologies if I have missed something obvious.
User avatar
By daveb1014
#50534 Thanks :) I tried creating only a single 3GB partition on an 8GB card, and formatting as FAT16, but a:

SD.remote('myfile.txt');

Still produces an exception:

ets Jan 8 2013,rst cause:4, boot mode:(3,7)

wdt reset
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v60000318
~ld

Does the physical size of the card make a difference? Like, can the ESP8266 not support SDHC perhaps?

cheers
David
User avatar
By Me-no-dev
#50553 I run 8GB SDHC card also. I have one 3GB partition in FAT32 I think and have had no problems.
Can you check what the ESP sees from the card?
Code: Select allconst char *getSdTypeString(){
  if (SD.type() == SD_CARD_TYPE_SD1){
    return "SD1";
  } else if(SD.type() == SD_CARD_TYPE_SD2){
    return "SD2";
  } else if(SD.type() == SD_CARD_TYPE_SDHC){
    return "SDHC";
  } else {
    return "UNKNOWN";
  }
}

String getSizeString(size_t bytes){
  if (bytes < 1024){
    return String(String(bytes)+"B");
  } else if(bytes < (1024 * 1024)){
    return String(String(bytes/1024.0)+"KB");
  } else if(bytes < (1024 * 1024 * 1024)){
    return String(String(bytes/1024.0/1024.0)+"MB");
  } else {
    return String(String(bytes/1024.0/1024.0/1024.0)+"GB");
  }
}


bool initSD(){
  if (SD.begin(SS, 32000000)){
    Serial.print("\n==== SD Card Info ====\n");
    Serial.printf("SD Type: %s FAT%d, Size: %s\n", getSdTypeString(), SD.fatType(), getSizeString(SD.size()).c_str());
    Serial.printf("SD Blocks: total: %d, size: %s\n", SD.totalBlocks(), getSizeString(SD.blockSize()).c_str());
    Serial.printf("SD Clusters: total: %d, blocks: %d, size: %s\n", SD.totalClusters(), SD.blocksPerCluster(), getSizeString(SD.clusterSize()).c_str());
    sd::File entry;
    sd::File dir = SD.open("/");
    dir.rewindDirectory();
    while(true){
      entry = dir.openNextFile();
      if (!entry) break;
      Serial.printf("SD File: %s, type: %s, size: %s\n", entry.name(), (entry.isDirectory())?"dir":"file", getSizeString(entry.size()).c_str());
      entry.close();
    }
    dir.close();
    Serial.println();
    return true;
  } else
    Serial.println("SD Card Not Found!");
  return false;
}