EEPROM usage in combination with OTA

I have read on one comment (from Pete) that OTA/Edgent uses EEPROM addresses to store auth-code and WiFi parameters. Does this mean that

  • I can not use OTA when the application makes use of EEPROM data
    OR
  • is there a range of EEPROM addresses that I can use so there is no conflict with the OTA process?

I am using Arduino IDE on ESP32 dev module

OTA doesn’t use EEPROM, but Edgent does.

You should read this…

Pete.

That is why I couldn’t find this post probably (I was looking for combination of OTA and EEPROM). Thanks for pointing this out Pete, I am not an expert and am just learning to use OTA. It does work very good for my devices that do not use EEPROM. It is a nice feature! Love it!

I have been looking in the configStore.h in my application but I do not find any reference to the use of EEPROM. (However I do not fully understand the code to see where it does store the configuration data.)
This is the code I find in my configStore.h for the config_load() function:

void config_load()
{
  Preferences prefs;
  if (prefs.begin("blynk", true)) { // read-only
    memset(&configStore, 0, sizeof(configStore));
    prefs.getBytes("config", &configStore, sizeof(configStore));
    if (configStore.magic != configDefault.magic) {
      DEBUG_PRINT("Using default config.");
      configStore = configDefault;
    }
  } else {
    DEBUG_PRINT("Config read failed");
  }
}

Did anything change since this post you refer to? (which shows a different config_load version including EEPROM references)

Maybe, I’m not sure. You could look at previous versions on GitHub I guess.

Moving the start of the configstore forward by 2k rather than starting at zero (assuming that’s enough for your data) seems straightforward though.

Your previous comments make it sound like you’re really looking for Blynk.Air OTA functionality rather than the dynamic provisioning that Edgent gives. If that’s the case then there are much easier ways of doing Blynk.Air.

Also, you need to be very careful with EEPROM. Each memory location is good for about 100k write operations on average, before you kill that memoey location.
You’re normally better storing your data on the Blynk server rather than in EEPROM, or using SPIFFS/LittleFS instead.

Pete.

Thanks Pete, I will certainly look into this further. I came across “SPIFFS” several times now, I think I need to start looking into it!
Also Blynk.Air I need to look into obviously. I only used Edgent in combination with OTA because that is what I learned from existing examples I found on the internet.
Storing data on the Blynk server also seems a much
better alternative for EEPROM.
A lot to learn yet, but that keeps it interesting :wink:
Thanks for all these suggestions,
Jan.

If you just want OTA then take a look at this…

To store data on the Blynk server then simply write the data to a virtual pin, instead of to EEPROM, then retrieve it using Blynk.syncVirtual(vPin) within the BLYNK_CONNECTED() function.

Pete.

Thanks a lot Pete this helps a lot!
I have a lot to work on now :wink:
Regards,
Jan.

1 Like