<?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>Security Level 4 Connection Failure in Central</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/119973/security-level-4-connection-failure-in-central</link><description>Hello Nordic Team, 
 I am working with the nRF5340 Audio DK as a central device , trying to establish a secure connection using Security Level 4 (128-bit encryption with LE Secure Connections) . 
 My goal is to ensure the central device enforces LESC</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 09 Apr 2025 04:29:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/119973/security-level-4-connection-failure-in-central" /><item><title>RE: Security Level 4 Connection Failure in Central</title><link>https://devzone.nordicsemi.com/thread/531114?ContentTypeID=1</link><pubDate>Wed, 09 Apr 2025 04:29:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:efb83296-6209-43bf-aa30-743ac8837dc2</guid><dc:creator>Yash48</dc:creator><description>&lt;p class="" data-start="0" data-end="6"&gt;Hello,&lt;/p&gt;
&lt;p class="" data-start="8" data-end="36"&gt;Thank you for your response.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;I understand that some devices may advertise only partial names or include the name in the scan response packet.&lt;/span&gt; &lt;span&gt;I will use a Bluetooth sniffer to capture advertisement data from devices whose names are not displayed during scanning to determine their broadcasting behavior.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Security Level 4 Connection Failure in Central</title><link>https://devzone.nordicsemi.com/thread/530564?ContentTypeID=1</link><pubDate>Fri, 04 Apr 2025 08:33:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:063ffd29-e025-4a62-b6bf-d5b558430527</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;1. Whch&amp;nbsp;OnePlus Nord Buds version are you using? Are you sure they support LE Audio?&lt;/p&gt;
&lt;p&gt;2. Some devices only advertise partial name, and some advertise the full name. Also, some only include the name (partial or full) in the scan response packet. Perhaps you can check with a sniffer what the case is for the the devices where you do not see the full name?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Security Level 4 Connection Failure in Central</title><link>https://devzone.nordicsemi.com/thread/530354?ContentTypeID=1</link><pubDate>Thu, 03 Apr 2025 05:50:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:693add5a-d4ce-4cc9-8a46-bd935a805c30</guid><dc:creator>Yash48</dc:creator><description>&lt;p class="" data-start="0" data-end="12"&gt;Hello Einar,&lt;/p&gt;
&lt;p class="" data-start="14" data-end="39"&gt;I hope you&amp;#39;re doing well.&lt;/p&gt;
&lt;p class="" data-start="41" data-end="160"&gt;&lt;span&gt;The previous connection issue was related to the MAC address type and has been successfully resolved.&lt;/span&gt; &lt;span&gt;The nRF5340 Audio DK now connects successfully with several devices.&lt;/span&gt;​&lt;/p&gt;
&lt;p class="" data-start="162" data-end="185"&gt;&lt;b&gt;Question:&lt;/b&gt;&lt;/p&gt;
&lt;ol data-start="187" data-end="692"&gt;
&lt;li class="" data-start="187" data-end="430"&gt;
&lt;p class="" data-start="190" data-end="228"&gt;&lt;strong data-start="190" data-end="228"&gt;Connection with OnePlus Nord Buds:&lt;/strong&gt;&lt;/p&gt;
&lt;ul data-start="232" data-end="430"&gt;
&lt;li class="" data-start="232" data-end="326"&gt;
&lt;p class="" data-start="234" data-end="326"&gt;&lt;strong data-start="234" data-end="244"&gt;Issue:&lt;/strong&gt; &lt;span&gt;The nRF5340 Audio DK fails to establish a connection with the OnePlus Nord Buds, despite successful connections with other devices.&lt;/span&gt;​&lt;/p&gt;
&lt;/li&gt;
&lt;li class="" data-start="330" data-end="430"&gt;
&lt;p class="" data-start="332" data-end="430"&gt;&lt;span&gt;The connection initiates but results in a pairing failure.&lt;/span&gt;​&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li class="" data-start="432" data-end="692"&gt;
&lt;p class="" data-start="435" data-end="488"&gt;&lt;strong data-start="435" data-end="488"&gt;Inconsistent Device Name Display During Scanning:&lt;/strong&gt;&lt;/p&gt;
&lt;ul data-start="492" data-end="692"&gt;
&lt;li class="" data-start="492" data-end="586"&gt;
&lt;p class="" data-start="494" data-end="586"&gt;&lt;strong data-start="494" data-end="504"&gt;Issue:&lt;/strong&gt; &lt;span&gt;Some devices&amp;#39; names are not displayed during scanning, making identification challenging.&lt;/span&gt;​&lt;/p&gt;
&lt;/li&gt;
&lt;li class="" data-start="590" data-end="692"&gt;
&lt;p class="" data-start="592" data-end="692"&gt;&lt;span&gt;Certain devices consistently show their names, while others do not, despite being in discoverable mode.&lt;/span&gt;​&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="" data-start="694" data-end="783"&gt;I would appreciate any insights or recommendations you might have regarding these issues.&lt;br /&gt;&lt;span&gt;Thanks for your response!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Security Level 4 Connection Failure in Central</title><link>https://devzone.nordicsemi.com/thread/529006?ContentTypeID=1</link><pubDate>Wed, 26 Mar 2025 09:59:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:894be7f3-9d23-4e43-8a3b-e6cd522cc1ff</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="Yash48"]Sure, I will try to capture a sniffer trace and share the results.[/quote]
&lt;p&gt;Good, that will be very interesting to see.&lt;/p&gt;
[quote user="Yash48"]Also, do you have any other suggestions regarding the code or debugging steps that could help identify the issue?[/quote]
&lt;p&gt;I think we need to start with the sniffer trace first, so that we see what happens on air. With that, we will hopefully get some pointers on what the issue could be and where to look in the code (but perhaps it would be related to how you initiate connection, do you attempt to connect to the right device, or are there other issues?)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Security Level 4 Connection Failure in Central</title><link>https://devzone.nordicsemi.com/thread/528694?ContentTypeID=1</link><pubDate>Mon, 24 Mar 2025 17:19:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0778289-341b-466d-80a9-9aef0ffa2df6</guid><dc:creator>Yash48</dc:creator><description>&lt;blockquote data-start="68" data-end="258"&gt;
&lt;p class="" data-start="70" data-end="166"&gt;&lt;strong data-start="70" data-end="86"&gt;&lt;/strong&gt;&lt;em data-start="91" data-end="164"&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p class="" data-start="173" data-end="258"&gt;&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/119973/security-level-4-connection-failure-in-central/528648"]As you get&amp;nbsp;BT_HCI_ERR_UNKNOWN_CONN_ID&amp;nbsp;the connection is never established. Does this always happen? is there&amp;nbsp; an existing bond with the headpohnes?[/quote]
&lt;p&gt;Yes, this happens every time, and there is no existing bonding with the headphones&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/119973/security-level-4-connection-failure-in-central/528648"]It would be interesting to see what is acutally happening on air. Can you make a sniffer trace showing the connection attempt?[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote data-start="260" data-end="445"&gt;
&lt;p class="" data-start="377" data-end="445"&gt;Sure, I will try to capture a sniffer trace and share the results.&lt;/p&gt;
&lt;p class="" data-start="475" data-end="725"&gt;Also, do you have any other suggestions regarding the code or debugging steps that could help identify the issue?&lt;br data-start="657" data-end="660" /&gt; Let me know if you have any thoughts. Thanks for your response!&lt;/p&gt;
&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Security Level 4 Connection Failure in Central</title><link>https://devzone.nordicsemi.com/thread/528648?ContentTypeID=1</link><pubDate>Mon, 24 Mar 2025 14:15:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2855de66-3487-4289-90c9-8e5aa622793b</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="Yash48"]&lt;h4&gt;Questions:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Why is the connection request not reaching the headset?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Since &lt;code&gt;bt_le_conn_create()&lt;/code&gt; does not fail, what else can I check to debug this issue?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Could this be related to security settings blocking the connection before pairing?&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;[/quote]
&lt;p&gt;As you get&amp;nbsp;BT_HCI_ERR_UNKNOWN_CONN_ID&amp;nbsp;the connection is never established. Does this always happen? is there&amp;nbsp; an existing bond with the headpohnes?&lt;/p&gt;
[quote user="Yash48"]Any suggestions for debugging this from both the nRF5340 side and the headset side?[/quote]
&lt;p&gt;It would be interesting to see what is acutally happening on air. Can you make a sniffer trace showing the connection attempt?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Security Level 4 Connection Failure in Central</title><link>https://devzone.nordicsemi.com/thread/528553?ContentTypeID=1</link><pubDate>Mon, 24 Mar 2025 08:42:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1ec547b-dae0-4f82-8ccf-956f37ec942c</guid><dc:creator>Yash48</dc:creator><description>&lt;p class="" data-start="150" data-end="257"&gt;Apologies for the delayed response. I&amp;rsquo;ve been testing different configurations to troubleshoot this issue.&lt;br /&gt;&lt;br /&gt;security level structure :&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;/** Security level. */
typedef enum __packed {
	/** Level 0: Only for BR/EDR special cases, like SDP */
	BT_SECURITY_L0,
	/** Level 1: No encryption and no authentication. */
	BT_SECURITY_L1,
	/** Level 2: Encryption and no authentication (no MITM). */
	BT_SECURITY_L2,
	/** Level 3: Encryption and authentication (MITM). */
	BT_SECURITY_L3,
	/** Level 4: Authenticated Secure Connections and 128-bit key. */
	BT_SECURITY_L4,
	/** Bit to force new pairing procedure, bit-wise OR with requested
	 *  security level.
	 */
	BT_SECURITY_FORCE_PAIR = BIT(7),
} bt_security_t;
&lt;/pre&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p class="" data-start="259" data-end="499"&gt;I&amp;rsquo;m trying to connect the nRF5340 Audio DK (central) to a headset/earbuds while setting the security level to BT_SECURITY_L1 or BT_SECURITY_L2. However, the connection is not being triggered, and I receive the following error:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:15.438,110] &amp;lt;inf&amp;gt; main: Received Command: connect AC:BF:71:77:36:32 
[00:00:15.438,201] &amp;lt;inf&amp;gt; main: Attempting to connect to AC:BF:71:77:36:32...
[00:00:15.539,398] &amp;lt;inf&amp;gt; main: Connection initiated index : 0 
[00:00:24.539,062] &amp;lt;wrn&amp;gt; bt_hci_core: Connection creation timeout triggered
[00:00:24.539,245] &amp;lt;err&amp;gt; main: Failed to connect to AC:BF:71:77:36:32 (random) (err 2: BT_HCI_ERR_UNKNOWN_CONN_ID)
ERROR: Failed to connect  (err 2 BT_HCI_ERR_UNKNOWN_CONN_ID) &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Code is :&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;static struct bt_conn *default_conn;

