<?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>Implement Static Passkey with SDK12.2.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22075/implement-static-passkey-with-sdk12-2-0</link><description>Hi,
I want to use iOS to connect nRF82832 with passkey when connecting. I use pca10040_s132 with SDK 12.2.0. 
 Following is my procedure: 
 
 
 define security parameters: 
 #define SEC_PARAM_BOND 0
#define SEC_PARAM_MITM 1
#define SEC_PARAM_LESC</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 26 May 2017 07:43:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22075/implement-static-passkey-with-sdk12-2-0" /><item><title>RE: Implement Static Passkey with SDK12.2.0</title><link>https://devzone.nordicsemi.com/thread/86691?ContentTypeID=1</link><pubDate>Fri, 26 May 2017 07:43:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17c71ac4-f9c9-48dd-8175-a0e9b0b2cafa</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi longycy,&lt;/p&gt;
&lt;p&gt;I tried here with nRFMasterControl panel but don&amp;#39;t see the same issue. When I turned off MITM ( turn off keyboard&amp;amp;display security option) to bond and then turn it on again after that, I simply have the passkey asking pop up and can continue normally.
Here is the screenshot:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/realterm.JPG" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;Please make sure you deleted bond information on the RN4020 after the first trial.&lt;/p&gt;
&lt;p&gt;Do you have any Nordic board that you can use to test with nRFMaster Control Panel ?&lt;/p&gt;
&lt;p&gt;If possible, please record &lt;a href="https://www.nordicsemi.com/eng/Products/Bluetooth-Smart-Bluetooth-low-energy/nRF-Sniffer/"&gt;a sniffer trace&lt;/a&gt; when you test with RN4020. It can reveal why we have different result when testing with nRFMasterControlPanel vs RN4020.&lt;/p&gt;
&lt;p&gt;Also, please try to test with SDK v13.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Implement Static Passkey with SDK12.2.0</title><link>https://devzone.nordicsemi.com/thread/86687?ContentTypeID=1</link><pubDate>Thu, 25 May 2017 08:05:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73f95a54-7d43-4ded-abf5-95f4b1a5a5b0</guid><dc:creator>longycy</dc:creator><description>&lt;p&gt;.You can use another BLE module(eg.RN4020) to do a test if possible. The expeiment can be described like this:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Configure RN4020 without MITM. Then try to connect and bond it. You will be rejected as no MITM protection.&lt;/li&gt;
&lt;li&gt;Configure RN4020 with MIMT. Then you try to connect it again. And you may find &amp;quot;Connected to a previously bonded device&amp;quot; in UART log.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Best Regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Implement Static Passkey with SDK12.2.0</title><link>https://devzone.nordicsemi.com/thread/86686?ContentTypeID=1</link><pubDate>Wed, 24 May 2017 10:29:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:13c514ce-ec70-4905-b2a0-ec55d11e127e</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;That means there is no bonded id in the database, I don&amp;#39;t know how with that you would get  &amp;quot;Connected to a previously bonded device.&amp;quot; ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Implement Static Passkey with SDK12.2.0</title><link>https://devzone.nordicsemi.com/thread/86685?ContentTypeID=1</link><pubDate>Wed, 24 May 2017 08:33:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8450dc7-6cfa-4dc6-9f13-0435715b5a7d</guid><dc:creator>longycy</dc:creator><description>&lt;p&gt;Hi Hung Bui,
I add break point in im_ble_evt_handler() in id_manager.c, the result is that:
focus on code below:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;       case BLE_GAP_ADDR_TYPE_RANDOM_STATIC:
        {
            while (pds_peer_data_iterate(PM_PEER_DATA_ID_BONDING, &amp;amp;peer_id, &amp;amp;peer_data))
            {
                if (addr_compare(&amp;amp;gap_evt.params.connected.peer_addr,
                                 &amp;amp;peer_data.p_bonding_data-&amp;gt;peer_ble_id.id_addr_info))
                {
                    bonded_matching_peer_id = peer_id;
                    break;
                }
            }
        }
        break;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I add break point in &amp;quot;while(..)&amp;quot; and &amp;quot;if(add_compare(..))&amp;quot;, &amp;quot;while(..)&amp;quot; can be excuted but &amp;quot;if(add_compare())&amp;quot; has never been excuted. Because logic in &amp;quot;while(..)&amp;quot; is false.&lt;/p&gt;
