0

I am trying to store text file into SPIFFS memory. I get an error whenever I try to format or to write file into SPIFFS.

Here is the code to format the SPIFFS.

#include<FS.h>


void setup() {
  Serial.begin(9600);
  SPIFFS.begin();
  delay(1000);
  Serial.println("Beggining format");
  if(SPIFFS.format()){
    Serial.println("Format complete");
  }
  else{
    Serial.println("unable to Format");
  }
  // put your setup code here, to run once:

}

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

}

I did search online in other forums regarding this error. I came accross this github discussion regarding the error. https://github.com/esp8266/Arduino/issues/4061 I did run the code suggested in this link to obtain the device ID.

Firmware: Chip Id: 000E01E5
Core version: 2_7_0
SDK version:2.2.2-dev(38a443e)
Boot version: 5
Boot mode: 1


Flash chip information: Flash chip Id: 00146085 (for example: Id=001640E0 Manuf=E0, Device=4016 (swap bytes))
Sketch thinks Flash RAM is size: 1.00 MB Actual size based on chip Id: 1.00 MB Flash frequency: 40.00 MHz
Flash write mode: DIO


File system (SPIFFS):
Total KB: 4176892.00 KB Used KB: 4176892.00 KB Block size: 8192
Page size: 256
Maximum open files: 5 Maximum path length: 32

SPIFFS directory {/} :


CPU frequency: 80 MHz

###############file open failed

In the output I see that: File system (SPIFFS): Total KB: 4176892.00 KB Used KB: 4176892.00 KB

I don't understand this. Can someone help me understand this? So that I can upload file to SPIFFS?

  • Try the following: In the dir of your sketch create a dir called data and place a *.txt file in it. Choose a 1- 2MB SPIFFS configuration fromTools ) e.g. SPIFFS/small App/ NO-OTA depending on your board Upload sketch and afterwards upload data with Tools->ESP8266 sketch data upload. If there is an error message post it in your edited question – Codebreaker007 May 07 '20 at 10:35
  • windows doesn't allow me to create *.txt in the data dir – Amrutha B V May 07 '20 at 13:33
  • Error message: Arduino: 1.8.12 (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), dtr (aka nodemcu), 26 MHz, 40MHz, DIO, 1MB (FS:none OTA:~502KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200" SPIFFS Not Defined for Generic ESP8266 Module, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), dtr (aka nodemcu), 26 MHz, 40MHz, DIO, 1MB (FS:none OTA:~502KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200 – Amrutha B V May 07 '20 at 14:14
  • Read [this](http://arduino.esp8266.com/Arduino/versions/2.0.0/doc/filesystem.html) first. You probably didn't setup/configure the SPIFFS correctly. What do you mean windows windows doesn't allow you to create *.txt file in data/ directory? Can you create a .txt on your desktop and copy it into the directory? What is the directory's permission setup? – hcheung May 07 '20 at 14:21
  • I mean to say i cannot name file with * , windows doesn't perrmit me to do that. I named file as example.txt – Amrutha B V May 07 '20 at 14:25
  • Yes *.txt means any text file so example.txt is ok - but from your system message you have noSPIFFS partition **FS:none** OTA:~502KB means NO FileSystem so create one Read the errormessageit says Only Sketch, 115200" SPIFFS Not Defined for Generic ESP8266 Module! – Codebreaker007 May 07 '20 at 16:57
  • Thanks!! I had selected wrong Flash type. File uploaded after I selected the right flash. Thanks for your support. – Amrutha B V May 07 '20 at 17:19

0 Answers0