/* Callback function when connection is established */
static void connected_cb(struct bt_conn *conn, uint8_t err) {
    char addr[BT_ADDR_LE_STR_LEN];
    bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

    if (err) {
        LOG_ERR(&amp;quot;Failed to connect to %s (err %d: %s)\n&amp;quot;, addr, err, bt_hci_err_to_str(err));
        return;
    }

    default_conn = bt_conn_ref(conn);
    LOG_INF(&amp;quot;Connected: %s\n&amp;quot;, addr);

    /* Get current security level */
    uint8_t sec_level = bt_conn_get_security(conn);
    printk(&amp;quot;Security level: %d\n&amp;quot;, sec_level);

    /* Attempt to set security level to 2 */
    err = bt_conn_set_security(conn, BT_SECURITY_L2);
    if (err) {
        LOG_ERR(&amp;quot;Security Level 4 failed, error code: %d&amp;quot;, err);
    }
}

/* Callback function when connection is disconnected */
static void disconnected_cb(struct bt_conn *conn, uint8_t reason) {
    char addr[BT_ADDR_LE_STR_LEN];
    bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

    if (default_conn) {
        bt_conn_unref(default_conn);
        default_conn = NULL;
    }

    LOG_INF(&amp;quot;Disconnected: %s, reason 0x%02x (%s)\n&amp;quot;, addr, reason, bt_hci_err_to_str(reason));
}

