[GH-ISSUE #1516] OTA Error: Flash Read Failed #1292

Closed
opened 2026-02-28 01:29:27 +03:00 by kerem · 13 comments
Owner

Originally created by @zdzisius on GitHub (Oct 31, 2022).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1516

Hello,
I tried to use this great library to upload a simple text file to flash by update firmware.
Unfortunatelly I got error message: "OTA Error: Flash Read Failed".
I have checked if I am able to write to flash in code using SPIFFS.h library.. and this way works fine..
So my question is if it is a possible to write to flash by using option "update firmware"?

Thanks in advance,
regards

Originally created by @zdzisius on GitHub (Oct 31, 2022). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1516 Hello, I tried to use this great library to upload a simple text file to flash by update firmware. Unfortunatelly I got error message: "OTA Error: Flash Read Failed". I have checked if I am able to write to flash in code using SPIFFS.h library.. and this way works fine.. So my question is if it is a possible to write to flash by using option "update firmware"? Thanks in advance, regards
kerem closed this issue 2026-02-28 01:29:27 +03:00
Author
Owner

@tablatronix commented on GitHub (Oct 31, 2022):

What esp?

<!-- gh-comment-id:1296458322 --> @tablatronix commented on GitHub (Oct 31, 2022): What esp?
Author
Owner

@zdzisius commented on GitHub (Oct 31, 2022):

esp32-wroom-1

<!-- gh-comment-id:1296810999 --> @zdzisius commented on GitHub (Oct 31, 2022): esp32-wroom-1
Author
Owner

@tablatronix commented on GitHub (Oct 31, 2022):

hmm could be wrong flash size set , I use this and it works. I will check again

<!-- gh-comment-id:1297180967 --> @tablatronix commented on GitHub (Oct 31, 2022): hmm could be wrong flash size set , I use this and it works. I will check again
Author
Owner

@zdzisius commented on GitHub (Oct 31, 2022):

I am using Partition scheme with: Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
Is it wrong?

<!-- gh-comment-id:1297350441 --> @zdzisius commented on GitHub (Oct 31, 2022): I am using Partition scheme with: Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) Is it wrong?
Author
Owner

@tablatronix commented on GitHub (Oct 31, 2022):

I think so, try the next or large app, you need equal size of your code to ota, or you need to ota a small sketch first as an intermediate. what does the compiler say about your sketch size?

<!-- gh-comment-id:1297375019 --> @tablatronix commented on GitHub (Oct 31, 2022): I think so, try the next or large app, you need equal size of your code to ota, or you need to ota a small sketch first as an intermediate. what does the compiler say about your sketch size?
Author
Owner

@zdzisius commented on GitHub (Oct 31, 2022):

These are options for Partition scheme:

spiffs

As you can see there is only one option with OTA.

And here are informations from compiler:

`Sketch uses 1184173 bytes (60%) of program storage space. Maximum is 1966080 bytes.
Global variables use 53808 bytes (16%) of dynamic memory, leaving 273872 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.2.1
Serial port COM3
Connecting......
Chip is ESP32-D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00132fff...
Compressed 18912 bytes to 13025...
Writing at 0x00001000... (100 %)
Wrote 18912 bytes (13025 compressed) at 0x00001000 in 0.5 seconds (effective 287.3 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 129...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (129 compressed) at 0x00008000 in 0.1 seconds (effective 299.6 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.2 seconds (effective 410.2 kbit/s)...
Hash of data verified.
Compressed 1189952 bytes to 765489...
Writing at 0x00010000... (2 %)
Writing at 0x00016aac... (4 %)
Writing at 0x0001bd47... (6 %)
Writing at 0x00025b57... (8 %)
Writing at 0x00030e3e... (10 %)
Writing at 0x0003b60c... (12 %)
Writing at 0x00047e32... (14 %)
Writing at 0x00053f6d... (17 %)
Writing at 0x000591b2... (19 %)
Writing at 0x0005e41d... (21 %)
Writing at 0x000631db... (23 %)
Writing at 0x00067fd5... (25 %)
Writing at 0x0006d71b... (27 %)
Writing at 0x00074b09... (29 %)
Writing at 0x0007ac1c... (31 %)
Writing at 0x00080b35... (34 %)
Writing at 0x000869c6... (36 %)
Writing at 0x0008c48c... (38 %)
Writing at 0x000922b9... (40 %)
Writing at 0x00097844... (42 %)
Writing at 0x0009cb15... (44 %)
Writing at 0x000a1e61... (46 %)
Writing at 0x000a703a... (48 %)
Writing at 0x000ac374... (51 %)
Writing at 0x000b13ae... (53 %)
Writing at 0x000b66de... (55 %)
Writing at 0x000bb806... (57 %)
Writing at 0x000c0925... (59 %)
Writing at 0x000c6443... (61 %)
Writing at 0x000cbae0... (63 %)
Writing at 0x000d1081... (65 %)
Writing at 0x000d63e3... (68 %)
Writing at 0x000db76f... (70 %)
Writing at 0x000e0b24... (72 %)
Writing at 0x000e5d46... (74 %)
Writing at 0x000eb3bd... (76 %)
Writing at 0x000f0af1... (78 %)
Writing at 0x000f67d5... (80 %)
Writing at 0x000fc2a1... (82 %)
Writing at 0x00101963... (85 %)
Writing at 0x00109eaf... (87 %)
Writing at 0x001126c3... (89 %)
Writing at 0x0011805f... (91 %)
Writing at 0x0011dde2... (93 %)
Writing at 0x001238ea... (95 %)
Writing at 0x0012902f... (97 %)
Writing at 0x0012e51c... (100 %)
Wrote 1189952 bytes (765489 compressed) at 0x00010000 in 12.2 seconds (effective 777.4 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
`