&lt;p&gt;I don not know why it happens. Thanks a lot!&lt;/p&gt;
&lt;p&gt;Best Regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Implement Static Passkey with SDK12.2.0</title><link>https://devzone.nordicsemi.com/thread/86689?ContentTypeID=1</link><pubDate>Fri, 19 May 2017 09:24:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:149148a8-afe6-4ec2-8d30-be567470277f</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Longycy,&lt;/p&gt;
&lt;p&gt;I suspect the bond deleting was not executed properly. Note that deleting doesn&amp;#39;t happen at the same time when you see the debug text. It happens after that when the softdevice schedule the flash operation.&lt;/p&gt;
&lt;p&gt;I suspect that the program crashed right after that and reset. Please set optimization level to 0 and add DEBUG into C/C++ preprocessor symbols and add a break point inside app_error_handler() in app_error.c to check if there is any assertion.&lt;/p&gt;
&lt;p&gt;Also make sure you do a full erase of flash before you try to test.&lt;/p&gt;
&lt;p&gt;You can also add a break point inside im_ble_evt_handler() in id_manager.c to check if the address matched is actually correct or not.&lt;/p&gt;
&lt;p&gt;Also please send me the full UART log you have when testing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Implement Static Passkey with SDK12.2.0</title><link>https://devzone.nordicsemi.com/thread/86684?ContentTypeID=1</link><pubDate>Fri, 19 May 2017 01:45:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a11e8b93-93d5-4510-b857-0faa4d1751d6</guid><dc:creator>longycy</dc:creator><description>&lt;p&gt;Hi Hung Bui,&lt;/p&gt;
&lt;p&gt;I use Microchip RN4020 (Core 4.1) as central to test nRF52832. Following your advice, I tried again to debug gls example. The conclusion can be described as below:&lt;/p&gt;
&lt;p&gt;Firstly, I configure RN4020 without MITM. When connecting, I find UART print &amp;quot;Collector did not use MITM, disconnecting&amp;quot; and &amp;quot;Collector&amp;#39;s bond deleted&amp;quot;. That is right and it proves bond information has been erased.&lt;/p&gt;
&lt;p&gt;Secondly, I re-configure RN4020 with MIMT.At this time, UART print &amp;quot;Connected to a previously bonded device.&amp;quot; and then &amp;quot;connected&amp;quot;. This is very strange as bond information has been erased before.&lt;/p&gt;
&lt;p&gt;So why? I guess maybe bond information has not been erased correctly even though &amp;quot;pm_peer_delete(m_peer_to_be_deleted);&amp;quot; is excuted and return SUCCESS. Whether function &amp;quot;pm_peer_delete(...)&amp;quot; can be excuted correctly or not?&lt;/p&gt;
&lt;p&gt;Thank you very much!&lt;/p&gt;
&lt;p&gt;Best Regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Implement Static Passkey with SDK12.2.0</title><link>https://devzone.nordicsemi.com/thread/86683?ContentTypeID=1</link><pubDate>Thu, 18 May 2017 11:44:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4d7b0c9-b6ba-4b16-9440-9f7952d44c3c</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Which was the another BLE module you tested ?&lt;/p&gt;
&lt;p&gt;If you were testing with gls, you can find that if the connection was not paired with MITM we will disconnect and set m_peer_to_be_deleted to the current peer in PM_EVT_CONN_SEC_SUCCEEDED in pm_evt_handler().&lt;/p&gt;
&lt;p&gt;When we actually disconnect in BLE_GAP_EVT_DISCONNECTED event in on_ble_evt() we will erase bond information.&lt;/p&gt;
&lt;p&gt;Please try to debug and check the behavior. Check if m_peer_to_be_deleted set to anything and then if pm_peer_delete(m_peer_to_be_deleted) is called or not and returns success or not.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Implement Static Passkey with SDK12.2.0</title><link>https://devzone.nordicsemi.com/thread/86688?ContentTypeID=1</link><pubDate>Wed, 17 May 2017 09:45:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:939421c6-3594-49de-8c9f-d49bf7e85350</guid><dc:creator>longycy</dc:creator><description>&lt;p&gt;Hi Hung Bui,&lt;/p&gt;
&lt;p&gt;Thank you for your example &amp;quot;ble_app_gls&amp;quot;. I have tried this example and it works when using nRFConnect. But when I tried another BLE module, I found a question: In the code if peer did not use MITM, the function pm_peer_id_get(...) will be called to get the bonded peer as BLE Stack has its bond information. Then bond information will be erased when disconnected.  Actually, in my test pm_peer_id_get(...) get NULL, because &amp;quot;NRF_LOG_DEBUG(&amp;quot;Collector&amp;#39;s bond deleted\r\n&amp;quot;);&amp;quot; is not printed in UART Tool. So &amp;quot;m_peer_to_be_deleted == PM_PEER_ID_INVALID&amp;quot;.  Why it cannot get peer id by using &amp;quot;pm_peer_id_get(m_conn_handle, &amp;amp;m_peer_to_be_deleted)&amp;quot; ? Could you please help me to confirm this?
Thank you very much!&lt;/p&gt;
&lt;p&gt;Best Regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Implement Static Passkey with SDK12.2.0</title><link>https://devzone.nordicsemi.com/thread/86690?ContentTypeID=1</link><pubDate>Tue, 16 May 2017 11:07:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0aefc06-8f24-4c0b-841c-e93e02479bde</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Longycy,&lt;/p&gt;
&lt;p&gt;Could you capture &lt;a href="https://www.nordicsemi.com/eng/Products/Bluetooth-Smart-Bluetooth-low-energy/nRF-Sniffer/"&gt;a sniffer trace&lt;/a&gt; ?&lt;/p&gt;
&lt;p&gt;If you simply test with the ble_app_gls example would you manage to bond and access the service ? (it&amp;#39;s not static passkey, but we should start there)&lt;/p&gt;
&lt;p&gt;Also please try to use nRFConnect app to test instead of Light Blue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>