Page 1 of 1
What happens when embed flash's write limit is reached?
Posted: Tue Feb 20, 2024 4:48 pm
by qheinal
I have esp32 s2 mini dev board with embed psram and flash. I was wondering if the microcontroller would still be usable in that edge case because i constantly update code with those microcontrollers. On my Esp32 s3 and esp32 the flash memory is external so its easy to just replace the flash chip but on the s2 its all internal. Like for example can it still boot from external flash connected to vspi or hspi even though its internal flash is "Write only dead" since flash has no read limit.
Re: What happens when embed flash's write limit is reached?
Posted: Wed Feb 21, 2024 12:59 am
by ESP_Sprite
It would likely not. Worn-out flash, to my knowledge, results in bits not being properly erased anymore, that is, they will always stay 0 even if you need them to be 1. This would result in a corrupted flash image, and the ESP32 will refuse to boot that.
Good thing is that the flash internal to ESP32 chips is generally rated for 100000 writes (actually: erase cycles) or more, so you generally don't reach that limit by simply doing a lot of development work.
Re: What happens when embed flash's write limit is reached?
Posted: Sun Feb 25, 2024 1:29 am
by qheinal
Yeh but i was writing to the normal Esp32 and it started to give checksum errors after maybe hundreds of writes. Had to erase entire flash to fix it. But then the normal esp32s flash is external so it would be easy to replace. However if the s2 mini will be a brick after embed flash dies then it isn't really worth buying. Might be better to get them with only embed psram but with External flash.
Re: What happens when embed flash's write limit is reached?
Posted: Sun Feb 25, 2024 9:44 am
by ESP_Sprite
If a full erase 'fixes' the write errors, it's not a wear issue. I think you may have been doing something wrong. Were you using some API in your program to write to flash? If so, were you aware that a write can only flip bits from 1 to 0 and not the other way around? (You need an erase for that.)
Re: What happens when embed flash's write limit is reached?
Posted: Mon Feb 26, 2024 10:15 am
by MicroController
Digging a bit into NOR flash failure modes, I found
this interesting document.
Apparently, the 'stuck at 0 after erase' failure mode can be somewhat 'self-healing' if cells are allowed a 'rest period' of a few seconds between erase and write. And: Repeated writes to the same 'row' of flash can disturb (i.e. inadvertently program) adjacent cells, to which the fix is to erase and re-program those cells.
That said, before assuming a flash failure you may want to first check if there's an issue in your code which either a) writes to an incorrect location, b) writes to a location which was not previously erased, or c) writes the 'wrong' data.
Re: What happens when embed flash's write limit is reached?
Posted: Wed Feb 28, 2024 4:26 pm
by qheinal
No i wasn't modifying flash. This only occurred from flashing esp32 a ton of times. I had disabled the option to erase ENTIRE flash every time it uploads. BUT only when i enabled it did the checksum error go away.
Re: What happens when embed flash's write limit is reached?
Posted: Fri Mar 01, 2024 3:42 am
by ESP_Sprite
How specifically do you flash your ESP?
Re: What happens when embed flash's write limit is reached?
Posted: Sun Mar 03, 2024 2:09 am
by qheinal
With arduino ide default settings. Except changed partition style to huge app.
Re: What happens when embed flash's write limit is reached?
Posted: Sun Mar 03, 2024 3:58 am
by ESP_Sprite
Do you have anything connected to GPIO45?
Re: What happens when embed flash's write limit is reached?
Posted: Thu Mar 07, 2024 2:13 am
by qheinal
gpio45 is not broken out on esp32 dev kit