<!-- gh-comment-id:1297594173 --> @zdzisius commented on GitHub (Oct 31, 2022): These are options for Partition scheme: ![spiffs](https://user-images.githubusercontent.com/26383209/199093528-da0c4ddc-c942-4bca-beda-8c28b018bda2.jpg) As you can see there is only one option with OTA. And here are informations from compiler: `Sketch uses 1184173 bytes (60%) of program storage space. Maximum is 1966080 bytes. Global variables use 53808 bytes (16%) of dynamic memory, leaving 273872 bytes for local variables. Maximum is 327680 bytes. esptool.py v4.2.1 Serial port COM3 Connecting...... Chip is ESP32-D0WDQ6 (revision 1) Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None Crystal is 40MHz Uploading stub... Running stub... Stub running... Changing baud rate to 921600 Changed. Configuring flash size... Flash will be erased from 0x00001000 to 0x00005fff... Flash will be erased from 0x00008000 to 0x00008fff... Flash will be erased from 0x0000e000 to 0x0000ffff... Flash will be erased from 0x00010000 to 0x00132fff... Compressed 18912 bytes to 13025... Writing at 0x00001000... (100 %) Wrote 18912 bytes (13025 compressed) at 0x00001000 in 0.5 seconds (effective 287.3 kbit/s)... Hash of data verified. Compressed 3072 bytes to 129... Writing at 0x00008000... (100 %) Wrote 3072 bytes (129 compressed) at 0x00008000 in 0.1 seconds (effective 299.6 kbit/s)... Hash of data verified. Compressed 8192 bytes to 47... Writing at 0x0000e000... (100 %) Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.2 seconds (effective 410.2 kbit/s)... Hash of data verified. Compressed 1189952 bytes to 765489... Writing at 0x00010000... (2 %) Writing at 0x00016aac... (4 %) Writing at 0x0001bd47... (6 %) Writing at 0x00025b57... (8 %) Writing at 0x00030e3e... (10 %) Writing at 0x0003b60c... (12 %) Writing at 0x00047e32... (14 %) Writing at 0x00053f6d... (17 %) Writing at 0x000591b2... (19 %) Writing at 0x0005e41d... (21 %) Writing at 0x000631db... (23 %) Writing at 0x00067fd5... (25 %) Writing at 0x0006d71b... (27 %) Writing at 0x00074b09... (29 %) Writing at 0x0007ac1c... (31 %) Writing at 0x00080b35... (34 %) Writing at 0x000869c6... (36 %) Writing at 0x0008c48c... (38 %) Writing at 0x000922b9... (40 %) Writing at 0x00097844... (42 %) Writing at 0x0009cb15... (44 %) Writing at 0x000a1e61... (46 %) Writing at 0x000a703a... (48 %) Writing at 0x000ac374... (51 %) Writing at 0x000b13ae... (53 %) Writing at 0x000b66de... (55 %) Writing at 0x000bb806... (57 %) Writing at 0x000c0925... (59 %) Writing at 0x000c6443... (61 %) Writing at 0x000cbae0... (63 %) Writing at 0x000d1081... (65 %) Writing at 0x000d63e3... (68 %) Writing at 0x000db76f... (70 %) Writing at 0x000e0b24... (72 %) Writing at 0x000e5d46... (74 %) Writing at 0x000eb3bd... (76 %) Writing at 0x000f0af1... (78 %) Writing at 0x000f67d5... (80 %) Writing at 0x000fc2a1... (82 %) Writing at 0x00101963... (85 %) Writing at 0x00109eaf... (87 %) Writing at 0x001126c3... (89 %) Writing at 0x0011805f... (91 %) Writing at 0x0011dde2... (93 %) Writing at 0x001238ea... (95 %) Writing at 0x0012902f... (97 %) Writing at 0x0012e51c... (100 %) Wrote 1189952 bytes (765489 compressed) at 0x00010000 in 12.2 seconds (effective 777.4 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin... `
Author
Owner

@tablatronix commented on GitHub (Oct 31, 2022):

You need 50% for ota, try huge app. Your sketch might be too big for ota and spiffs

<!-- gh-comment-id:1297615646 --> @tablatronix commented on GitHub (Oct 31, 2022): You need 50% for ota, try huge app. Your sketch might be too big for ota and spiffs
Author
Owner

@zdzisius commented on GitHub (Oct 31, 2022):

Something has changed.. instead of showing error esp32 is restarting while updating.. I don't know if it is a normal behavior.. but later on I tried to check if any new file is stored in flash with this code:

`File root = SPIFFS.open("/");
File file = root.openNextFile();

    //list of files on flash
    while (file) {
      Serial.print("FILE: ");
      Serial.println(file.name());
      file = root.openNextFile();
    }`  

but unfortunately, nothing is listed...

<!-- gh-comment-id:1297676790 --> @zdzisius commented on GitHub (Oct 31, 2022): Something has changed.. instead of showing error esp32 is restarting while updating.. I don't know if it is a normal behavior.. but later on I tried to check if any new file is stored in flash with this code: `File root = SPIFFS.open("/"); File file = root.openNextFile(); //list of files on flash while (file) { Serial.print("FILE: "); Serial.println(file.name()); file = root.openNextFile(); }` but unfortunately, nothing is listed...
Author
Owner

@zdzisius commented on GitHub (Nov 3, 2022):

Maybe there is a misunderstanding here..
My question was if it is possible to upload a simple file with text inside via update firmware option (e.g. test.txt) that could be read in code?

<!-- gh-comment-id:1302124375 --> @zdzisius commented on GitHub (Nov 3, 2022): Maybe there is a misunderstanding here.. My question was if it is possible to upload a simple file with text inside via update firmware option (e.g. test.txt) that could be read in code?
Author
Owner

@tablatronix commented on GitHub (Nov 3, 2022):

ohhh, update firmware it for updating firmware...
you want httpupload, you can probably add it in your own code using the wm webserver object.

you want httpupload file save to littlefs, might have to string a couple examples togather to get there, check esp examples or an arduino forum

<!-- gh-comment-id:1302516214 --> @tablatronix commented on GitHub (Nov 3, 2022): ohhh, update firmware it for updating firmware... you want httpupload, you can probably add it in your own code using the wm webserver object. you want httpupload file save to littlefs, might have to string a couple examples togather to get there, check esp examples or an arduino forum
Author
Owner

@tablatronix commented on GitHub (Nov 11, 2022):

Did you figure it out, would probably make a good addition to the exmaples

<!-- gh-comment-id:1311096788 --> @tablatronix commented on GitHub (Nov 11, 2022): Did you figure it out, would probably make a good addition to the exmaples
Author
Owner

@zdzisius commented on GitHub (Feb 3, 2023):

Hi, sorry.. I've just noticed that you asked.. and yes, I resolved the issue by changing flash mode in the ide: tools -> flash mode -> DIO

<!-- gh-comment-id:1416362425 --> @zdzisius commented on GitHub (Feb 3, 2023): Hi, sorry.. I've just noticed that you asked.. and yes, I resolved the issue by changing flash mode in the ide: tools -> flash mode -> DIO
Author
Owner

@Duc-automation commented on GitHub (Jul 29, 2025):

Hi, sorry.. I've just noticed that you asked.. and yes, I resolved the issue by changing flash mode in the ide: tools -> flash mode -> DIO

problem solved.

if anyone using platformio, add this into platformio.ini:

board_build.partitions = default_ota.csv 
board_build.flash_mode = dio

with default_ota.csv file create in same platformio.ini folder:

# Name,   Type, SubType, Offset,  Size,     Flags
nvs,      data, nvs,     0x9000,  0x5000,
otadata,  data, ota,     0xe000,  0x2000,
app0,     app,  ota_0,   0x10000, 0x140000,
app1,     app,  ota_1,   0x150000,0x140000,
spiffs,   data, spiffs,  0x290000,0x170000

Adruino IDE should config as same for Flashmode and Patition Scheme
Thank you!

<!-- gh-comment-id:3132430460 --> @Duc-automation commented on GitHub (Jul 29, 2025): > Hi, sorry.. I've just noticed that you asked.. and yes, I resolved the issue by changing flash mode in the ide: tools -> flash mode -> DIO problem solved. if anyone using platformio, add this into platformio.ini: ``` board_build.partitions = default_ota.csv board_build.flash_mode = dio ``` with default_ota.csv file create in same platformio.ini folder: ``` # Name, Type, SubType, Offset, Size, Flags nvs, data, nvs, 0x9000, 0x5000, otadata, data, ota, 0xe000, 0x2000, app0, app, ota_0, 0x10000, 0x140000, app1, app, ota_1, 0x150000,0x140000, spiffs, data, spiffs, 0x290000,0x170000 ``` Adruino IDE should config as same for Flashmode and Patition Scheme Thank you!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#1292
No description provided.