Page 1 of 1

How to set ware levelling Safety mode in Arduino ESP add on

Posted: Thu Oct 24, 2019 8:59 am
by drmpf321
I found the
#if CONFIG_WL_SECTOR_MODE == 1
in esp-idf wear_levelling.cpp

but a search of ESP 1.0.2 package for Arduino does not include this define.

How can I set Safety mode for ware levelling in the Arduino ESP32 add on?

Re: How to set ware levelling Safety mode in Arduino ESP add on

Posted: Thu Oct 24, 2019 1:57 pm
by idahowalker
I guess you are refering to the https://docs.espressif.com/projects/esp ... lling.html Wear Leveling API? The examples are not helping?

Re: How to set ware levelling Safety mode in Arduino ESP add on

Posted: Thu Oct 24, 2019 10:42 pm
by drmpf321
I am using the Arduino IDE ESP32 add on V1.0.2.
A search of the code supplied with that package does not find CONFIG_WL_SECTOR_MODE which sets the performance/safe leveling when the sector size is 512, so I cannot change the from the default Performance setting in this case, the SD case.

I dug a bit deeper into esp-idf/components/wear_levelling/wear_levelling.cpp
and found that CONFIG_WL_SECTOR_SIZE sets the wl_flash object

I found
#define CONFIG_WL_SECTOR_SIZE 4096
in the Arduino ESP32 package in sdkconfig.h

so looking at the wear_levelling.cpp code is seems that the wl_flash object is WL_Flash();
as opposed to WL_Ext_Safe(); or WL_Ext_Perf(); when the CONFIG_WL_SECTOR_SIZE is 512.

So does that mean for CONFIG_WL_SECTOR_SIZE 4096 , i.e. the onboard flash IC, that the wear leveling is ALWAYS safe?

Re: How to set ware levelling Safety mode in Arduino ESP add on

Posted: Sun Oct 27, 2019 3:10 pm
by idahowalker
After a bit of searching, wear leveling is part of the ESP32 API's.

Re: How to set ware levelling Safety mode in Arduino ESP add on

Posted: Sun Oct 27, 2019 3:33 pm
by lbernstone
Safety mode will be introduced in ESP-IDF v4.0. Arduino-esp32 v1.0.4 uses IDF v3.2. When v4.0 is released and stable, arduino will update to that upstream version. However, using an advanced feature like this will always require you to compile your own libraries. There are no guarantees that all the arduino libraries will be compatible with safety mode (I think FFat should work).
https://github.com/espressif/arduino-es ... mponent.md
https://github.com/espressif/esp32-ardu ... ster/tools