/* Callback function when identity is resolved */
static void identity_resolved_cb(struct bt_conn *conn, const bt_addr_le_t *rpa, const bt_addr_le_t *identity) {
    char addr_identity[BT_ADDR_LE_STR_LEN];
    char addr_rpa[BT_ADDR_LE_STR_LEN];

    bt_addr_le_to_str(identity, addr_identity, sizeof(addr_identity));
    bt_addr_le_to_str(rpa, addr_rpa, sizeof(addr_rpa));

    LOG_INF(&amp;quot;Identity resolved %s -&amp;gt; %s\n&amp;quot;, addr_rpa, addr_identity);
}

/* Callback function when security level changes */
static void security_changed_cb(struct bt_conn *conn, bt_security_t level, enum bt_security_err err) {
    char addr[BT_ADDR_LE_STR_LEN];
    bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

    if (err) {
        LOG_ERR(&amp;quot;Security failed: %s level %u err %s(%d)\n&amp;quot;, addr, level, bt_security_err_to_str(err), err);
    } else {
        LOG_INF(&amp;quot;Security changed: %s level %u\n&amp;quot;, addr, level);
    }
}

/* Connection callbacks */
static struct bt_conn_cb conn_callbacks = {
    .connected = connected_cb,
    .disconnected = disconnected_cb,
    .identity_resolved = identity_resolved_cb,
    .security_changed = security_changed_cb,
};

/* Handle pairing success */
static void auth_pairing_complete_cb(struct bt_conn *conn, bool bonded) {
    char addr[BT_ADDR_LE_STR_LEN];
    bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

    LOG_INF(&amp;quot;Pairing complete with %s (Bonded: %s)\n&amp;quot;, addr, bonded ? &amp;quot;Yes&amp;quot; : &amp;quot;No&amp;quot;);

    uint8_t sec_level = bt_conn_get_security(conn);
    if (sec_level == 4) {
        printk(&amp;quot;Secure Connections (Level 4) established\n&amp;quot;);
    } else {
        printk(&amp;quot;Security level: %d\n&amp;quot;, sec_level);
    }
}

/* Handle pairing failure */
static void auth_pairing_failed_cb(struct bt_conn *conn, enum bt_security_err reason) {
    LOG_INF(&amp;quot;Pairing Failed (%d). Disconnecting.\n&amp;quot;, reason);
    bt_conn_disconnect(conn, BT_HCI_ERR_AUTH_FAIL);
}

/* Callback function for bond deletion */
static void auth_bond_deleted_cb(uint8_t id, const bt_addr_le_t *peer) {
    LOG_INF(&amp;quot;Bond Information Deleted\n&amp;quot;);
}

/* Bluetooth authentication info callback structure */
static struct bt_conn_auth_info_cb auth_info_callbacks = {
    .pairing_complete = auth_pairing_complete_cb,
    .pairing_failed = auth_pairing_failed_cb,
    .bond_deleted = auth_bond_deleted_cb,
};

