<?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>Softdevice, pairing and connecting to bonded device</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73095/softdevice-pairing-and-connecting-to-bonded-device</link><description>Hello, 
 While I was testing the codes, I just got a few errors and I am confused as to why it&amp;#39;s happening. The questions are: 
 1) Sometimes, I get pm_conn_secure error code 17 and I found out it&amp;#39;s NRF_ERROR_BUSY. Is there some way to avoid it. I am</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 26 Mar 2021 10:13:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73095/softdevice-pairing-and-connecting-to-bonded-device" /><item><title>RE: Softdevice, pairing and connecting to bonded device</title><link>https://devzone.nordicsemi.com/thread/302097?ContentTypeID=1</link><pubDate>Fri, 26 Mar 2021 10:13:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a62829d7-65cb-4e99-a106-9c7b4fc4c8c3</guid><dc:creator>GOAA</dc:creator><description>&lt;p&gt;Sorry for the confusion &lt;a href="https://devzone.nordicsemi.com/members/simonr"&gt;Simonr&lt;/a&gt;, I had given an unnecessary delay which was causing the whole problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Softdevice, pairing and connecting to bonded device</title><link>https://devzone.nordicsemi.com/thread/302044?ContentTypeID=1</link><pubDate>Fri, 26 Mar 2021 05:22:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3767484b-c7d7-42e3-95dd-ebbbafaa7622</guid><dc:creator>GOAA</dc:creator><description>&lt;p&gt;The time it takes to pair with a new device.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/8308.pairing.PNG" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The time it takes to connect with a previously paired device.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/8081.connecting.PNG" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I hope this is what you meant by debug log.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Softdevice, pairing and connecting to bonded device</title><link>https://devzone.nordicsemi.com/thread/301812?ContentTypeID=1</link><pubDate>Thu, 25 Mar 2021 08:12:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afda0d50-2c79-4000-b675-5d336bc68850</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Okay, this seems to take a bit too long then, do you have a debug log with timestamps or maybe you can take a sniffer trace so we can get some details as to what exactly is taking time in this process? If you have an nRF52 DK you can use it as a sniffer with the &lt;a href="https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Sniffer-for-Bluetooth-LE"&gt;nRF Sniffer firmware &lt;/a&gt;and Wireshark for example.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Softdevice, pairing and connecting to bonded device</title><link>https://devzone.nordicsemi.com/thread/301739?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 15:29:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e019d41-7a83-4882-a674-ee5457472643</guid><dc:creator>GOAA</dc:creator><description>[quote userid="75734" url="~/f/nordic-q-a/73095/softdevice-pairing-and-connecting-to-bonded-device/301683#301683"]Can you confirm whether it is the time&amp;nbsp;from the DISCONNECTED to CONNNECTED&amp;nbsp;events or from the CONNECTED event until the devices are paired again that takes ~5 seconds by debugging?[/quote]
