<?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>Static passkey - central and peripheral code issues (NCS connect)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/101216/static-passkey---central-and-peripheral-code-issues-ncs-connect</link><description>Good morning everyone, 
 
 I am going crazy to solve this problem, but I hope we can figure it out with some help. 
 I am working on a prototype for which we need to use a static passkey (we know the security risks and that this is strongly discouraged</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 27 Jan 2025 09:58:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/101216/static-passkey---central-and-peripheral-code-issues-ncs-connect" /><item><title>RE: Static passkey - central and peripheral code issues (NCS connect)</title><link>https://devzone.nordicsemi.com/thread/520135?ContentTypeID=1</link><pubDate>Mon, 27 Jan 2025 09:58:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26aeb956-ce45-425e-bdfc-1a051da9f50f</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Please make a new case, since it may not be directly related.&lt;/p&gt;
&lt;p&gt;Also, if possible try to attach on-air sniffer log and example&amp;nbsp;on which&amp;nbsp;bt_conn_auth_cb conn_auth_callbacks you have defined on the central and peripheral. For instance one need to be the display and the other the passkey entry.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Static passkey - central and peripheral code issues (NCS connect)</title><link>https://devzone.nordicsemi.com/thread/520065?ContentTypeID=1</link><pubDate>Sat, 25 Jan 2025 02:49:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f96a1af8-3562-4c73-b1b1-a0743672ce88</guid><dc:creator>GerardoF</dc:creator><description>&lt;p&gt;Has anyone been able to fix this issue? I&amp;#39;m using a nRF52 PCA10040 as my central and I always get &amp;quot;Device found: EB:E1:BD:6F:9F:82 (random), RSSI: -56&lt;br /&gt;Found device name: SB-3100043&lt;br /&gt;Matching device found: EB:E1:BD:6F:9F:82 (random). Attempting to connect...&lt;br /&gt;Connection successfully created&lt;br /&gt;Connected&lt;br /&gt;Security level 3 requested (encrypted connection)&lt;br /&gt;[00:00:05.560,272] &amp;lt;err&amp;gt; bt_smp: pairing failed (peer reason 0x8)&lt;br /&gt;Security failed: EB:E1:BD:6F:9F:82 (random) level 1 err 9&amp;quot; Please help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Static passkey - central and peripheral code issues (NCS connect)</title><link>https://devzone.nordicsemi.com/thread/433481?ContentTypeID=1</link><pubDate>Wed, 28 Jun 2023 13:17:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb44be7c-68ba-4322-b9a6-8789105b99f4</guid><dc:creator>lbe</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Thanks for the suggestion....I&amp;#39;ll try to put this in place and come back to you with the results&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Static passkey - central and peripheral code issues (NCS connect)</title><link>https://devzone.nordicsemi.com/thread/433446?ContentTypeID=1</link><pubDate>Wed, 28 Jun 2023 11:38:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:065d2637-a3cb-4d27-a9a5-94f3eaf17ef2</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Do you have the possibility to capture an on-air sniffer log?&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ug_sniffer_ble/UG/sniffer_ble/intro.html"&gt;https://infocenter.nordicsemi.com/topic/ug_sniffer_ble/UG/sniffer_ble/intro.html&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;After installation you can:&lt;a href="https://infocenter.nordicsemi.com/topic/ug_sniffer_ble/UG/sniffer_ble/action_paired.html"&gt;&lt;br /&gt;https://infocenter.nordicsemi.com/topic/ug_sniffer_ble/UG/sniffer_ble/action_paired.html&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Static passkey - central and peripheral code issues (NCS connect)</title><link>https://devzone.nordicsemi.com/thread/433270?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2023 13:40:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7968983-2453-4d3b-8a90-e36572571050</guid><dc:creator>lbe</dc:creator><description>&lt;p&gt;Hello again, thanks for helping out on this.&lt;/p&gt;
&lt;p&gt;Actually, I already tried also this combination (I mean, without the CONFIG_BT_FIXED_PASSKEY=y) , but my .passkey_entry callback is never called.&lt;/p&gt;
&lt;p&gt;Its code is the following&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void passkey_entry(struct bt_conn *conn)
{
	LOG_INF(&amp;quot;Calling Passkey entry\n&amp;quot;);
	char addr[BT_ADDR_LE_STR_LEN];
	default_conn = bt_conn_ref(conn);
	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	unsigned int fixed_passkey = 223344;
	bt_conn_auth_passkey_entry(conn, fixed_passkey);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;and as shown above it is defined here&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static struct bt_conn_auth_cb conn_auth_callbacks = {
	.passkey_entry = passkey_entry,
	.cancel = auth_cancel,
};
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I do not seem to ever reach this point though, because of the &amp;quot;Security Failed&amp;quot; message following the bt_set_security....&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Static passkey - central and peripheral code issues (NCS connect)</title><link>https://devzone.nordicsemi.com/thread/433261?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2023 13:17:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84c22a57-dcb2-48fa-9c81-8e134b8eb90b</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;I can see you have&amp;nbsp;CONFIG_BT_FIXED_PASSKEY=y,&amp;nbsp;you should not need that. Since that will be handled by:&amp;nbsp;For the device with passkey entry you will need to register a .passkey_entry callback in conn_auth_callbacks, make sure to call bt_conn_auth_passkey_entry(with 123456) in the callback.&lt;/p&gt;
&lt;p&gt;Can you try without?&lt;/p&gt;
&lt;p&gt;Kenneth&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Static passkey - central and peripheral code issues (NCS connect)</title><link>https://devzone.nordicsemi.com/thread/433238?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2023 12:31:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72359704-3a82-4d73-bd11-282d32ba2572</guid><dc:creator>lbe</dc:creator><description>&lt;p&gt;Yes, this is what I think too....&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is my prj.conf file&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Enable the UART driver
CONFIG_UART_ASYNC_API=y
CONFIG_NRFX_UARTE0=y
CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

# Enable the BLE stack with GATT Client configuration
CONFIG_BT=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_GATT_CLIENT=y

# Enable the BLE modules from NCS
CONFIG_BT_NUS_CLIENT=y
CONFIG_BT_SCAN=y
CONFIG_BT_SCAN_FILTER_ENABLE=n
CONFIG_BT_GATT_DM=y
CONFIG_HEAP_MEM_POOL_SIZE=2048

# This example requires more workqueue stack
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# Enable bonding
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_FIXED_PASSKEY=y



# Config logger
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=n
CONFIG_LOG_BACKEND_UART=y

CONFIG_BT_LOG_LEVEL_OFF=y

CONFIG_ASSERT=y


&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Static passkey - central and peripheral code issues (NCS connect)</title><link>https://devzone.nordicsemi.com/thread/433223?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2023 12:08:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0526d30b-b2cb-4f4d-b73e-023da67c27cf</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;What&amp;nbsp;conn_auth_callbacks and conn_auth_info_callbacks have you set on the central?&lt;/p&gt;
&lt;p&gt;Edit: Never mind, I can see those above.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Static passkey - central and peripheral code issues (NCS connect)</title><link>https://devzone.nordicsemi.com/thread/433221?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2023 12:07:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ee1b8e7-7d33-4c1b-bb05-c256e3f5d13a</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;If the peripheral works with the phone, then the problem here is the central.&lt;/p&gt;
&lt;p&gt;Are you sure the central actually support security? What does the prj.conf look like?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Static passkey - central and peripheral code issues (NCS connect)</title><link>https://devzone.nordicsemi.com/thread/433188?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2023 11:10:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b903ca7-b461-442a-96c9-b4497ad26a26</guid><dc:creator>lbe</dc:creator><description>&lt;p&gt;I tried, but anything other than BT_SECURITY_L1 gives the same errors.&lt;/p&gt;
&lt;p&gt;My impression is that the peripheral awaits for some information that is not sent to it.....&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Static passkey - central and peripheral code issues (NCS connect)</title><link>https://devzone.nordicsemi.com/thread/433169?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2023 10:03:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:614e9c3c-15de-4afb-88ad-d1e8748cb4c7</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Isn&amp;#39;t&amp;nbsp;BT_SECURITY_L4 le secure connection? You should likely try&amp;nbsp;BT_SECURITY_L3.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Static passkey - central and peripheral code issues (NCS connect)</title><link>https://devzone.nordicsemi.com/thread/433159?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2023 09:37:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d10a27a-cbe2-422c-9813-ad248887b7f3</guid><dc:creator>lbe</dc:creator><description>&lt;p&gt;Hello Kenneth, thanks for the pointer, but I already read that discussion and followed the indicated steps.&lt;/p&gt;
&lt;p&gt;As of now, I have in fact the peripheral working fine and accepting a static passkey sent using the smartphone app &amp;quot;Nrf Connect&amp;quot;.&lt;/p&gt;
&lt;p&gt;My problem is when I use a nrf52833DK as a central instead of the smartphone: whatever I try, I get the errors indicated in the original post...It seems that the problems start when I call the&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;	err = bt_conn_set_security(conn, BT_SECURITY_L4);
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;which is not accepted by the peripheral....&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So, what is the central supposed to send to the peripheral? At what moment should the central send the passkey to validate its connection to the peripheral?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Static passkey - central and peripheral code issues (NCS connect)</title><link>https://devzone.nordicsemi.com/thread/433152?ContentTypeID=1</link><pubDate>Tue, 27 Jun 2023 09:10:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2fe2890a-af1c-4893-ae2f-4bca02b13ddd</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;A long time ago I made an example,&amp;nbsp;likely the example will not compile in new NCS releases, but I would expect the code is readable enough to understand what I did at the time:&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/69202/zephyr-ble-static-passkey-between-central-and-peripheral-on-two-nrf52840s"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/69202/zephyr-ble-static-passkey-between-central-and-peripheral-on-two-nrf52840s&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>