<?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>How to pair and bond with a static passkey?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114350/how-to-pair-and-bond-with-a-static-passkey</link><description>I developed a project that using static passkey to pair and bond with nRF SDK17. 
 It be fulfilled by the follow way: 
 
 
 However,when I turn to NCS,I don&amp;#39;t know how to fulfill it. 
 I used the hid_mouse sample but it just push the button to confirm</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 12 Sep 2024 21:12:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114350/how-to-pair-and-bond-with-a-static-passkey" /><item><title>RE: How to pair and bond with a static passkey?</title><link>https://devzone.nordicsemi.com/thread/502389?ContentTypeID=1</link><pubDate>Thu, 12 Sep 2024 21:12:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90226199-d3e4-4327-88e5-69707f761a10</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Ok, thank you for showing me. This could actually be unrelated to the security part. Do you know what connection interval that is being used? A sniffer trace using nRF Connect for Bluetooth LE would reveal this, and probably also reveal what takes so long. I suspect it is a long connection interval being used. I didn&amp;#39;t see that you specify it anywhere, so it could be the phone that is selecting a long connection interval. It is possible for your peripheral to request a shorter connection interval, so that is something we could try. For a guide, you can follow the Nordic Developer Academy, and the Bluetooth Low Energy Fundamentals course. Particularly &lt;a href="https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-3-bluetooth-le-connections/topic/blefund-lesson-3-exercise-2/"&gt;Lesson 3, exercise 2&lt;/a&gt;, steps 1-6 is relevant for this. It will also tell you the connection interval without using a sniffer, based on the connection callbacks from your application.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to pair and bond with a static passkey?</title><link>https://devzone.nordicsemi.com/thread/501812?ContentTypeID=1</link><pubDate>Tue, 10 Sep 2024 00:31:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c95271d-5359-4f20-b477-6720505a6661</guid><dc:creator>Chaoyue Ying</dc:creator><description>&lt;p&gt;It is slow as case 1 that you say,just like that as follow:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/SVID_5F00_20240910_5F00_082715_5F00_1.mp4"&gt;devzone.nordicsemi.com/.../SVID_5F00_20240910_5F00_082715_5F00_1.mp4&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There no the same 5 second delay when I test cgms in my HW.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to pair and bond with a static passkey?</title><link>https://devzone.nordicsemi.com/thread/501683?ContentTypeID=1</link><pubDate>Mon, 09 Sep 2024 09:48:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ee1324d-1bd3-4ef6-b5a8-5a28a9c091ab</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Do you mean that it is slow:&lt;/p&gt;
