<?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>Zephyr/NCS BLE Central accepting fixed passkey</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/72033/zephyr-ncs-ble-central-accepting-fixed-passkey</link><description>Hi, 
 
 I have successfully created a BT Peripheral which uses a static/fixed passkey upon connection with my phone (nrf connect mobile) or using the nrf52840 dongle. When I connect with the peripheral, I am prompted for the passkey on my phone or desktop</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 15 Jun 2021 12:08:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/72033/zephyr-ncs-ble-central-accepting-fixed-passkey" /><item><title>RE: Zephyr/NCS BLE Central accepting fixed passkey</title><link>https://devzone.nordicsemi.com/thread/315382?ContentTypeID=1</link><pubDate>Tue, 15 Jun 2021 12:08:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e17e600-4c9e-4838-b522-ad784052846e</guid><dc:creator>Nhuan</dc:creator><description>&lt;p&gt;Hi Jonas,&lt;/p&gt;
&lt;p&gt;How can you create a bond with&amp;nbsp;&lt;span&gt;fixed passkey on&amp;nbsp;peripheral&amp;nbsp;device and phone ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I&amp;#39;m trying but it is not worked&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr/NCS BLE Central accepting fixed passkey</title><link>https://devzone.nordicsemi.com/thread/298405?ContentTypeID=1</link><pubDate>Mon, 08 Mar 2021 13:54:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3595678e-d92d-4c5e-a5fb-1953bd1c129b</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;There is an error on the peripheral side&amp;nbsp;here, so we need to solve that crash first. Can you start by finding which file/line causes problems by using&amp;nbsp;&lt;code&gt;arm-none-eabi-addr2line -e &amp;lt;project_folder&amp;gt;/build/zephyr/zephyr.elf 0x51308&lt;/code&gt; ? What code do you have on that line? Please share some code amount it as well to provide context, or even better your whole project.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr/NCS BLE Central accepting fixed passkey</title><link>https://devzone.nordicsemi.com/thread/298170?ContentTypeID=1</link><pubDate>Fri, 05 Mar 2021 16:09:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d89cebf7-e215-4dec-8c9f-0ddf094a8b21</guid><dc:creator>Jonas Lien</dc:creator><description>&lt;p&gt;Sorry for the late reply, Einar!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Following is what happens on the Peripheral side:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1614959253036v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And the Centrals side:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1614959301542v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It fails when trying to deal with this custom service I&amp;#39;ve made. This works when no encryption is enforced, however I&amp;#39;ve now set it to:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;BT_GATT_SERVICE_DEFINE(project_service,
  BT_GATT_PRIMARY_SERVICE(&amp;amp;bt_uuid_project_service),
  BT_GATT_CHARACTERISTIC(&amp;amp;bt_uuid_project_characteristic1.uuid, BT_GATT_CHRC_READ,
                        BT_GATT_PERM_READ_ENCRYPT, read_cb1, NULL, NULL),
  BT_GATT_CHARACTERISTIC(&amp;amp;bt_uuid_project_characteristic2.uuid, BT_GATT_CHRC_READ, 
                        BT_GATT_PERM_READ_ENCRYPT, read_cb2, NULL, NULL),
  BT_GATT_CHARACTERISTIC(&amp;amp;bt_uuid_project_characteristic3.uuid, BT_GATT_CHRC_READ,
                        BT_GATT_PERM_READ_ENCRYPT, read_cb3, NULL, NULL),
  BT_GATT_CHARACTERISTIC(&amp;amp;bt_uuid_project_characteristic4.uuid, BT_GATT_CHRC_READ | BT_GATT_CHRC_WRITE,
                        BT_GATT_PERM_READ_ENCRYPT | BT_GATT_PERM_WRITE_ENCRYPT, read_cb4, write_cb4, NULL),
  BT_GATT_CHARACTERISTIC(&amp;amp;bt_uuid_project_characteristic5.uuid, BT_GATT_CHRC_READ | BT_GATT_CHRC_WRITE,
                        BT_GATT_PERM_READ_ENCRYPT | BT_GATT_PERM_WRITE_ENCRYPT, read_cb5, write_cb5, NULL),
);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and the Peripheral breaks down after fulfilling connected():&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void connected(struct bt_conn *conn, uint8_t err)
{
if (err) {
printk(&amp;quot;Connection failed (err 0x%02x)\n&amp;quot;, err);
} else {
printk(&amp;quot;Connected\n&amp;quot;);
}

int sec = bt_conn_get_security(conn);
printk(&amp;quot;security level is: %d\n&amp;quot;, sec); //sec = 1 upon connection

}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;To answer your other question, passkey_confirm() doesnt get invoked on the Central either. Just let me know if you&amp;#39;d want me to paste the complete code, I&amp;#39;d just have to rename some variables like I did in the service register function &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr/NCS BLE Central accepting fixed passkey</title><link>https://devzone.nordicsemi.com/thread/296298?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2021 14:19:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8c761fe-e86f-4694-bc56-a59645704b49</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Jonas,&lt;/p&gt;
&lt;p&gt;Your code snippets look correct to me. Can you explain in what way it does not work (adding some logging may be useful)? Is&amp;nbsp;passkey_confirm() called at all?&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>