<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Bluetooth LE create address id failed err -12 after enabling settings config</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/124747/bluetooth-le-create-address-id-failed-err--12-after-enabling-settings-config</link><description>BOARD: nrf54l15 DK 
 SDK: 3.1.0 
 
 Hi, 
 I am trying to setup my low power preipheral with a new ble address via bt_id_create. 
 Everthing works fine when I use the exact code from the ble fundementals course l2/l2_e3_sol . 
 
 To enable low power features</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 02 Oct 2025 13:26:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/124747/bluetooth-le-create-address-id-failed-err--12-after-enabling-settings-config" /><item><title>RE: Bluetooth LE create address id failed err -12 after enabling settings config</title><link>https://devzone.nordicsemi.com/thread/550497?ContentTypeID=1</link><pubDate>Thu, 02 Oct 2025 13:26:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f838baf2-6254-4cba-b454-e860f548621c</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I am not able to explain that.&amp;nbsp;I have attached my modified project includign the build folder. Can you try the hex file there first and verify that it works, and then move on to using the exact same main.c and prj.conf yourself?&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/l2_5F00_e3_5F00_sol.zip"&gt;devzone.nordicsemi.com/.../l2_5F00_e3_5F00_sol.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For reference, this is the log I get (and I verified&amp;nbsp;that the device advertises with the specificied address):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting nRF Connect SDK v3.1.0-6c6e5b32496e ***
*** Using Zephyr OS v4.1.99-1612683d4010 ***
[00:13:06.429,704] &amp;lt;inf&amp;gt; Lesson2_Exercise3: Starting Lesson 2 - Exercise 3 

[00:13:06.431,793] &amp;lt;inf&amp;gt; fs_nvs: 2 Sectors of 4096 bytes
[00:13:06.431,799] &amp;lt;inf&amp;gt; fs_nvs: alloc wra: 0, fd0
[00:13:06.431,803] &amp;lt;inf&amp;gt; fs_nvs: data wra: 0, 0
[00:13:06.431,867] &amp;lt;inf&amp;gt; bt_sdc_hci_driver: SoftDevice Controller build revision: 
                                            fc de 41 eb a2 d1 42 24  00 b5 f8 57 9f ac 9d 9e |..A...B$ ...W....
                                            aa c9 b4 34                                      |...4             
[00:13:06.433,320] &amp;lt;inf&amp;gt; bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:13:06.433,333] &amp;lt;inf&amp;gt; bt_hci_core: HW Variant: nRF54Lx (0x0005)
[00:13:06.433,346] &amp;lt;inf&amp;gt; bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 252.16862 Build 1121034987
[00:13:06.433,505] &amp;lt;inf&amp;gt; bt_hci_core: HCI transport: SDC
[00:13:06.433,555] &amp;lt;inf&amp;gt; bt_hci_core: Identity: FF:EE:DD:CC:BB:AA (random)
[00:13:06.433,569] &amp;lt;inf&amp;gt; bt_hci_core: HCI: version 6.1 (0x0f) revision 0x3069, manufacturer 0x0059
[00:13:06.433,582] &amp;lt;inf&amp;gt; bt_hci_core: LMP: version 6.1 (0x0f) subver 0x3069
[00:13:06.435,667] &amp;lt;inf&amp;gt; Lesson2_Exercise3: Bluetooth initialized

Advertising successfully started
[00:13:06.436,237] &amp;lt;inf&amp;gt; Lesson2_Exercise3: Advertising successfully started&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth LE create address id failed err -12 after enabling settings config</title><link>https://devzone.nordicsemi.com/thread/550489?ContentTypeID=1</link><pubDate>Thu, 02 Oct 2025 13:00:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27471d03-76ed-4987-8731-f669eb25c3c0</guid><dc:creator>lou_42</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;tried the exact same code and config. Still having the default address. But seeing an err -22 in the output.&lt;br /&gt;&lt;br /&gt;The main problem I am having on err -22 in general is how to figure out what exactly is the invalid parameter.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;*** Booting nRF Connect SDK v3.1.0-6c6e5b32496e ***
*** Using Zephyr OS v4.1.99-1612683d4010 ***
[00:00:00.004,796] &amp;lt;inf&amp;gt; Lesson2_Exercise3: Starting Lesson 2 - Exercise 3 

[00:00:00.004,835] &amp;lt;err&amp;gt; Lesson2_Exercise3: Creating new ID failed (err -22)