/* Callback when ATT MTU is updated */
static void att_mtu_updated(struct bt_conn *conn, uint16_t tx, uint16_t rx) {
    LOG_INF(&amp;quot;MTU exchanged: %u/%u\n&amp;quot;, tx, rx);
}

/* GATT callbacks */
static struct bt_gatt_cb gatt_callbacks = {
    .att_mtu_updated = att_mtu_updated,
};

/* Function to handle pairing accept */
static enum bt_security_err auth_pairing_accept_cb(struct bt_conn *conn, const struct bt_conn_pairing_feat *const feat) {
    char addr[BT_ADDR_LE_STR_LEN];
    bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
    printk(&amp;quot;Pairing accept for %s\n&amp;quot;, addr);

    /* Accept pairing */
    return BT_SECURITY_ERR_SUCCESS;
}

/* Function to handle pairing confirmation */
static void auth_pairing_confirm_cb(struct bt_conn *conn) {
    LOG_INF(&amp;quot;Pairing Confirm\n&amp;quot;);
    bt_conn_auth_pairing_confirm(conn);
}

/* Function to handle passkey confirmation */
static void auth_passkey_confirm_cb(struct bt_conn *conn, uint32_t passkey) {
    char addr[BT_ADDR_LE_STR_LEN];
    bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
    printk(&amp;quot;Passkey confirmation for %s with passkey %u\n&amp;quot;, addr, passkey);

    /* Confirm passkey */
    bt_conn_auth_passkey_confirm(conn);
}

/* Function to display passkey */
static void auth_passkey_display_cb(struct bt_conn *conn, unsigned int passkey) {
    char addr[BT_ADDR_LE_STR_LEN];
    bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
    LOG_INF(&amp;quot;Passkey for %s: %06u\n&amp;quot;, addr, passkey);
}

/* Function to handle pairing cancellation */
static void auth_cancel_cb(struct bt_conn *conn) {
    char addr[BT_ADDR_LE_STR_LEN];
    bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
    LOG_INF(&amp;quot;Pairing cancelled: %s\n&amp;quot;, addr);
}

/* Define the authentication callbacks structure */
static struct bt_conn_auth_cb auth_cb_callbacks = {
    .pairing_accept = auth_pairing_accept_cb,
    .pairing_confirm = auth_pairing_confirm_cb,
    .passkey_confirm = auth_passkey_confirm_cb,
    .passkey_display = auth_passkey_display_cb,
    .cancel = auth_cancel_cb,
};


// Bluetooth connection callback
static void connected(struct bt_conn *conn, uint8_t err)
{
	bool err_flage = false;
	char addr[BT_ADDR_LE_STR_LEN];
	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	if (err)
	{
		bt_conn_unref(conn);
		LOG_ERR(&amp;quot;Failed to connect to %s (err %d: %s)\n&amp;quot;, addr, err, bt_hci_err_to_str(err));
		send_error(&amp;quot;ERROR: Failed to connect &amp;quot;, err);
		err_flage = true;
		// return;
	}

	for (int i = 0; i &amp;lt; MAX_DEVICE; i++)
	{
		if (connected_devices[i].connection == conn)
		{
			if (err_flage)
			{
				connected_devices[i].connection = NULL;
				return;
			}
			connected_devices[i].connection = bt_conn_ref(conn);
			// bt_conn_ref(conn)
			bt_addr_le_copy(&amp;amp;connected_devices[i].addr, bt_conn_get_dst(conn)); // Store address
			device_count++;
			LOG_INF(&amp;quot;Connected: %s (index %d)\n&amp;quot;, addr, i);
			send_uart_response(&amp;quot;Success: Connected Successfully &amp;quot;);
		}
	}

	uint8_t sec_level = bt_conn_get_security(conn);
	printk(&amp;quot;Security level: %d\n&amp;quot;, sec_level);

	err = bt_conn_set_security(conn, BT_SECURITY_L2);
	if (err)
	{
		LOG_INF(&amp;quot;Security Level 2 failed&amp;quot;);
	}
}

// Bluetooth disconnection callback
static void disconnected(struct bt_conn *conn, uint8_t reason)
{
	char addr[BT_ADDR_LE_STR_LEN];
	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
	for (int i = 0; i &amp;lt; MAX_DEVICE; i++)
	{
		if (connected_devices[i].connection == conn) // Match connection
		{
			bt_conn_unref(conn);
			// bt_conn_unref(connected_devices[i].connection); // Release reference
			connected_devices[i].connection = NULL; // Clear slot
			memset(&amp;amp;connected_devices[i].addr, 0, sizeof(bt_addr_le_t));
			LOG_INF(&amp;quot;disconnect index : %d \n&amp;quot;, i);
			device_count--;
			break;
		}
	}
	LOG_INF(&amp;quot;Disconnected: %s, reason 0x%02x (%s)\n&amp;quot;, addr, reason, bt_hci_err_to_str(reason));
	send_error(&amp;quot;Disconnected: &amp;quot;, reason);

	// Check if any lingering references exist
	if (conn)
	{
		LOG_WRN(&amp;quot;Forcing unref of stale connection&amp;quot;);
		bt_conn_unref(conn);
	}
}

