ESP32-S3 NVS not working correctly

Niklas Sommer
Posts: 7
Joined: Fri Oct 07, 2022 10:25 am

ESP32-S3 NVS not working correctly

Postby Niklas Sommer » Sun Jan 15, 2023 8:33 pm

I've recently switched from an ESP32-C3 to and ESP32-S3 on my custom board and now the NVS storage is broken?

In setup() I'm calling:

Code: Select all

    Preferences Flash;

    if(Flash.begin(NVS_CONFIG_DIR))
    {
        Flash.putInt(NVS_CONFIG_TYPE_KEY, 2);
        Flash.putString(NVS_CONFIG_NAME_KEY, "ESP32-S3-01");

        Flash.end();
    }
This works fine. No errors.

Somewhere later I'm calling:

Code: Select all

    Preferences Flash;
    uint8_t Buf[128];
    if(Flash.begin(NVS_CONFIG_DIR, true))
    {
        int Length = Flash.getString(NVS_CONFIG_NAME_KEY, (char*)&Buf[0], 128);
        int Type = Flash.getInt(NVS_CONFIG_TYPE_KEY);
    
        Flash.end();
    }
This gives following errors:

Code: Select all

[  2464][E][Preferences.cpp:460] getString(): nvs_get_str len fail: Testt NOT_FOUND
[  2465][V][Preferences.cpp:388] getInt(): nvs_get_i32 fail: Type NOT_FOUND
The keys apparently don't exist although I saved them in setup().

This all worked perfectly fine on ESP32-C3.

I'm using PlatformIO in VSCode and arduino as the framework.

Niklas Sommer
Posts: 7
Joined: Fri Oct 07, 2022 10:25 am

Re: ESP32-S3 NVS not working correctly

Postby Niklas Sommer » Mon Jan 16, 2023 3:49 pm

Well I switched out the platform from

Code: Select all

platform = espressif32
to

Code: Select all

platform = https://github.com/platformio/platform-espressif32.git
and then I switched back to the first one and now it works.
No idea what's going on.

Who is online

Users browsing this forum: No registered users and 48 guests