Runtime crash when SPIFFS included in PIO build

I get the following error when I run code built by PIO (w/VSC). I don’t get any issue when running the same code (single main.cpp) built by Arduino IDE.

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

ets_main.c

PIO code (Arduino IDE code excludes “include <Arduino.h>”):

#include <Arduino.h>
#include <FS.h>

void setup() {
SPIFFS.format();
}

void loop() {
}

  • ESP8266 version in the Arduino IDE’s pacakge manager?
  • Arduino IDE settings for the board?
  • latest PlatformIO version?
  • used platformio.ini?

hi maxgerhardt,

I’ve also found the issue only occurs on my ESP8266MOD with external antenna (ESP-07?) see https://photos.app.goo.gl/Qz3RYojtUBT2SpBX8, however, ESP8266MOD with internal antenna (different vendor) works.

I don’t know how to find the ESP8266 version in the Arduino IDE’s package manager.

Arduino IDE setings:
10

PIO version: Home 2.0.2 / Core 3.6.6

platformio.ini

[env:esp12e]
platform = espressif8266
board = esp12e
framework = arduino

monitor_speed = 74880

Arduino IDE: Tools -> Board (menu) -> Boards Manager (wait for it to load and then scroll down for the ESP8266 package) …Looks like a relatively recent version though from the board options available…

PlatformIO: PIO Home icon (in the statusbar at the bottom) -> Platforms -> Espressif 8266 (version listed on the right)

May try running something the below code on the two boards and see if there is anything different (other than ID) of any importance… maybe they have different flash chip sizes, speeds, modes?

void setup() {
 
  Serial.begin(115200);
  Serial.println();
 
  Serial.print("Chip ID: ");
  Serial.println(ESP.getFlashChipId());
 
  Serial.print("Chip Real Size: ");
  Serial.println(ESP.getFlashChipRealSize());
 
  Serial.print("Chip Size: ");
  Serial.println(ESP.getFlashChipSize());
 
  Serial.print("Chip Speed: ");
  Serial.println(ESP.getFlashChipSpeed());
 
  Serial.print("Chip Mode: ");
  Serial.println(ESP.getFlashChipMode());
}

void loop() {
}
1 Like

Thank you maxgerhardt I’m now wiser.

Running your code showed a smaller Real Size (1M) than Size (4M), while the working board had the same Sizes (4M). So I assume this was not causing a problem until I was accessing memory >1MB.

After changing the target Board in PIO to one with a 1M ROM I can run the code and access SPIFFS.

1 Like

Ouch! Well, that was rude… 1M instead of 4M!!! That’ll make OTA updates… interesting… if you intend to use OTA updates and have lots of code or a decent SPIFF data partition… :frowning: Glad it’s working for you now! :smiley:

1 Like