Does the ESP-WROOM-32 and/or the single ESP32 have an EEPROM to save settings, configurations and things like that? I am reading the Datasheet and I cannot find anything about it.
If so, what's the size? Many thanks
ESP-WROOM-32 EEPROOM?
-
- Posts: 9764
- Joined: Thu Nov 26, 2015 4:08 am
Re: ESP-WROOM-32 EEPROOM?
It does not. Closest it has on-chip are one-time-programmable fuses, but there aren't many of them and most of them have a (hard-wired) purpose. The ESP32 normally runs its code from an external flash, however, and this can also be used to store values like you would normally do in an EEPROM. Esp-idf actually has an easy-to-use API for this: https://esp-idf.readthedocs.io/en/lates ... flash.html
Re: ESP-WROOM-32 EEPROOM?
Wow this NVS stuff looks promising. I actually need to store complex structs with a well defined size but I can see there is a blob method which could really help.
What's the max size one can set for the NVS? I can see on nvs_flash.h it says is hard coded to 12KB. Unfortunately I need at least 64KB (I though of buying an external 64K EEPROM). There is another function though:
Not sure how to set the flash layout & partition table to use this! I am currently using Arduino approach to program the ESP32.
What's the max size one can set for the NVS? I can see on nvs_flash.h it says is hard coded to 12KB. Unfortunately I need at least 64KB (I though of buying an external 64K EEPROM). There is another function though:
Code: Select all
/** Initialise NVS flash storage with custom flash sector layout
@param baseSector Flash sector (units of 4096 bytes) offset to start NVS.
@param sectorCount Length (in flash sectors) of NVS region.
@return ESP_OK if flash was successfully initialised.
@note Use this parameter if you're not using the options in menuconfig for
configuring flash layout & partition table.
*/
esp_err_t nvs_flash_init_custom(uint32_t baseSector, uint32_t sectorCount);
Not sure how to set the flash layout & partition table to use this! I am currently using Arduino approach to program the ESP32.
Re: ESP-WROOM-32 EEPROOM?
Max size of a BLOB value which can be written into NVS is 4000 bytes. This value doesn't depend on total partition size.
Also please update your copy of ESP-IDF and check latest documentation nvs_flash_init_custom function has been removed. NVS partition size is defined in partition table now, so you can set the size to anything you like.
Be advised though, NVS design was not optimized for storage of large values. It works better if you break down the struct into individual values and read/write them separately. By "better" I mean "it uses Flash more efficiently", both in terms of utilization (lower amount of space which can't be used for storage), and the number of flash erase cycles. It shouldn't break if you throw a 4000 byte value at it, but if you are dealing with structs of that size, you may be better off using esp_partition_* APIs directly.
Also please update your copy of ESP-IDF and check latest documentation nvs_flash_init_custom function has been removed. NVS partition size is defined in partition table now, so you can set the size to anything you like.
Be advised though, NVS design was not optimized for storage of large values. It works better if you break down the struct into individual values and read/write them separately. By "better" I mean "it uses Flash more efficiently", both in terms of utilization (lower amount of space which can't be used for storage), and the number of flash erase cycles. It shouldn't break if you throw a 4000 byte value at it, but if you are dealing with structs of that size, you may be better off using esp_partition_* APIs directly.
Re: ESP-WROOM-32 EEPROOM?
Oh great thanks for all this info. I will update the ESP-IDF.
With regards to the data structures max limit of 4000 bytes, that's ok I am planning to use close to 64KB in total but in small chunks of info of no more than 200 bytes each. I had already an implementation for an I2C EEPROM so it will be a matter of adapting to this NVS stuff. Should be pretty straight forward.
I will play with this that's for sure. Thanks again.
With regards to the data structures max limit of 4000 bytes, that's ok I am planning to use close to 64KB in total but in small chunks of info of no more than 200 bytes each. I had already an implementation for an I2C EEPROM so it will be a matter of adapting to this NVS stuff. Should be pretty straight forward.
I will play with this that's for sure. Thanks again.
Who is online
Users browsing this forum: No registered users and 191 guests