[00:00:00.006,641] &amp;lt;inf&amp;gt; fs_nvs: 2 Sectors of 4096 bytes
[00:00:00.006,646] &amp;lt;inf&amp;gt; fs_nvs: alloc wra: 0, fa0
[00:00:00.006,650] &amp;lt;inf&amp;gt; fs_nvs: data wra: 0, 30
[00:00:00.006,725] &amp;lt;inf&amp;gt; bt_sdc_hci_driver: SoftDevice Controller build revision: 
                                            fc de 41 eb a2 d1 42 24  00 b5 f8 57 9f ac 9d 9e |..A...B$ ...W....
                                            aa c9 b4 34                                      |...4             
[00:00:00.008,278] &amp;lt;inf&amp;gt; bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.008,291] &amp;lt;inf&amp;gt; bt_hci_core: HW Variant: nRF54Lx (0x0005)
[00:00:00.008,310] &amp;lt;inf&amp;gt; bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 252.16862 Build 1121034987
[00:00:00.008,449] &amp;lt;inf&amp;gt; bt_hci_core: No ID address. App must call settings_load()
[00:00:00.008,688] &amp;lt;inf&amp;gt; bt_hci_core: HCI transport: SDC
[00:00:00.008,736] &amp;lt;inf&amp;gt; bt_hci_core: Identity: F2:C8:DA:BF:FE:A1 (random)
[00:00:00.008,750] &amp;lt;inf&amp;gt; bt_hci_core: HCI: version 6.1 (0x0f) revision 0x3069, manufacturer 0x0059
[00:00:00.008,763] &amp;lt;inf&amp;gt; bt_hci_core: LMP: version 6.1 (0x0f) subver 0x3069
[00:00:00.011,680] &amp;lt;inf&amp;gt; Lesson2_Exercise3: Bluetooth initialized

Advertising successfully started
[00:00:00.012,274] &amp;lt;inf&amp;gt; Lesson2_Exercise3: Advertising successfully started

&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth LE create address id failed err -12 after enabling settings config</title><link>https://devzone.nordicsemi.com/thread/550472?ContentTypeID=1</link><pubDate>Thu, 02 Oct 2025 11:49:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e571ce4-0176-4dbf-be72-0f457f2d8078</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="lou_42"]And reordered my main to your exact structure, but no luck.[/quote]
&lt;p&gt;That is odd. Can you try the exact same main file I uploaded and test again? Also make sure you do a full erase of the board when you flash in case there is other data in the settings partition.&lt;/p&gt;
[quote user="lou_42"]And again I am wondering when and how the CONFIGs are applied. My code can bond with my central even though&amp;nbsp;CONFIG_BT_BONDABLE=y is not in my config&amp;nbsp;[/quote]
&lt;p&gt;Kconfig is a hiarachy of default values and values set in hither levels such as SoC and board level. The&amp;nbsp;CONFIG_BT_BONDABLE=y snuk in in my copy-pasting but is not needed, as it is &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/ff8f0c579eeb896876b6f36aca70c2bbfa756e19/subsys/bluetooth/host/Kconfig#L694"&gt;enabled by default&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth LE create address id failed err -12 after enabling settings config</title><link>https://devzone.nordicsemi.com/thread/550463?ContentTypeID=1</link><pubDate>Thu, 02 Oct 2025 11:30:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56b79583-c569-44ad-beb7-7be57b5e59e9</guid><dc:creator>lou_42</dc:creator><description>&lt;p&gt;Hey,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;thanks for your suggestions.&lt;/p&gt;
&lt;p&gt;I added the missing CONFIGs&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_SETTINGS_RUNTIME&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_FLASH_PAGE_LAYOUT&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;And reordered my main to your exact structure, but no luck.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Nothing changes.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;And again I am wondering when and how the CONFIGs are applied. My code can bond with my central even though&amp;nbsp;CONFIG_BT_BONDABLE=y is not in my config&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth LE create address id failed err -12 after enabling settings config</title><link>https://devzone.nordicsemi.com/thread/550456?ContentTypeID=1</link><pubDate>Thu, 02 Oct 2025 10:53:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4789510-5e2b-4d24-a43e-8987ab149b5a</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The ordering of&amp;nbsp;bt_enable, bt_id_create() and settings_load() need to be right for this to work, and I am wondering a bit about the configs as well. This is a working example of a modified&amp;nbsp;l2/l2_e3_sol with settings and bonding enabled, while setting a new address.&lt;/p&gt;
&lt;p&gt;Full main.c:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/*
 * Copyright (c) 2023 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/logging/log.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/bluetooth.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/conn.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/gap.h&amp;gt;
/* STEP 3.2.1 - Include the header file of the UUID helper macros and definitions */
#include &amp;lt;zephyr/bluetooth/uuid.h&amp;gt;
/* STEP 4.1 - Include the header file for managing Bluetooth LE addresses */
#include &amp;lt;zephyr/bluetooth/addr.h&amp;gt;

