SPIFFS upload OTA results in spiffs mount failed

Some background info:

Flash Size: 4 MB
SPIFFS Flash: 1.5MB
Uploaded SPIFF .bin size: 1.3MB

I use MKSPIFFS to generate the .bin file using the following:

-b 4096
-s 0x13D620
-p 256

i.e. 4096 block, 1.3mb, 256 page

I have been able to fetch a SPIFFS .bin file with HttpUpdate updateSPIFFS (from [here])(arduino-esp32/libraries/HTTPUpdate at master · espressif/arduino-esp32 · GitHub). Once I receive a HTTP_UPDATE_OK response, I list all files:

void listAllFiles(){
 
  File root = SPIFFS.open("/");
 
  File file = root.openNextFile();
 
  while(file){
 
      Serial.print("FILE: ");
      Serial.println(file.name());
 
      file = root.openNextFile();
  }if(!file){
    Serial.println("no files found");
  }
 
}

I have tried using different mkspiffs parameters such as changing the block size, overall size, etc but to no avail e.g. when i click upload ESP32 Sketch Data Upload, it states the size is 1408 so I have also tried generating a 1.4mb .bin but of course I get a space error.

SPIFFS mounts successfully on initial boot - but once the spiffs .bin is uploaded and the board restarts, i sometimes get a SPIFFS: mount failed, -10025 message, which requires a few more restarts for a successful mount.

I have no idea what is going on... the SPIFFS image is clearly being written successfully for the listFiles function to be able to find the new files, but once rebooted, they go.

So far, the ESP32 Sketch Upload is uploading and saving the spiff data correctly - but this is not what I need

edit: i get the file and upload to spiffs using this method from the library above:

t_httpUpdate_return ret = ESPhttpUpdate.updateSpiffs(fwImageURL);

where fwImageURL is the URL where my spiffs .bin image is

After uploading my SPIFFS file, I of course see the new files being listed but then I use

 int tBytes = SPIFFS.totalBytes(); 
  int uBytes = SPIFFS.usedBytes();
  Serial.print("Total SPIFFS bytes = ");
  Serial.println(tBytes);
  Serial.print("Used SPIFFS bytes = ");
  Serial.println(uBytes);
  Serial.print("Free SPIFFS bytes = ");
  Serial.println(tBytes - uBytes);

to see if the spiff bytes are being used but it just returns:

 09:50:22.875 -> Total SPIFFS bytes = 1318001
   09:50:22.875 -> Used SPIFFS bytes = 0
   09:50:22.875 -> Free SPIFFS bytes = 1318001

which suggests its not really going into spiffs, but then how are the files being listed?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.