The EEPROM of ESP32S3 is virtualized by FLASH. Does erasing EEPROM directly in Arduino IDE automatically perform wear leveling at the underlying level?
When using ESP32S3 to create a device with a counter function, I want to save data during power-off, so I need to save it once when a counting event occurs. Approximately 2000 saves per day. Using EEPROM with the Arduino framework + FreeRTOS development will be much more convenient. If wear leveling can be automatically performed at the underlying level, it will save a lot of trouble.
Does EEPROM automatically perform wear leveling?
-
- Posts: 5
- Joined: Tue Sep 26, 2023 6:40 am
-
- Posts: 9764
- Joined: Thu Nov 26, 2015 4:08 am
Re: Does EEPROM automatically perform wear leveling?
Probably better to use the Preferences library, EEPROM is a bit clunky. That maps to the NVS functionality of ESP-IDF, which indeed implements wear-leveling ref.
-
- Posts: 829
- Joined: Mon Jul 22, 2019 3:20 pm
Re: Does EEPROM automatically perform wear leveling?
Both EEPROM and Preferences will use wear levelling, since they both use nvs as their backend. Preferences is faster, easier to use, and overall more suitable if you don't need arduino portable code.
Note that using the IDE to erase the flash is one way that specifically sidesteps wear levelling. You are wiping the disk and writing back to it in exactly the same place. With the rate that I code, I don't find that to be an issue.
Note that using the IDE to erase the flash is one way that specifically sidesteps wear levelling. You are wiping the disk and writing back to it in exactly the same place. With the rate that I code, I don't find that to be an issue.
-
- Posts: 5
- Joined: Tue Sep 26, 2023 6:40 am
Re: Does EEPROM automatically perform wear leveling?
Thank you, I will go learn about the Preferences library.lbernstone wrote: ↑Sun Oct 29, 2023 1:06 amBoth EEPROM and Preferences will use wear levelling, since they both use nvs as their backend. Preferences is faster, easier to use, and overall more suitable if you don't need arduino portable code.
Note that using the IDE to erase the flash is one way that specifically sidesteps wear levelling. You are wiping the disk and writing back to it in exactly the same place. With the rate that I code, I don't find that to be an issue.
-
- Posts: 5
- Joined: Tue Sep 26, 2023 6:40 am
Re: Does EEPROM automatically perform wear leveling?
Thank you, I will go learn about the Preferences library.ESP_Sprite wrote: ↑Sun Oct 29, 2023 12:25 amProbably better to use the Preferences library, EEPROM is a bit clunky. That maps to the NVS functionality of ESP-IDF, which indeed implements wear-leveling ref.
-
- Posts: 829
- Joined: Mon Jul 22, 2019 3:20 pm
Re: Does EEPROM automatically perform wear leveling?
Just one more comment about wear leveling. You are writing into a partition with a fixed size. You get a finite amount of writes to each sector in that space. If you make the space larger, you get more writes. You can make a custom partition scheme (https://docs.espressif.com/projects/ard ... ion-scheme) with an expanded nvs partition if you need increased disk durability.
Who is online
Users browsing this forum: No registered users and 112 guests