&lt;p&gt;1: after you have entered the code and press &amp;quot;confirm&amp;quot;&lt;/p&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;p&gt;2: It takes a long time before the popup with the passkey appears?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In my test, using the&amp;nbsp;&lt;span&gt;ncs\nrf\samples\bluetooth\peripheral_cgms on an nRF52832 DK the time after pressing confirm was almost instantly. Can you please try this sample on both a DK and your custom hardware? You don&amp;#39;t need to worry about setting the static passkey, as this shouldn&amp;#39;t affect the time it takes roughly one second before I can see it in the log, but the logging has some delay.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Can you see if you see the same 5 second delay in that application on a) a DK and b) your HW?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Edvin&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to pair and bond with a static passkey?</title><link>https://devzone.nordicsemi.com/thread/501622?ContentTypeID=1</link><pubDate>Mon, 09 Sep 2024 00:26:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03a25307-1663-416a-91ee-92f227f9519f</guid><dc:creator>Chaoyue Ying</dc:creator><description>&lt;p&gt;When I using my phone to connect with my board , The pop-up is quick appeared.&lt;/p&gt;
&lt;p&gt;The waiting happen at the time that I entry passkey and confirm.&lt;/p&gt;
&lt;p&gt;The display of phone is pairing and the process will keep about five seconds.&lt;/p&gt;
&lt;p&gt;But it finished&amp;nbsp;immediately when I use the application in nRF SDK.&lt;/p&gt;
&lt;p&gt;The board using to test is designed by myself that refer to&amp;nbsp;official design.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to pair and bond with a static passkey?</title><link>https://devzone.nordicsemi.com/thread/501546?ContentTypeID=1</link><pubDate>Fri, 06 Sep 2024 12:49:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a03b2248-3711-4028-9009-59bfe6b9bb6c</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;What do you mean by slow? How long does it take?&lt;/p&gt;
&lt;p&gt;It looks like it happens almost instantly when I run it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What HW are you running on? The nRF52832 DK?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to pair and bond with a static passkey?</title><link>https://devzone.nordicsemi.com/thread/501265?ContentTypeID=1</link><pubDate>Thu, 05 Sep 2024 05:03:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2fd4d395-5403-40ec-853f-fde8c816c0e0</guid><dc:creator>Chaoyue Ying</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/1202.rar"&gt;devzone.nordicsemi.com/.../1202.rar&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is the project file.It is semi-finished.&lt;/p&gt;
&lt;p&gt;Now I seem realize the pairing and bonding with passkey successfully.But the time of this process seem a little bit long,at least longer than it in nrf SDK.If there have some methods to let it quicker?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to pair and bond with a static passkey?</title><link>https://devzone.nordicsemi.com/thread/501051?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2024 00:52:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4cb0fc8b-6c80-4b94-b5cf-e617a938c38e</guid><dc:creator>Chaoyue Ying</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;I checked the code of cgms.But it use the security_change to trigger the process of pairing.&lt;/p&gt;
&lt;p&gt;I want to arrive those function that using hid service and appearance to realize the board can be connected in my phone settings-&amp;gt;bluetooth.And find a way to realize when my board be connected,the phone need to input the passkey otherwise it will be refused and disconnected.&lt;/p&gt;
&lt;p&gt;But the cgms sample use&amp;nbsp; security_change that mean only have data change can trigger the pairing?&lt;/p&gt;
&lt;p&gt;It is unsuitable to my application.If there have other sample can I refer to?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to pair and bond with a static passkey?</title><link>https://devzone.nordicsemi.com/thread/500974?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2024 12:39:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9ca8f2a-4a2e-4288-907f-360591c2bb9e</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;We don&amp;#39;t have any samples using a static/fixed passkey (because of the false security it gives).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can check out the ncs\nrf\samples\bluetooth\peripheral_cgms, which uses a non-static passkey.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I was able to make this use a static passkey by adding CONFIG_BT_FIXED_PASSKEY=y in the prj.conf, and adding this snippet after settings_load(); (after bt_enable())&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;    err = bt_passkey_set(123456);
    printk(&amp;quot;bt_passkey_set returned %d\n&amp;quot;, err);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to pair and bond with a static passkey?</title><link>https://devzone.nordicsemi.com/thread/500858?ContentTypeID=1</link><pubDate>Tue, 03 Sep 2024 01:57:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9cbf39e6-a9ae-4cc0-a827-43330b88e330</guid><dc:creator>Chaoyue Ying</dc:creator><description>&lt;p&gt;The location of&amp;nbsp;bt_passkey_set() as above.The application run normally before pairing.And I debugged to check the return value of&amp;nbsp;bt_passkey_set() and the num is zero that mean set success.&lt;/p&gt;
