-
Notifications
You must be signed in to change notification settings - Fork 7.6k
EEPROMClass::begin(4096) truncate size fails when previously set to 8Kb #5831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Your NVS partition is out of space. Read through #4551 to see how to use a custom partitions.csv to increase the size of your nvs. |
I am not getting it, the nvs is 20Kb. What is the overhead/limitation of EEPROM to use the most of the nvs? Preferences library is a good hint, thanks. I try it, but have to check init time. I used to use SIPFF, but takes 0.5sec to init at boot, what was slow for my needs. |
EEPROM is using NVS, so Preferences can't be any longer to init than that. |
Thanks a lot. Makes sense now. I tested Preferences library. Init is super fast (<1ms) in comparison with SPIFFS (~500ms). putString also fast, 1-2ms. If I understand EEPROM, it opens a 4K blob, copies to memory. Commit stores the whole 4K to NVS. That sounds a lot slower than using separate namespaces and keys. |
Preferences will also be able to take advantage of the lazy nature of the flash. This means that if you are writing just a few bytes to a key entry, it will find empty space, write those few bytes and update the index to point at the new data. No erases needed. Writing to EEPROM, particularly if it is 4096+ bytes, will require a write of the whole sector(s), and at least one erase. |
Thanks for the lot of info. Learnt a lot. |
I have tried to set the EEPROM size to 8K, but failed. I guess it is maximized to 4K?
Nevertheless when I set to 4K again, EEPROM.begin(4096) failed to truncate it back from 8K->4K.
In EEPROM.cpp:
bool EEPROMClass::begin(size_t size)
It tries to truncate, but these functions fail with ESP_ERR_NVS_NOT_ENOUGH_SPACE:
nvs_get_blob(_handle, _name, key_data, &key_size);
nvs_set_blob(_handle, _name, key_data, size);
nvs_commit(_handle);
I had to erase the whole chip as workaround. But I think truncate should have worked.
The text was updated successfully, but these errors were encountered: