-->
Page 1 of 1

SPIFFS.format() always fails with WDT Reset

PostPosted: Mon Oct 31, 2016 5:06 pm
by jackjansen
I'm at my wits end, and ready to believe in a hardware failure of my Flash chip, but let's try here first.
I have an ESP-12F and whenever I try SPIFFS.format() or SPIFFS.begin() I get a long pause and eventually a WDT reset.

I've downloaded and run the same software in a couple of other ESP-12F boards with no problem. I can download any software that doesn't use SPIFFS to the board without any problem, it works as expected.

I've now minimised my code to the following and it still fails:

Code: Select all#include <FS.h>

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("Will format flash");
  bool ok = SPIFFS.format();
  Serial.println("Done!");
  if (ok) {
      Serial.println("And with success");
  } else {
    Serial.println("But it failed:-(");
  }
}

void loop() {
  // put your main code here, to run repeatedly:

}


And here is the decoded stack trace:

Code: Select all0x40105600: spi_flash_write at ?? line ?
0x40206b98: __yield at /Users/jack/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_main.cpp line 56
0x40207a96: EspClass::flashWrite(unsigned int, unsigned int*, unsigned int) at /Users/jack/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/Esp.cpp line 512
0x4020790f: spiffs_hal_write(unsigned int, unsigned int, unsigned char*) at /Users/jack/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/spiffs_hal.cpp line 116
0x4010118a: ppEnqueueRxq at ?? line ?
0x40100f57: ppProcessTxQ at ?? line ?
0x401015f6: pp_post at ?? line ?
0x401048b8: lmacTxFrame at ?? line ?
0x40103ac7: lmacRecycleMPDU at ?? line ?
0x40103f2a: lmacRecycleMPDU at ?? line ?
0x40103a0e: lmacProcessTxSuccess at ?? line ?
0x4010383d: lmacProcessTXStartData at ?? line ?
0x40102973: wDev_ProcessFiq at ?? line ?
0x4010383d: lmacProcessTXStartData at ?? line ?
0x401050e5: ets_timer_disarm at ?? line ?
0x40205435: spiffs_phys_rd at /Users/jack/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/spiffs/spiffs_cache.c line 140
0x40203384: spiffs_obj_lu_scan at /Users/jack/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/spiffs/spiffs_nucleus.c line 941
0x4020557c: spiffs_phys_wr at /Users/jack/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/spiffs/spiffs_cache.c line 204
0x40207a5c: EspClass::flashEraseSector(unsigned int) at /Users/jack/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/Esp.cpp line 508
0x40206bd8: optimistic_yield at /Users/jack/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_main.cpp line 56
0x4020328c: spiffs_erase_block at /Users/jack/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/spiffs/spiffs_nucleus.c line 941
0x4020789c: spiffs_hal_write(unsigned int, unsigned int, unsigned char*) at /Users/jack/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/spiffs_hal.cpp line 102
0x402079e0: spiffs_hal_erase(unsigned int, unsigned int) at /Users/jack/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/spiffs_hal.cpp line 168
0x40201df4: SPIFFS_format at /Users/jack/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/spiffs/spiffs_hydrogen.c line 980
0x402076f2: SPIFFSImpl::format() at /Users/jack/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/spiffs_api.h line 158
0x40207c25: fs::FS::format() at /Users/jack/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/FS.cpp line 251
0x40206584: setup at /Users/jack/Documents/Arduino/sketch_oct31a/sketch_oct31a.ino line 8
0x40206b64: loop_wrapper at /Users/jack/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/core_esp8266_main.cpp line 56
0x40100114: cont_norm at /Users/jack/Library/Arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/cont.S line 109


Should I consider this module a loss, or is there anything I can try to get it behaving normally again?

Re: SPIFFS.format() always fails with WDT Reset

PostPosted: Fri Nov 04, 2016 9:09 am
by jackjansen
Solved it!
It turned out to be a power issue: both with the regulator I used (L78L33) and when powering from USB with an FTDI232 I wasn't supplying enough power to the board (only 100mA). Apparently some ESP-12 just about work with this, and some others fail. Or, actually: partially fail. Writing the flash with the Arduino IDE works (my program got written just fine) but the SPIFFS access patterns apparently take more energy, causing the esp8266 to lose power and behave strangely. I'm now using an LF33CV and everything is fine.