&lt;p&gt;I think the issue due to conn_auth_callbacks.I&amp;#39;m not familiar with it.So I just copy it from hid_mouse.And the&amp;nbsp;passkey_confirm is high priority, so i&amp;#39;m failed to use passkey.&lt;/p&gt;
&lt;p&gt;If there have some samples use passkey to pairing?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to pair and bond with a static passkey?</title><link>https://devzone.nordicsemi.com/thread/500674?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2024 00:50:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20e111e4-82bc-4bda-ae03-e5cc7fc58f45</guid><dc:creator>Chaoyue Ying</dc:creator><description>&lt;p&gt;&lt;span class="mceItem mceInsertEmbeddableItem mceNonEditable" style="background-image:url(&amp;#39;/cfs-file/__key/communityserver-discussions-components-files/4/5531.embedcode.png&amp;#39;);"&gt;&lt;span class="preview"&gt;int&amp;nbsp;main(void) &lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; int主要(空白)&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; int主要(空白)&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; int主要(空白)&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; int主要(空白)&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; int主要(空白)&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; int主要(空白)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;span class="mceItem mceInsertEmbeddableItem mceNonEditable" style="background-image:url(&amp;#39;/cfs-file/__key/communityserver-discussions-components-files/4/5531.embedcode.png&amp;#39;);"&gt;&lt;span class="preview"&gt;{ &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;span class="mceItem mceInsertEmbeddableItem mceNonEditable" style="background-image:url(&amp;#39;/cfs-file/__key/communityserver-discussions-components-files/4/5531.embedcode.png&amp;#39;);"&gt;&lt;span class="preview"&gt;&amp;nbsp;&amp;nbsp;int&amp;nbsp;err; &lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; int犯错;&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; int犯错;&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; int犯错;&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; int犯错;&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; int犯错;&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; int犯错;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;span class="mceItem mceInsertEmbeddableItem mceNonEditable" style="background-image:url(&amp;#39;/cfs-file/__key/communityserver-discussions-components-files/4/5531.embedcode.png&amp;#39;);"&gt;&lt;span class="preview"&gt;&amp;nbsp;&amp;nbsp;uint32_t&amp;nbsp;blink_status&amp;nbsp;=&amp;nbsp;0; &lt;span class="yd-translate-container"&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;span class="mceItem mceInsertEmbeddableItem mceNonEditable" style="background-image:url(&amp;#39;/cfs-file/__key/communityserver-discussions-components-files/4/5531.embedcode.png&amp;#39;);"&gt;&lt;span class="preview"&gt;&amp;nbsp;&amp;nbsp;struct&amp;nbsp;dm_init_param&amp;nbsp;init_param; &lt;span class="yd-translate-container"&gt;&lt;span class="yd-wrapper-block yd-highlight"&gt;struct dm_init_param;&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span class="yd-wrapper-block yd-highlight"&gt;struct dm_init_param;&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span class="yd-wrapper-block yd-highlight"&gt;struct dm_init_param;&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span class="yd-wrapper-block yd-highlight"&gt;struct dm_init_param;&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span class="yd-wrapper-block yd-highlight"&gt;struct dm_init_param;&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span class="yd-wrapper-block yd-highlight"&gt;struct dm_init_param;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;span class="mceItem mceInsertEmbeddableItem mceNonEditable" style="background-image:url(&amp;#39;/cfs-file/__key/communityserver-discussions-components-files/4/5531.embedcode.png&amp;#39;);"&gt;&lt;span class="preview"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;span class="mceItem mceInsertEmbeddableItem mceNonEditable" style="background-image:url(&amp;#39;/cfs-file/__key/communityserver-discussions-components-files/4/5531.embedcode.png&amp;#39;);"&gt;&lt;span class="preview"&gt;&amp;nbsp;&amp;nbsp;printk(&amp;quot;1202&amp;nbsp;Start\n&amp;quot;); &lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; printk(&amp;ldquo;1202年开始\ n&amp;rdquo;);&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; printk(&amp;ldquo;1202年开始\ n&amp;rdquo;);&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; printk(&amp;ldquo;1202年开始\ n&amp;rdquo;);&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; printk(&amp;ldquo;1202年开始\ n&amp;rdquo;);&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; printk(&amp;ldquo;1202年开始\ n&amp;rdquo;);&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; printk(&amp;ldquo;1202年开始\ n&amp;rdquo;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;span class="mceItem mceInsertEmbeddableItem mceNonEditable" style="background-image:url(&amp;#39;/cfs-file/__key/communityserver-discussions-components-files/4/5531.embedcode.png&amp;#39;);"&gt;&lt;span class="preview"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;span class="mceItem mceInsertEmbeddableItem mceNonEditable" style="background-image:url(&amp;#39;/cfs-file/__key/communityserver-discussions-components-files/4/5531.embedcode.png&amp;#39;);"&gt;&lt;span class="preview"&gt;&amp;nbsp;&amp;nbsp;if&amp;nbsp;(!device_is_ready(uart)) &lt;span class="yd-translate-container"&gt;&lt;span class="yd-wrapper-block yd-highlight"&gt;如果(! device_is_ready (uart))&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span class="yd-wrapper-block yd-highlight"&gt;如果(! device_is_ready (uart))&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span class="yd-wrapper-block yd-highlight"&gt;如果(! device_is_ready (uart))&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span class="yd-wrapper-block yd-highlight"&gt;如果(! device_is_ready (uart))&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span class="yd-wrapper-block yd-highlight"&gt;如果(! device_is_ready (uart))&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span class="yd-wrapper-block yd-highlight"&gt;如果(! device_is_ready (uart))&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;span class="mceItem mceInsertEmbeddableItem mceNonEditable" style="background-image:url(&amp;#39;/cfs-file/__key/communityserver-discussions-components-files/4/5531.embedcode.png&amp;#39;);"&gt;&lt;span class="preview"&gt;&amp;nbsp;&amp;nbsp;{ &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;span class="mceItem mceInsertEmbeddableItem mceNonEditable" style="background-image:url(&amp;#39;/cfs-file/__key/communityserver-discussions-components-files/4/5531.embedcode.png&amp;#39;);"&gt;&lt;span class="preview"&gt;&amp;nbsp;printk(&amp;quot;UART&amp;nbsp;device&amp;nbsp;not&amp;nbsp;ready\r\n&amp;quot;); &lt;span class="yd-translate-container"&gt;&lt;span class="yd-wrapper-block yd-highlight"&gt;printk(&amp;quot;UART设备未就绪\r\n&amp;quot;);&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span class="yd-wrapper-block yd-highlight"&gt;printk(&amp;quot;UART设备未就绪\r\n&amp;quot;);&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span class="yd-wrapper-block yd-highlight"&gt;printk(&amp;quot;UART设备未就绪\r\n&amp;quot;);&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span class="yd-wrapper-block yd-highlight"&gt;printk(&amp;quot;UART设备未就绪\r\n&amp;quot;);&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span class="yd-wrapper-block yd-highlight"&gt;printk(&amp;quot;UART设备未就绪\r\n&amp;quot;);&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span class="yd-wrapper-block yd-highlight"&gt;printk(&amp;quot;UART设备未就绪\r\n&amp;quot;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;span class="mceItem mceInsertEmbeddableItem mceNonEditable" style="background-image:url(&amp;#39;/cfs-file/__key/communityserver-discussions-components-files/4/5531.embedcode.png&amp;#39;);"&gt;&lt;span class="preview"&gt;&amp;nbsp;return&amp;nbsp;1&amp;nbsp;; &lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; 返回1;&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; 返回1;&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; 返回1;&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; 返回1;&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; 返回1;&lt;/span&gt;&lt;/span&gt;&lt;span class="yd-translate-container"&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="yd-wrapper-inline yd-highlight"&gt; 返回1;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;span class="mceItem mceInsertEmbeddableItem mceNonEditable" style="background-image:url(&amp;#39;/cfs-file/__key/communityserver-discussions-components-files/4/5531.embedcode.png&amp;#39;);"&gt;&lt;span class="preview"&gt;&amp;nbsp;&amp;nbsp;} &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;span class="mceItem mceInsertEmbeddableItem mceNonEditable" style="background-image:url(&amp;#39;/cfs-file/__key/communityserver-discussions-components-files/4/5531.embedcode.png&amp;#39;);"&gt;&lt;span class="preview"&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int main(void)
{
	int err;
	uint32_t blink_status = 0;
	struct dm_init_param init_param;

	printk(&amp;quot;1202 Start\n&amp;quot;);

	if (!device_is_ready(uart))
	{
		printk(&amp;quot;UART device not ready\r\n&amp;quot;);
		return 1 ;
	}
	
	err = uart_callback_set(uart,uart_cb,NULL);
	if (err)
	{
		return err;
	}

	err = dk_leds_init();
	if (err) {
		printk(&amp;quot;LEDs init failed (err %d)\n&amp;quot;, err);
		return 0;
	}

	err = bt_passkey_set(pairing_passkey);
	if(err){
		printk(&amp;quot;passkey set failed(err %d)\n&amp;quot;,err);
		return 0;
	}

	err = bt_conn_auth_cb_register(&amp;amp;conn_auth_callbacks);
	if (err) {
		printk(&amp;quot;Failed to register authorization callbacks.\n&amp;quot;);
		return 0;
	}

	err = bt_conn_auth_info_cb_register(&amp;amp;conn_auth_info_callbacks);
	if (err) {
		printk(&amp;quot;Failed to register authorization info callbacks.\n&amp;quot;);
		return 0;
	}

	err = peer_init();
	if (err) {
		printk(&amp;quot;Peer init failed (err %d)\n&amp;quot;, err);
		return 0;
	}

	init_param.cb = &amp;amp;dm_cb;

	err = dm_init(&amp;amp;init_param);
	if (err) {
		printk(&amp;quot;Distance measurement init failed (err %d)\n&amp;quot;, err);
		return 0;
	}

	hid_init();

	err = bt_enable(NULL);
	if (err) {
		printk(&amp;quot;Bluetooth init failed (err %d)\n&amp;quot;, err);
		return 0;
	}

	k_work_init(&amp;amp;pairing_work, pairing_process);

	if (IS_ENABLED(CONFIG_SETTINGS)) {
		settings_load();
	}

	namecat();
	
	err = bt_set_name(name);
	if (err)
	{
		printk(&amp;quot;Name set failed (err %d)\n&amp;quot;,err);
		return 0;
	}
	

	err = bt_sync_init();
	if (err) {
		printk(&amp;quot;Synchronisation init failed (err %d)\n&amp;quot;, err);
		return 0;
	}

	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;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to pair and bond with a static passkey?</title><link>https://devzone.nordicsemi.com/thread/500667?ContentTypeID=1</link><pubDate>Sun, 01 Sep 2024 13:42:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1dff58e1-252a-49d5-82fe-21d88beae25e</guid><dc:creator>Chaoyue Ying</dc:creator><description>&lt;p&gt;Yes,Icall bt_passkey_set() at the main function but I didn&amp;#39;t care what has been returned.Maybe the error happened here?but it seem work normally&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to pair and bond with a static passkey?</title><link>https://devzone.nordicsemi.com/thread/500583?ContentTypeID=1</link><pubDate>Fri, 30 Aug 2024 12:24:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f9a21c60-894d-4e60-9363-8b1db390de10</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;So you want to input the key on the phone, right?&lt;/p&gt;
&lt;p&gt;Where do you currently call bt_passkey_set()? And what does it return?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to pair and bond with a static passkey?</title><link>https://devzone.nordicsemi.com/thread/500541?ContentTypeID=1</link><pubDate>Fri, 30 Aug 2024 09:15:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38337cba-8e17-4866-8150-59029d50fb52</guid><dc:creator>Chaoyue Ying</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I already set&amp;nbsp;&lt;span&gt;CONFIG_BT_FIXED_PASSKEY=y and use bt_passkey_set() to set the static passkey.&lt;span class="yd-translate-container"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But I think the relevant code that I used is misfit to the way that use the passkey.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I&amp;nbsp;imitate the hid_mouse that use&amp;nbsp;&lt;/span&gt;bt_conn_auth_cb_register() and&amp;nbsp;bt_conn_auth_info_cb_register() to replace the peer_manager in nRF SDK17.&lt;/p&gt;
&lt;p&gt;I think it is the issue that even&amp;nbsp;&lt;span&gt;CONFIG_BT_FIXED_PASSKEY=y and bt_passkey_set() be used,the pairing show in my phone still display a 8 length passkey and confirm 、cancal button rather than a input box just like this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/Screenshot_5F00_20240830_5F00_171336_5F00_com.android.settings.jpg" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And that&amp;#39;s what I want to achieve:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/8880.jpg" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to pair and bond with a static passkey?</title><link>https://devzone.nordicsemi.com/thread/500538?ContentTypeID=1</link><pubDate>Fri, 30 Aug 2024 08:55:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a45c748-a35e-4eaf-bb93-5a5db9072f88</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Please see this API:&lt;br /&gt;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.7.99-cs1/page/zephyr/connectivity/bluetooth/api/connection_mgmt.html#c.bt_passkey_set"&gt;https://docs.nordicsemi.com/bundle/ncs-2.7.99-cs1/page/zephyr/connectivity/bluetooth/api/connection_mgmt.html#c.bt_passkey_set&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As you can see from the description, you need to set CONFIG_BT_FIXED_PASSKEY=y for this API to work.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also note that using a fixed/static passkey doesn&amp;#39;t really provide any real security. It is possible to brute force relatively easily, and it is also possible to sniff/capture and crack it later. Adding LESC on top of a static passkey will increase the security though, since the sniffer can&amp;#39;t pick up the Diffie Hellman keys (used in LESC).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But that being said, the security risk of a BLE mouse is relatively low. Even though someone would be able to listen in, the value of the data from a mouse is relatively low, which is why it usually doesn&amp;#39;t use a (non-static) passkey in the first place.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;A fixed passkey does however make it easier for the user to know that they connect to the correct device, since a normal user would see that they are able to use e.g. a 6-digit key printed on a sticker somewhere.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>