Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By gmag11
#36351 That's true but, as for his comments, I guess he's not going to write always in the same memory position, but sequentially until EPROMs is full so you have to multiply by n times, being n eEPROM size/bytes by sample.

If this is not right another possibility is adding a SD card. I don't know if SD library is compatible with esp8266.
User avatar
By lethe
#36367
gmag11 wrote:That's true but, as for his comments, I guess he's not going to write always in the same memory position, but sequentially until EPROMs is full so you have to multiply by n times, being n eEPROM size/bytes by sample.


That would be true, if the ESP actually had EEPROM. However it does not. The EEPROM library is implemented using a sector of the SPI flash chip attached to the ESP.
With (NOR) flash memory, a write operation can only flip 1 bits to 0. To flip 0 back to 1, you need to perform an erase, which can only be performed for entire 4kB sectors.
The EEPROM library therefore reads the sector to RAM and it the content is modified, it performs an erase before it writes the content. Since this is performed on the same sector each time, a typical flash chip specced at 100,000 erase cycles/sector will wear out in less than 12 days.

A better implementation would be to use the SPI flash directly, and only perform an erase, when the 4kB sector is full.
You can do that by prefixing your data with a "magic byte" (!= 0xFF), so you can search for the last occurance of that magic byte within the sector and append new data without performing an erase. If you write 8bytes every 10s, a flash sector should last 16years that way.
Last edited by lethe on Mon May 16, 2016 9:57 pm, edited 1 time in total.