&lt;p&gt;Time taken is from the time I get BLE_adv_report and if the UUID match request does match to the time I get connection secured event. Basically if UUIDs match I call connect request, from that time till I get connection secured event. I call pm_conn_secure once I receive the BLE_GAP_connected event.&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/73095/softdevice-pairing-and-connecting-to-bonded-device/301683#301683"]How do you handle the&amp;nbsp; BLE_GAP_EVT_DISCONNECTED event for instance?[/quote]
&lt;p&gt;Central : start scanning with whitelist.&lt;/p&gt;
&lt;p&gt;Peripheral : directed advertising and then fast advertising with whitelist.&lt;/p&gt;
&lt;p&gt;Thank you for your Help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Softdevice, pairing and connecting to bonded device</title><link>https://devzone.nordicsemi.com/thread/301683?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 13:11:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da4423fa-ec39-4128-a880-56382eb2a571</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;2. Okay, I didn&amp;#39;t realize this was about the re-connection taking too long. Thank you for explaining. Can you confirm whether it is the time&amp;nbsp;from the DISCONNECTED to CONNNECTED&amp;nbsp;events or from the CONNECTED event until the devices are paired again that takes ~5 seconds by debugging? How do you handle the&amp;nbsp; BLE_GAP_EVT_DISCONNECTED event for instance?&lt;/p&gt;
&lt;p&gt;3. Well, if you don&amp;#39;t ask for a return code (ret_code) then you won&amp;#39;t get any, the error will still occur, but won&amp;#39;t be printed for you to see, which will make it hard for you to see what (or if something) is wrong.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Softdevice, pairing and connecting to bonded device</title><link>https://devzone.nordicsemi.com/thread/301573?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 05:44:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9268242d-7154-4b2d-b851-c12cae49eb70</guid><dc:creator>GOAA</dc:creator><description>[quote userid="75734" url="~/f/nordic-q-a/73095/softdevice-pairing-and-connecting-to-bonded-device/301445#301445"]so you could add a check to make sure that the devices are &amp;quot;ready[/quote]
&lt;p&gt;Thats cool. I can try that.&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/73095/softdevice-pairing-and-connecting-to-bonded-device/301445#301445"]I&amp;#39;m not sure I understand what you mean with this question.[/quote]
&lt;p&gt;Ok, i will try to explain it even further. I am trying to connect two nrf52832 chips and pair them. First, i scan without whitelist and the two devices connect and pair in like 500 ms.&lt;/p&gt;
&lt;p&gt;Then, I disconnect the device and start advertising in the peripheral and scanning in central, both using whitelist (which contains the information of previously bonded device). The pairing of this takes around 5sec. Why is it that this is slower than the first one is my question?&lt;/p&gt;
&lt;p&gt;In other words once I call sd_ble_gap_connect(), it takes more time while connecting to a device with whitelist enabled than a device without whitelist enabled.&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/73095/softdevice-pairing-and-connecting-to-bonded-device/301445#301445"]So it shouldn&amp;#39;t be stored or &amp;quot;destroyed&amp;quot; at all if that&amp;#39;s what you mean.[/quote]
&lt;p&gt;Ok, basically consider two scenarios&lt;/p&gt;
&lt;p&gt;Scenario 1 : ret_code_t ret = sd_ble_gap_advertising_start();&lt;/p&gt;
&lt;p&gt;In this case, if my parameters are correct I get ret as success which is zero.&lt;/p&gt;
&lt;p&gt;Suppose I call only call&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;s_ble_gap_advertising_start();&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;Where does the error code which returns from the softdevice go?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Softdevice, pairing and connecting to bonded device</title><link>https://devzone.nordicsemi.com/thread/301445?ContentTypeID=1</link><pubDate>Tue, 23 Mar 2021 13:41:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58813fc0-72a5-47af-8d2e-2f442e9c5a4a</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;1. An NRF_ERROR_BUSY from pm_conn_secure() will return if a security procedure is already in progress on the link, or if the link is disconnecting /disconnected. So if the devices aren&amp;#39;t disconnected it&amp;#39;s likely due to the devices being in a security procedure already, so you could add a check to make sure that the devices are &amp;quot;ready&amp;quot; or add a delay before calling pm_conn_secure().&lt;/p&gt;
&lt;p&gt;2. I&amp;#39;m not sure I understand what you mean with this question. The devices will pair after they have connected, not the other way around. Also, are you using two nRF52832 devices in this connection, or are you using a phone for one of the roles for instance?&lt;/p&gt;
&lt;p&gt;3. If you don&amp;#39;t get an error code, that should mean you &amp;quot;passed&amp;quot; the function, and it won&amp;#39;t be called at all. So it shouldn&amp;#39;t be stored or &amp;quot;destroyed&amp;quot; at all if that&amp;#39;s what you mean. If you&amp;#39;re wondering where the error codes are described, this is usually in the comments on header files. Like for pm_conn_secure(), you can find the various error messages described in&amp;nbsp;\SDK_FOLDER\nRF5_SDK_17.0.2_d674dde\components\ble\peer_manager\peer_manager.h&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>