Using the new NVS multi-page BLOBs

Oromis
Posts: 21
Joined: Mon Sep 25, 2017 1:44 pm

Using the new NVS multi-page BLOBs

Postby Oromis » Wed Jan 23, 2019 5:11 pm

I just saw that 3.1.1 introduced a new feature called "multi-page BLOBs" (CONFIG_MP_BLOB_SUPPORT). I need such a feature (at the moment, I split a certificate file into multiple BLOBs at application level to get around the 1984 bytes limit), so I enabled the option.

Unfortunately, a simple test program that would just write 2k bytes to a BLOB, commit and then try to read it back fails with ESP_ERR_NVS_VALUE_TOO_LONG during nvs_set_blob(). Saving and reading 1900 bytes works just fine. The constant CONFIG_MP_BLOB_SUPPORT is defined with value "1", so it would seem that the option is enabled.

Is there some secret ingredient that needs to be changed to make multi-page BLOBs work? Is there an example snippet outlining its use?

Thanks a lot in advance!

ESP_sagar
Posts: 9
Joined: Mon Nov 19, 2018 9:55 am

Re: Using the new NVS multi-page BLOBs

Postby ESP_sagar » Thu Jan 31, 2019 11:49 am

@Oromis,
Thank you for trying this feature! However, I am unable to reproduce the issue on 3.1.1. Can you check-
1) It is a clean build after enabling the macro (CONFIG_MP_BLOB_SUPPORT).
2) There is enough space on NVS partition (There should be 1 sector empty even after accounting for all the data to be stored).

If you still see the problem, please share your example, partition table and sdkconfig with us.

Oromis
Posts: 21
Joined: Mon Sep 25, 2017 1:44 pm

Re: Using the new NVS multi-page BLOBs

Postby Oromis » Mon Feb 04, 2019 12:53 pm

Hi,

thank you for your response. I just figured out what the problem was and it's not ESP-IDF's fault at all. I'm very sorry for bothering you.

The problem was that we copied the 'nvs_flash' component from ESP-IDF v3.0.x into our project since we needed to apply a bugfix that arrived in the stable branch later. Since NVS was working fine from there on, I forgot about that. Now that we updated to 3.1.x and wanted to use the new multi-page BLOBs, we didn't update or delete our custom "fork" of nvs_flash, effectively overriding your updated version. Therefore, the config variable was set correctly but since the compiled NVS codebase was at 3.0.x, it was ignored entirely and multi-page BLOBs were not functional.

The solution: I just deleted our fork of nvs_flash since the bugfix we needed is now present in 3.1.x.

Now, multi-page BLOBs are working fine. Thank you for your time anyway!

David

ESP_sagar
Posts: 9
Joined: Mon Nov 19, 2018 9:55 am

Re: Using the new NVS multi-page BLOBs

Postby ESP_sagar » Tue Feb 05, 2019 8:36 am

Glad that it is working for you! Feel free to provide any feedback.

Who is online

Users browsing this forum: No registered users and 104 guests