#include &amp;lt;dk_buttons_and_leds.h&amp;gt;
#include &amp;lt;zephyr/settings/settings.h&amp;gt;


/* STEP 5.1 - Create the advertising parameter for connectable advertising */
static const struct bt_le_adv_param *adv_param = BT_LE_ADV_PARAM(
	(BT_LE_ADV_OPT_CONN |
	 BT_LE_ADV_OPT_USE_IDENTITY), /* Connectable advertising and use identity address */
	800, /* Min Advertising Interval 500ms (800*0.625ms) */
	801, /* Max Advertising Interval 500.625ms (801*0.625ms) */
	NULL); /* Set to NULL for undirected advertising */

LOG_MODULE_REGISTER(Lesson2_Exercise3, LOG_LEVEL_INF);

#define DEVICE_NAME CONFIG_BT_DEVICE_NAME
#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)

#define RUN_STATUS_LED DK_LED1
#define RUN_LED_BLINK_INTERVAL 1000
static struct k_work adv_work;
static const struct bt_data ad[] = {
	/* STEP 3.1 - Set the flags and populate the device name in the advertising packet */
	BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
	BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),

};

static const struct bt_data sd[] = {
	/* STEP 3.2.2 - Include the 16-bytes (128-Bits) UUID of the LBS service in the scan response packet */
	BT_DATA_BYTES(BT_DATA_UUID128_ALL,
		      BT_UUID_128_ENCODE(0x00001523, 0x1212, 0xefde, 0x1523, 0x785feabcd123)),
};
/* STEP 5.2 - Resume advertising after a disconnection */
static void adv_work_handler(struct k_work *work)
{
	int err = bt_le_adv_start(adv_param, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd));

	if (err) {
		printk(&amp;quot;Advertising failed to start (err %d)\n&amp;quot;, err);
		return;
	}

	printk(&amp;quot;Advertising successfully started\n&amp;quot;);
}
static void advertising_start(void)
{
	k_work_submit(&amp;amp;adv_work);
}
static void recycled_cb(void)
{
	printk(&amp;quot;Connection object available from previous conn. Disconnect is complete!\n&amp;quot;);
	advertising_start();
}

BT_CONN_CB_DEFINE(conn_callbacks) = {
	.recycled = recycled_cb,
};

int main(void)
{
	int blink_status = 0;
	int err;

	LOG_INF(&amp;quot;Starting Lesson 2 - Exercise 3 \n&amp;quot;);

	err = dk_leds_init();
	if (err) {
		LOG_ERR(&amp;quot;LEDs init failed (err %d)\n&amp;quot;, err);
		return -1;
	}

	/* STEP 4.2 - Change the random static address */
	bt_addr_le_t addr;
	err = bt_addr_le_from_str(&amp;quot;FF:EE:DD:CC:BB:AA&amp;quot;, &amp;quot;random&amp;quot;, &amp;amp;addr);
	if (err) {
		LOG_ERR(&amp;quot;Invalid BT address (err %d)\n&amp;quot;, err);
	}

	err = bt_id_create(&amp;amp;addr, NULL);
	if (err &amp;lt; 0) {
		LOG_ERR(&amp;quot;Creating new ID failed (err %d)\n&amp;quot;, err);
	}

	err = bt_enable(NULL);
	if (err) {
		LOG_ERR(&amp;quot;Bluetooth init failed (err %d)\n&amp;quot;, err);
		return -1;
	}

	if (IS_ENABLED(CONFIG_SETTINGS))
	{
		settings_load();
	}

	LOG_INF(&amp;quot;Bluetooth initialized\n&amp;quot;);
	/* STEP 5.3 - Start connectable advertising */
	k_work_init(&amp;amp;adv_work, adv_work_handler);
	advertising_start();

	LOG_INF(&amp;quot;Advertising successfully started\n&amp;quot;);

	for (;;) {
		dk_set_led(RUN_STATUS_LED, (++blink_status) % 2);
		k_sleep(K_MSEC(RUN_LED_BLINK_INTERVAL));
	}
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Additional configs:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_SETTINGS_RUNTIME=y
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y
CONFIG_BT_SMP=y
CONFIG_BT_SIGNING=y
CONFIG_BT_BONDABLE=y&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>