New data is added to the settings partition after every reboot.

Hello

I'm using the settings partition to store user configuration data. I know that the BLE stack also uses it — particularly for storing bonding information — but I don't understand why new data keeps getting stored in the settings automatically after each reset (see the orange-highlighted section).

Among these data, I noticed the Bluetooth name (FREEDOM) and the extended advertised name (FREEDOM EXTENDED).

Why do these keys keep appearing after every reset?
After a while, I'm seeing the following error:

Could this be related to the issue I just described?

Thank you in advance.
Best regards,

  • Hi,

    Normally, device name is not written to settings. However, if you have CONFIG_BT_DEVICE_NAME_DYNAMIC=y and call bt_set_name() it is written. Is that what is happening here? This is also described in this post.

  • Hello Einar

    Indeed, I have CONFIG_BT_DEVICE_NAME_DYNAMIC=y and I'm calling bt_set_name() twice at each reboot.

    Regards,

  • Is it possible to avoid calling bt_set_name() to prevent the Bluetooth name from being stored again in the settings partition?

    I tried to add the ble name directly in the advertising data structure : 

    However, bt_le_ext_adv_set_data still returns error -22 (invalid argument).

  • Hi,

    Do you requier a dynamic name? If not, you would be better of disabling it and setting the name build time as is done in most Bluetooth samples. If you need a dynamic name, I would check the existing name using bt_get_name() and verify if it needs to be updated, before you call bt_set_name(). That way there is only a write when you actually need to update the name.