static void identity_resolved(struct bt_conn *conn, const bt_addr_le_t *rpa,
							  const bt_addr_le_t *identity)
{
	char addr_identity[BT_ADDR_LE_STR_LEN];
	char addr_rpa[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(identity, addr_identity, sizeof(addr_identity));
	bt_addr_le_to_str(rpa, addr_rpa, sizeof(addr_rpa));

	LOG_INF(&amp;quot;Identity resolved %s -&amp;gt; %s\n&amp;quot;, addr_rpa, addr_identity);
}

static void security_changed(struct bt_conn *conn, bt_security_t level,
							 enum bt_security_err err)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	if (err)
	{
		LOG_ERR(&amp;quot;Security failed: %s level %u err %s(%d)\n&amp;quot;, addr, level,
				bt_security_err_to_str(err), err);
	}
	else
	{
		LOG_INF(&amp;quot;Security changed: %s level %u\n&amp;quot;, addr, level);
	}
}

// Connection callbacks
static struct bt_conn_cb conn_callbacks = {
	.connected = connected,
	.disconnected = disconnected,
	.identity_resolved = identity_resolved,
	.security_changed = security_changed,
};

static void auth_passkey_display_cb(struct bt_conn *conn, unsigned int passkey)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	LOG_INF(&amp;quot;Passkey for %s: %06u\n&amp;quot;, addr, passkey);
}

static void auth_cancel_cb(struct bt_conn *conn)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	LOG_INF(&amp;quot;Pairing cancelled: %s\n&amp;quot;, addr);
	bt_conn_disconnect(conn, BT_HCI_ERR_AUTH_FAIL);
}

// Define the authentication callbacks structure
static struct bt_conn_auth_cb auth_cb_callbacks = {
	.passkey_entry = NULL,
	.pairing_confirm = NULL ,
	.passkey_confirm = NULL,
	.oob_data_request = NULL,
	.passkey_display = auth_passkey_display_cb,
	.cancel = auth_cancel_cb,
};

// Handle pairing success
static void auth_pairing_complete(struct bt_conn *conn, bool bonded)
{
	char addr[BT_ADDR_LE_STR_LEN];
	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
	LOG_INF(&amp;quot;Pairing complete with %s (Bonded: %s)\n&amp;quot;, addr, bonded ? &amp;quot;Yes&amp;quot; : &amp;quot;No&amp;quot;);

	uint8_t sec_level = bt_conn_get_security(conn);
	if (sec_level == 4)
	{
		printk(&amp;quot;Secure Connections (Level 4) established\n&amp;quot;);
	}
	else
	{
		printk(&amp;quot;Security level: %d\n&amp;quot;, sec_level);
	}
}

// Handle pairing failure
static void auth_pairing_failed(struct bt_conn *conn, enum bt_security_err reason)
{
	LOG_INF(&amp;quot;Pairing Failed (%d). Disconnecting.\n&amp;quot;, reason);
	bt_conn_disconnect(conn, BT_HCI_ERR_AUTH_FAIL);
}

static void auth_bond_deleted(uint8_t id, const bt_addr_le_t *peer)
{
	LOG_INF(&amp;quot;Bond Information Deleted\n&amp;quot;);
}

// Bluetooth authentication info callback structure
static struct bt_conn_auth_info_cb auth_info_callbacks = {
	.pairing_complete = auth_pairing_complete,
	.pairing_failed = auth_pairing_failed,
	.bond_deleted = auth_bond_deleted,
};

static void att_mtu_updated(struct bt_conn *conn, uint16_t tx, uint16_t rx)
{
	LOG_INF(&amp;quot;MTU exchanged: %u/%u\n&amp;quot;, tx, rx);
}

static struct bt_gatt_cb gatt_callbacks = {
	.att_mtu_updated = att_mtu_updated,
};

// Scan parameters
struct bt_le_scan_param scan_params = {
	.type = BT_LE_SCAN_TYPE_PASSIVE,
	.options = BT_LE_SCAN_OPT_FILTER_DUPLICATE,
	.interval = 0x0050, // 80 ms
	.window = 0x0050,	// 80 ms
	.timeout = 0x0200,	// 5 s
};

// Scan callback
static void device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type,
						 struct net_buf_simple *ad)
{

	// We&amp;#39;re only interested in connectable events
	if (type != BT_GAP_ADV_TYPE_ADV_IND &amp;amp;&amp;amp;
		type != BT_GAP_ADV_TYPE_ADV_DIRECT_IND &amp;amp;&amp;amp;
		type != BT_GAP_ADV_TYPE_EXT_ADV &amp;amp;&amp;amp;
		type != BT_GAP_ADV_TYPE_SCAN_RSP)
	{
		return;
	}

	// connect only to devices in close proximity
	if (rssi &amp;lt; -65)
	{
		return;
	}

	add_device_to_responce_list(addr, rssi, ad);

	// Schedule background processing
	k_work_submit(&amp;amp;process_scan_work);
}

