Which EEPROM am I using?

I've wired up an ESP8266 (WeMos Mini) and have been making use of the module's "built in" EEPROM.

The docs are unclear on how this magic works, as there isn't an actual EEPROM chip anywhere, but I think it uses some the flash code space as "EEPROM" space.

However they do it, it works. Write to "EEPROM", remove power, data is retained.

Later, I added an DS3231 RTC with an actual 24C32 EEPROM (the cheap module found everywhere).

My question is, when I use EEPROM.read (or .write or .get or .put), which EEPROM am I writing to?

I'd LIKE to use both, as there's two versions of the project, one with RTC and one without. Both versions of the project store ESP8266 initialization data, but only the version with the RTC module stores RTC data.

Is this possible? Can I use both? If so, how?

Thanks in advance.

Alan

As you suspected it uses a sector of the regular flash. Reference.

alan-bc:
My question is, when I use EEPROM.read (or .write or .get or .put), which EEPROM am I writing to?

The pseudo-EEPROM of the ESP8266’s flash memory.

alan-bc:
Is this possible? Can I use both? If so, how?

Yes.
Yes.
You can’t use the EEPROM library to use the 24C32. Arduino libraries are available that provide an easy interface to this external EEPROM. Or you can write your own lower level code to do that same if you prefer.

If you using an esp8266 why are you using EEPROM? SPIFFS is a better solution.

If you using an esp8266 why are you using EEPROM? SPIFFS is a better solution.

There is something to be said for both, depending on the circumstances. Why would you store a file including it's path etc, for just a few bytes for instance ?

Proietti:
If you using an esp8266 why are you using EEPROM? SPIFFS is a better solution.

I am storing 4 things in the ESP8266 EEPROM;

  1. the name of the SSID (if the user decides he doesn't like the default name),
  2. a password for the network (again, if the user decides he needs one, which, given the use, he may not),
  3. a unique flag (A5A55A5A) to indicate that the user has indeed set the SSID, and
  4. a second unique flag to indicate that the user has set a password

It didn't seem necessary to use any code more complicated than EEPROM.x to read or write four short strings.

pert:
Or you can write your own lower level code to do that same if you prefer.

Thanks for the reply!

Sadly, I think this is what I'll have to do, as I can't find an I2C library as .. full featured .. as the stock EEPROM library.

I'm a new Arduino user, after being a long time (40+ years) assembly language programmer, for big chips and small. I'm used to writing my own libraries and I guess I've gotten spoiled with all these Arduino libraries.

In the old days .. aka, last year .. I often had to write the "tools" before writing the program. Now, I can get to work on the fun bits right away, which is kinda nice.

Have a look at WiFi manager library. That does exactly what you have just described