Bluetooth address and settings_load()

Hello all,

i have a problem and I hope that someone can help me.

I can change the bluetooth address of the device with the following code:

err = bt_addr_le_from_str(addr_str, type_str, &addr);
if (err) {
	printk("Invalid BT address (err %d)\n", err);
}

if (addr.type == BT_ADDR_LE_PUBLIC) {
	printk("Using public address\n");
	err = bt_ctlr_set_public_addr(addr.a.val);
	if (err) {
        printk("Failed to set public address (err %d)\n", err);
    } else {
        printk("Public address set successfully\n");
    }
	return;
}

and this is okay.

I have the problem when I add this part of code:
CONFIG_SETTINGS=y

and

if (IS_ENABLED(CONFIG_SETTINGS)) {
	settings_load();
	printk("Settings load \n");
}

With this part of code I can not set my bluetooth address. The bluetooth address of the the device is not the one that I have setted but is the one inside the chip (i think).

I need to add settings_load() to keep the bond device information after the power off.

How can avoid this??

Thanks in advance.

Related