static int start_scan(void)
{
	int err;

	k_work_init(&amp;amp;process_scan_work, process_scan_results);

	err = bt_le_scan_start(&amp;amp;scan_params, device_found);
	if (err)
	{
		LOG_ERR(&amp;quot;Scanning failed to start (err %d)\n&amp;quot;, err);
		send_error(&amp;quot;ERROR: Scanning failed to start&amp;quot;, err);
		return err;
	}

	LOG_INF(&amp;quot;Scanning...\n&amp;quot;);
	send_uart_response(&amp;quot;Success: Scanning started \n&amp;quot;);

	return 0;
}

// static int stop_scan(void)
// {
// 	int err;

// 	err = bt_le_scan_stop();
// 	if (err)
// 	{
// 		LOG_ERR(&amp;quot;Scanning failed to stop (err %d)\n&amp;quot;, err);
// 		send_error(&amp;quot;ERROR: Scanning failed to stop &amp;quot;, err);
// 		return err;
// 	}
// 	LOG_INF(&amp;quot;Stop Scanning...\n&amp;quot;);
// 	return 0;
// }

#define BT_LE_SCAN_INTERVAL 0x0060
#define BT_LE_SCAN_WINDOW 0x0030
#define BT_CONN_TIMEOUT 0x0384

struct bt_conn_le_create_param create_param = {
	.options = BT_CONN_LE_OPT_NONE,
	.interval = BT_LE_SCAN_INTERVAL,
	.window = BT_LE_SCAN_WINDOW,
	.timeout = BT_CONN_TIMEOUT,
};

static void start_connection(const bt_addr_le_t *addr)
{
	int err;
    int i=0;
	err = bt_le_scan_stop();
	if (err)
	{
		LOG_ERR(&amp;quot;Failed to stop scanning (err %d)\n&amp;quot;, err);
		return;
	}

	k_sleep(K_MSEC(100));


		// BT_CONN_LE_CREATE_CONN
		err = bt_conn_le_create(addr, &amp;amp;create_param, BT_LE_CONN_PARAM_DEFAULT, &amp;amp;connected_devices[i].connection);
		if (err)
		{
			if (err == -EALREADY)
			{
				LOG_INF(&amp;quot;Device is already connected %d\n&amp;quot;, err);
				
			}
			else
			{
				LOG_ERR(&amp;quot;Failed to create connection (err %d)\n&amp;quot;, err);
			}
        }
		LOG_INF(&amp;quot;Connection initiated index : %d \n &amp;quot;, i);
			return;
		
	}
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Error is printing from the hci_core.c:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;int busy_status = k_work_delayable_busy_get(&amp;amp;conn-&amp;gt;deferred_work);

		if (!(busy_status &amp;amp; (K_WORK_QUEUED | K_WORK_DELAYED))) {
			LOG_WRN(&amp;quot;Connection creation timeout triggered&amp;quot;);
			conn-&amp;gt;err = err;
			bt_conn_set_state(conn, BT_CONN_DISCONNECTED);
		} else {
			/* Restart initiator after RPA timeout. */
			ret = bt_le_create_conn(conn);
			if (ret) {
				LOG_ERR(&amp;quot;Failed to restart initiator&amp;quot;);
			}
		}&lt;/pre&gt;&lt;/p&gt;
