<?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>Immediate disconnect from bonded device with reason 42</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73153/immediate-disconnect-from-bonded-device-with-reason-42</link><description>We have a design that uses a simple custom board with an NRF52832 chip, button, accelerometer and onboard battery. For many phones, the operation is quite stable - we connect, bond, and subscribe to notifications and don&amp;#39;t see any unusual behavior. However</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 26 Mar 2021 01:19:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73153/immediate-disconnect-from-bonded-device-with-reason-42" /><item><title>RE: Immediate disconnect from bonded device with reason 42</title><link>https://devzone.nordicsemi.com/thread/302031?ContentTypeID=1</link><pubDate>Fri, 26 Mar 2021 01:19:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:547c77ed-bea7-45c4-9248-e95adf1845cf</guid><dc:creator>emb_dev</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;/p&gt;
&lt;p&gt;Thank you for your help - removing the pm_handler_on_pm_evt() call from the pm_event_handler() function seems to have resolved our issue and we no-longer see the reason 42 disconnects after bonding. Is there a more detailed explanation for why certain versions do not play nicely with the SMP request?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Immediate disconnect from bonded device with reason 42</title><link>https://devzone.nordicsemi.com/thread/302001?ContentTypeID=1</link><pubDate>Thu, 25 Mar 2021 17:14:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1a33ece-2e9e-4191-9fd6-623087c34e88</guid><dc:creator>Kenneth</dc:creator><description>[quote user="emb_dev"]*Edit: we also see the same SMP request on the phone where the reconnect-after-bond is successful (from the bondingTestPassed1 logs) and it does not seem to cause any issues - is this a difference in how the bl version / android&amp;nbsp;versions handle this request?[/quote]
&lt;p&gt;Yes.&lt;/p&gt;
&lt;p&gt;I might have linked the wrong api call, try to comment out:&amp;nbsp;pm_handler_on_pm_evt().&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Immediate disconnect from bonded device with reason 42</title><link>https://devzone.nordicsemi.com/thread/301997?ContentTypeID=1</link><pubDate>Thu, 25 Mar 2021 16:51:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a7a9804-ffbb-4bd0-be8c-e9b2cece5204</guid><dc:creator>emb_dev</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;/p&gt;
&lt;p&gt;We just checked and the function is not called anywhere in our code. However, just to make sure, we deleted the definition and declaration in peer_manager_handler.c and peer_manager_handler.h, rebuilt the application and tested with the same results. Do you have any thoughts on where else the SMP request could be coming from so we can check, or is it time to submit the code for a private review?&lt;/p&gt;
&lt;p&gt;*Edit: we also see the same SMP request on the phone where the reconnect-after-bond is successful (from the bondingTestPassed1 logs) and it does not seem to cause any issues - is this a difference in how the bl version / android&amp;nbsp;versions handle this request?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Immediate disconnect from bonded device with reason 42</title><link>https://devzone.nordicsemi.com/thread/301995?ContentTypeID=1</link><pubDate>Thu, 25 Mar 2021 16:37:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3dddd8ae-0ad2-4dbd-bda8-01a356ffc53e</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Can&amp;nbsp; you just search through your project for&amp;nbsp;&lt;span&gt;pm_handler_secure_on_connection()?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;It could explain your problem, because I can see from the sniffer log that the peripheral is sending a SMP security request after connection, and I have seen this may trigger an issue on android phones. So trying to find out where this request is comming from is what I recommend:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1616690214355v1.png" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kenneth&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Immediate disconnect from bonded device with reason 42</title><link>https://devzone.nordicsemi.com/thread/301982?ContentTypeID=1</link><pubDate>Thu, 25 Mar 2021 16:03:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b6bee90-6466-4798-aaa4-18d40d93517c</guid><dc:creator>emb_dev</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;/p&gt;
&lt;p&gt;Thank you for your response. We do not currently use any of those calls in our application.&lt;br /&gt;I spent some time getting the sniffer set up and recording useful logs, however it seems that no matter what I do, the logger cannot break the encryption of the packets after the bond is made. I do not expect this to happen with our current bonding parameters, shown below:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define MAX_BONDED_PEERS                    5

#define SEC_PARAM_BOND                      1                                       /**&amp;lt; Perform bonding. */
#define SEC_PARAM_MITM                      0                                       /**&amp;lt; Man In The Middle protection not required. */
#define SEC_PARAM_LESC                      0                                       /**&amp;lt; LE Secure Connections enabled. */
#define SEC_PARAM_KEYPRESS                  0                                       /**&amp;lt; Keypress notifications not enabled. */
#define SEC_PARAM_IO_CAPABILITIES           BLE_GAP_IO_CAPS_NONE                    /**&amp;lt; No I/O capabilities. */
#define SEC_PARAM_OOB                       0                                       /**&amp;lt; Out Of Band data not available. */
#define SEC_PARAM_MIN_KEY_SIZE              7                                       /**&amp;lt; Minimum encryption key size. */
#define SEC_PARAM_MAX_KEY_SIZE              16                                      /**&amp;lt; Maximum encryption key size. */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Regardless, for both logs, I would power on the device and see that it was advertising, then start the wireshark log. I would then connect the phone to the device, pause a bit and then start the bonding process from the phone. The bonding process would succeed, I would pause, and then disconnect. After a few seconds of advertising, I would attempt to reconnect again. On the &amp;quot;failed&amp;quot; log, the connection is not successful, on the &amp;quot;passed&amp;quot; log the connection is successful and I disconnected after a few moments.&lt;br /&gt;&lt;br /&gt;The sniffer logs are attached below:&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/bondingTestPassed1.pcapng"&gt;devzone.nordicsemi.com/.../bondingTestPassed1.pcapng&lt;/a&gt;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/bondingTestFailed1.pcapng"&gt;devzone.nordicsemi.com/.../bondingTestFailed1.pcapng&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Immediate disconnect from bonded device with reason 42</title><link>https://devzone.nordicsemi.com/thread/301752?ContentTypeID=1</link><pubDate>Wed, 24 Mar 2021 15:53:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cad31604-c59e-4be3-b73b-e7b6b7c779de</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;An on-air sniffer log would be useful:&lt;br /&gt;&lt;a href="https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Sniffer-for-Bluetooth-LE"&gt;https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Sniffer-for-Bluetooth-LE&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Without a sniffer log it would be difficult to guess, you may try comment out the following api calls (if those are used in your application):&lt;br /&gt;//pm_handler_disconnect_on_sec_failure() // comment out if used&lt;br /&gt;//pm_handler_secure_on_connection() // comment out if used&lt;br /&gt;//pm_handler_secure_on_error()&amp;nbsp;&lt;span&gt;// comment out if used&lt;br /&gt;&lt;/span&gt;&lt;span&gt;//pm_handler_disconnect_on_insufficient_sec // comment out if used&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;For the above change to have any effect, you would need to make a new bond with the above changes in place.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Kenneth&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Immediate disconnect from bonded device with reason 42</title><link>https://devzone.nordicsemi.com/thread/301528?ContentTypeID=1</link><pubDate>Tue, 23 Mar 2021 17:05:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4da42f4b-cf61-43b4-baaf-da71a5b940eb</guid><dc:creator>emb_dev</dc:creator><description>&lt;p&gt;Just to add some information, we are using SDK 17.0.2 and Softdevice&amp;nbsp;s132_7.2.0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>