Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By cal
#20809 I think this discussion describes my thoughts pretty well:

http://electronics.stackexchange.com/qu ... d-of-flash

Flash is a special kind of EEPROM but not all EEProms are flash.
You can typically erase single bytes instead of pages in non flash EEPROMs.
The number of erase cycles is typically an order of magnitude higher for non flash EEPROMs.

If someone writes code with those assumptions on the esp8266 by changing small ranges he might be surprised
that a whole page is erased/rewritten and that all bytes in that page will get an erase cycle
as I understand it.

Cal
User avatar
By tytower
#20857 Hi Cal I thought to read up a bit more and notice this chip has various sizes of EEPROM and its noted as having SPIFFS .I DuckDucked it and found it interesting . I will have to get to know more about its uses and how we can manipulate memory and variables on it

INTRODUCTION

Spiffs is a file system intended for SPI NOR flash devices on embedded targets.

Spiffs is designed with following characteristics in mind:
- Small (embedded) targets, sparse RAM without heap
- Only big areas of data (blocks) can be erased
- An erase will reset all bits in block to ones
- Writing pulls one to zeroes
- Zeroes can only be pulled to ones by erase
- Wear leveling


* FEATURES

What spiffs does do :
- Specifically designed for low ram usage
- Uses statically sized ram buffers, independent of number of files
- Posix-like api: open, close, read, write, seek, stat, etc
- It can be run on any NOR flash, not only SPI flash - theoretically also on
embedded flash of an microprocessor
- Multiple spiffs configurations can be run on same target - and even on same
SPI flash device
- Implements static wear leveling
- Built in file system consistency checks

What spiffs does not do :
- Presently, spiffs does not support directories. It produces a flat
structure. Creating a file with path "tmp/myfile.txt" will create a file
called "tmp/myfile.txt" instead of a "myfile.txt" under directory "tmp".
- It is not a realtime stack. One write operation might take much longer than
another.
- Poor scalability. Spiffs is intended for small memory devices - the normal
sizes for SPI flashes. Going beyond ~128MB is probably a bad idea. This is
a side effect of the design goal to use as little ram as possible.
- Presently, it does not detect or handle bad blocks.


I see on the 4M chip SPIFFS is at 3M
User avatar
By tytower
#20957 I see on the Arduino boards its easy to shove something into EEPROM and restore it or retieve it later . My impression is that you could store your SSID and your Password there . Each address is limited to 0-255 value so alpha characters would have to be converted. You can use it like an array and it stays when the chip reboots so its very useful it seems .

Plenty of examples in the Arduino IDE . Now I notice too that the ESP8266 also has the library EEPROM in .arduino/preferences .txt with read write and clear so easy to get in and it would be persistent on a reset say after deepSleep().