&lt;p class="" data-start="259" data-end="499"&gt;On my nRF5340 Audio DK, the &lt;code data-start="120" data-end="141"&gt;bt_le_conn_create()&lt;/code&gt; function succeeds and does not return any error.&lt;/p&gt;
&lt;p class="" data-start="259" data-end="499"&gt;However, the connection times out after a few seconds.&lt;/p&gt;
&lt;p class="" data-start="259" data-end="499"&gt;On the headset side, I checked the logs, and the connection event is not generated at all&amp;mdash;it seems like the headset does not even see the connection request.&lt;/p&gt;
&lt;h4 class="" data-start="435" data-end="467"&gt;Questions:&lt;/h4&gt;
&lt;ul data-start="468" data-end="804"&gt;
&lt;li class="" data-start="468" data-end="531"&gt;
&lt;p class="" data-start="470" data-end="531"&gt;Why is the connection request not reaching the headset?&lt;/p&gt;
&lt;/li&gt;
&lt;li class="" data-start="532" data-end="621"&gt;
&lt;p class="" data-start="534" data-end="621"&gt;Since &lt;code data-start="540" data-end="561"&gt;bt_le_conn_create()&lt;/code&gt; does not fail, what else can I check to debug this issue?&lt;/p&gt;
&lt;/li&gt;
&lt;li class="" data-start="622" data-end="708"&gt;
&lt;p class="" data-start="624" data-end="708"&gt;Could this be related to security settings blocking the connection before pairing?&lt;/p&gt;
&lt;/li&gt;
&lt;li class="" data-start="709" data-end="804"&gt;
&lt;p class="" data-start="711" data-end="804"&gt;Any suggestions for debugging this from both the nRF5340 side and the headset side?&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I&amp;rsquo;d appreciate any guidance on what I might be missing or need to adjust.&lt;/p&gt;
&lt;p&gt;Thanks in advance for your help!&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Security Level 4 Connection Failure in Central</title><link>https://devzone.nordicsemi.com/thread/528394?ContentTypeID=1</link><pubDate>Fri, 21 Mar 2025 11:52:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bada02da-f3fa-4bda-9ace-f4c2befb3a9c</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;With a headset that does not have a way to handle passkeys, you normally use just works. However, you can still use LESC, but level 4 is not possible as it requiers more I/O (conceptually it could be possible for&amp;nbsp; a headset to read the LESC passkey out loud, but that would have to be supproted in the headset itself).&lt;/p&gt;
&lt;p&gt;So I suggsest you revert your changes as lecel 4 is not possible. (If you want to only suppor LESC and not legacy pairign, that is possible, and you can do that by adding&amp;nbsp;CONFIG_BT_SMP_DISABLE_LEGACY_JW_PASSKEY=y.)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Security Level 4 Connection Failure in Central</title><link>https://devzone.nordicsemi.com/thread/528387?ContentTypeID=1</link><pubDate>Fri, 21 Mar 2025 11:38:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:988978c7-3fe5-4cda-aae0-a8a1add5064f</guid><dc:creator>Yash48</dc:creator><description>&lt;p data-start="90" data-end="101"&gt;Hi Einar,&lt;/p&gt;
&lt;p data-start="103" data-end="130"&gt;Thanks for your response!&lt;/p&gt;
&lt;p data-start="132" data-end="331"&gt;I&amp;#39;m using an nRF5340 Audio DK as the central device, which has buttons and can display a passkey via UART. The peripheral is a standard headset/headphones without a display or input method.&lt;/p&gt;
&lt;p data-start="333" data-end="592"&gt;I need to establish a secure connection for LE Audio testing. How do I implement LE Secure Connections (LESC) pairing on the nRF5340 Audio DK (central side)? Additionally, which LESC pairing method would be the most suitable for this setup?&lt;/p&gt;
&lt;p data-start="594" data-end="669"&gt;I&amp;rsquo;d appreciate any guidance on what I might be missing or need to adjust.&lt;/p&gt;
&lt;p data-start="671" data-end="705"&gt;Thanks in advance for your help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Security Level 4 Connection Failure in Central</title><link>https://devzone.nordicsemi.com/thread/528338?ContentTypeID=1</link><pubDate>Fri, 21 Mar 2025 08:34:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52c8c7b9-b797-43ac-a389-a799e97838cf</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="Yash48"]&lt;p&gt;you&amp;#39;re absolutely correct! that&amp;nbsp;&amp;nbsp;Numeric Comparison requires a display or input, while 128-bit AES-CCM encryption does not.&lt;/p&gt;
&lt;p&gt;I have&amp;nbsp; questions regarding implementing Security Level 4 (Authenticated Secure Connections with 128-bit encryption) on my devices:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;To be clear, all Bluetooh LE encryption is using 128 bit AES CCM. The difference is in various way the LTK is established. To use level 4, there has to be some form of I/O for numeric comparision or passkey entry, or other out of band method. What I/O do you have on your device and what do you want to use for this? If you do not have I/O that can be used for this, you cannot achieve level 4 security.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Security Level 4 Connection Failure in Central</title><link>https://devzone.nordicsemi.com/thread/528283?ContentTypeID=1</link><pubDate>Thu, 20 Mar 2025 18:08:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ffb036d4-3b45-4257-b7b6-b47cbed4766f</guid><dc:creator>Yash48</dc:creator><description>&lt;p data-start="120" data-end="131"&gt;Hi Einar,&lt;/p&gt;
&lt;p data-start="133" data-end="451"&gt;Thanks for your response! I understand that Security Level 4 requires Authenticated LE Secure Connections (LESC) and a 128-bit encryption key.&lt;/p&gt;
&lt;p data-start="133" data-end="451"&gt;you&amp;#39;re absolutely correct! that&amp;nbsp;&amp;nbsp;Numeric Comparison requires a display or input, while 128-bit AES-CCM encryption does not.&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;I have&amp;nbsp; questions regarding implementing Security Level 4 (Authenticated Secure Connections with 128-bit encryption) on my devices:&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&lt;br /&gt;Question 1: Connection and Security Failure with Headset&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Setup:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Central: nRF5340 Audio DK&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Peripheral: A headset that advertises and waits for connection&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I want to establish a secure connection using Security Level 4&amp;nbsp; (Authenticated Secure Connections with 128-bit encryption).&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Issue:&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;The central initiates a connection, but it&lt;span&gt;&amp;nbsp;&lt;/span&gt;fails with an unknown connection ID error (err 2: BT_HCI_ERR_UNKNOWN_CONN_ID)&lt;span&gt;&amp;nbsp;&lt;/span&gt;after a timeout.&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:29.509,552] &amp;lt;inf&amp;gt; main: Received Command: connect 8C:64:A2:2D:76:BB 
[00:00:29.509,643] &amp;lt;inf&amp;gt; main: Attempting to connect to 8C:64:A2:2D:76:BB...
[00:00:29.612,548] &amp;lt;inf&amp;gt; main: Connection initiated index : 0 
[00:00:30.570,404] &amp;lt;wrn&amp;gt; bt_hci_core: Connection creation timeout triggered
[00:00:30.570,556] &amp;lt;err&amp;gt; main: Failed to connect to 8C:64:A2:2D:76:BB (random) (err 2: BT_HCI_ERR_UNKNOWN_CONN_ID)
ERROR: Failed to connect  (err 2 BT_HCI_ERR_UNKNOWN_CONN_ID) 
&lt;/pre&gt;&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;Question 2: Security Level 4 Failure Between Two nRF5340 Audio DK Boards&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Setup:&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Central: nRF5340 Audio DK&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Peripheral: Another nRF5340 Audio DK (running the example of peripheral secure only code)&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Security Level 4 is set on the central side.&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Issue&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;The connection establishes successfully, but Security Level 4 fails with error 9 (Authentication Failure) and then disconnects.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:09.458,526] &amp;lt;inf&amp;gt; main: Received Command: connect E7:56:71:C4:55:2D 

[00:00:09.458,618] &amp;lt;inf&amp;gt; main: Attempting to connect to E7:56:71:C4:55:2D...

[00:00:09.559,814] &amp;lt;inf&amp;gt; main: Connection initiated index : 0 
                                                               
[00:00:09.636,871] &amp;lt;inf&amp;gt; main: MTU exchanged: 23/23

[00:00:09.636,993] &amp;lt;inf&amp;gt; main: Connected: E7:56:71:C4:55:2D (random) (index 0)

[00:00:09.888,427] &amp;lt;err&amp;gt; main: Security failed: E7:56:71:C4:55:2D (random) level 1 err (9)

[00:00:09.888,458] &amp;lt;inf&amp;gt; main: Pairing Failed (9). Disconnecting.

[00:00:09.888,702] &amp;lt;inf&amp;gt; main: disconnect index : 0 

[00:00:09.888,793] &amp;lt;inf&amp;gt; main: Disconnected: E7:56:71:C4:55:2D (random), reason 0x05 (BT_HCI_ERR_AUTH_FAIL)

Disconnected:  (err 5 BT_HCI_ERR_AUTH_FAIL) 
&lt;/pre&gt;&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;Security Configurations in prj.conf&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BT_SMP=y
CONFIG_BT_BONDABLE=y
CONFIG_BT_BONDING_REQUIRED=y
CONFIG_BT_SMP_SC_PAIR_ONLY=y
CONFIG_BT_PRIVACY=y
CONFIG_BT_SMP_APP_PAIRING_ACCEPT=y
CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_HOST_CCM=y
CONFIG_BT_GATT_CACHING=y
CONFIG_BT_SETTINGS_CCC_STORE_ON_WRITE=y
CONFIG_BT_L2CAP_TX_MTU=128

CONFIG_SETTINGS=y
CONFIG_NVS=y
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
&lt;/pre&gt;&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&lt;/p&gt;
&lt;p data-start="453" data-end="601"&gt;&lt;/p&gt;
&lt;p data-start="4079" data-end="4173"&gt;I want to ensure that in both cases&amp;nbsp; my central device successfully enforces Security Level 4 and pairing &lt;span&gt;should&amp;nbsp;&lt;/span&gt;success, meaning:&lt;/p&gt;
&lt;ul data-start="3920" data-end="4141"&gt;
&lt;li data-start="3920" data-end="3983"&gt;Security Level 4 should be enforced on all connections.&lt;/li&gt;
&lt;li data-start="3984" data-end="4064"&gt;128-bit encryption should be applied between the central and peripheral.&lt;/li&gt;
&lt;li data-start="4065" data-end="4141"&gt;Pairing should succeed without downgrading to lower security levels.&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-start="4143" data-end="4216"&gt;Would appreciate guidance on what I might be missing or need to adjust!&lt;/p&gt;
&lt;p data-start="4218" data-end="4238"&gt;Thanks in advance!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Security Level 4 Connection Failure in Central</title><link>https://devzone.nordicsemi.com/thread/528222?ContentTypeID=1</link><pubDate>Thu, 20 Mar 2025 12:57:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:667f60aa-deff-4f93-b643-038685cd90ec</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]Are my configurations correct for enforcing Security Level 4?[/quote]
&lt;p&gt;Security level 4 is Autenticated LESC, so there is a form of numeric comparison or passkey entry. As you are making an audio product this is a bit unusual, as there is typically no other I/O than a speaker and/or microhone. That said, I see from your code snippets that you have code for passkey handling, so the basics are in place. Note that in Bluetooth the security requiermetns are set for each characteristic separately&lt;/p&gt;
&lt;p&gt;Other than that, it looks like the question has been processed by AI, and it is difficult to extract the key information here and ther eare some information that I suspect may be some &lt;a href="https://en.wikipedia.org/wiki/Hallucination_(artificial_intelligence)"&gt;AI&amp;nbsp;hallucination&lt;/a&gt;. Can you share your original (non AI processed) question?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>