<?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 set up BLE bonding</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/81797/how-to-set-up-ble-bonding</link><description>Dear Nordic, 
 we are devepoling FW based on nRF52832, SDK 17.0.2. We have 2 devices: 
 BLE Central with SD S332 
 BLE Peripheral with SD S112 
 We setted up an open BLE communication, the data are exchanging fine. At this development stage we need to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 30 Nov 2021 13:38:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/81797/how-to-set-up-ble-bonding" /><item><title>RE: How to set up BLE bonding</title><link>https://devzone.nordicsemi.com/thread/341318?ContentTypeID=1</link><pubDate>Tue, 30 Nov 2021 13:38:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c0b54ff-3610-453a-87b0-fbdd6403894a</guid><dc:creator>Kenneth</dc:creator><description>[quote user="mrono"]I have a project based on one of the SDK examples, and the only security feature set in gap_params_init is for the device name. So I think you may have only set the requirement for changing the device name.[/quote]
&lt;p&gt;Good observation, I did not think of that. Yes, he should go into the services_init() and check the permissions set there.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set up BLE bonding</title><link>https://devzone.nordicsemi.com/thread/341269?ContentTypeID=1</link><pubDate>Tue, 30 Nov 2021 12:23:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:962a7c02-2f27-400f-8e2c-9b2fff967b06</guid><dc:creator>mrono</dc:creator><description>[quote userid="87195" url="~/f/nordic-q-a/81797/how-to-set-up-ble-bonding/341131#341131"]I setted&amp;nbsp;BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM in the&amp;nbsp;gap_params_init function [/quote][quote userid="2111" url="~/f/nordic-q-a/81797/how-to-set-up-ble-bonding/341000#341000"]Typically when you init the services and characteristics you also define the security requirements to access them[/quote]
&lt;p&gt;Usually the services and characteristics aren&amp;#39;t initialized in gap_params_init. I&amp;#39;m guessing you still have the characteristics set to&amp;nbsp;&lt;span&gt;BLE_GAP_CONN_SEC_MODE_SET_OPEN.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I have a project based on one of the SDK examples, and the only security feature set in gap_params_init is for the device name. So I think you may have only set the requirement for changing the device name.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set up BLE bonding</title><link>https://devzone.nordicsemi.com/thread/341261?ContentTypeID=1</link><pubDate>Tue, 30 Nov 2021 12:06:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09a7c385-b124-4665-aac5-e12e98e065e9</guid><dc:creator>StefXinet</dc:creator><description>&lt;p&gt;unfortunatly I have any sniffer LOG, I&amp;#39;m already reading that tutorial to set up a sniffer&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set up BLE bonding</title><link>https://devzone.nordicsemi.com/thread/341257?ContentTypeID=1</link><pubDate>Tue, 30 Nov 2021 12:00:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4217a0b5-f78d-424d-96a4-79e0780b4c08</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Do you have an on-air sniffer log?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.nordicsemi.com/Products/Development-tools/nRF-Sniffer-for-Bluetooth-LE"&gt;https://www.nordicsemi.com/Products/Development-tools/nRF-Sniffer-for-Bluetooth-LE&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set up BLE bonding</title><link>https://devzone.nordicsemi.com/thread/341137?ContentTypeID=1</link><pubDate>Mon, 29 Nov 2021 16:32:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c7b6505-e84c-4534-8b55-fb3d6a36a1fc</guid><dc:creator>StefXinet</dc:creator><description>&lt;p&gt;No, i&amp;#39;m sure. I checked the bonded device list and it&amp;#39;s empty.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set up BLE bonding</title><link>https://devzone.nordicsemi.com/thread/341136?ContentTypeID=1</link><pubDate>Mon, 29 Nov 2021 16:31:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89e23582-50ae-47e2-b3ea-873fb62cd6cf</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Maybe they have been previously bonded?&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set up BLE bonding</title><link>https://devzone.nordicsemi.com/thread/341131?ContentTypeID=1</link><pubDate>Mon, 29 Nov 2021 16:06:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebbbfe3c-645b-4c31-a60c-e96990c6c9a6</guid><dc:creator>StefXinet</dc:creator><description>&lt;p&gt;Thanks for your reply.&lt;/p&gt;
&lt;p&gt;I setted&amp;nbsp;BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM in the&amp;nbsp;gap_params_init function but nothing changed:&lt;/p&gt;
&lt;p&gt;If I try to connect using nRF connect APP there is no bonding request.&lt;/p&gt;
&lt;p&gt;I can also read the device services and characteristic list, and I can read all the characteristics values.&lt;/p&gt;
&lt;p&gt;Is there something missing?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set up BLE bonding</title><link>https://devzone.nordicsemi.com/thread/341000?ContentTypeID=1</link><pubDate>Mon, 29 Nov 2021 08:37:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0c53c99-9cf4-4009-b909-26e9cab5ce34</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Typically when you init the services and characteristics you also define the security requirements to access them by using:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@defgroup BLE_GAP_CONN_SEC_MODE_SET_MACROS GAP attribute security requirement setters
 *
 * See @ref ble_gap_conn_sec_mode_t.
 * @{ */
/**@brief Set sec_mode pointed to by ptr to have no access rights.*/
#define BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(ptr)          do {(ptr)-&amp;gt;sm = 0; (ptr)-&amp;gt;lv = 0;} while(0)
/**@brief Set sec_mode pointed to by ptr to require no protection, open link.*/
#define BLE_GAP_CONN_SEC_MODE_SET_OPEN(ptr)               do {(ptr)-&amp;gt;sm = 1; (ptr)-&amp;gt;lv = 1;} while(0)
/**@brief Set sec_mode pointed to by ptr to require encryption, but no MITM protection.*/
#define BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(ptr)        do {(ptr)-&amp;gt;sm = 1; (ptr)-&amp;gt;lv = 2;} while(0)
/**@brief Set sec_mode pointed to by ptr to require encryption and MITM protection.*/
#define BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM(ptr)      do {(ptr)-&amp;gt;sm = 1; (ptr)-&amp;gt;lv = 3;} while(0)
/**@brief Set sec_mode pointed to by ptr to require LESC encryption and MITM protection.*/
#define BLE_GAP_CONN_SEC_MODE_SET_LESC_ENC_WITH_MITM(ptr) do {(ptr)-&amp;gt;sm = 1; (ptr)-&amp;gt;lv = 4;} while(0)
/**@brief Set sec_mode pointed to by ptr to require signing or encryption, no MITM protection needed.*/
#define BLE_GAP_CONN_SEC_MODE_SET_SIGNED_NO_MITM(ptr)     do {(ptr)-&amp;gt;sm = 2; (ptr)-&amp;gt;lv = 1;} while(0)
/**@brief Set sec_mode pointed to by ptr to require signing or encryption with MITM protection.*/
#define BLE_GAP_CONN_SEC_MODE_SET_SIGNED_WITH_MITM(ptr)   do {(ptr)-&amp;gt;sm = 2; (ptr)-&amp;gt;lv = 2;} while(0)
/**@} */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t need bonding you use&amp;nbsp;BLE_GAP_CONN_SEC_MODE_SET_OPEN(), if you need bonding you use&amp;nbsp;BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM() or better.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set up BLE bonding</title><link>https://devzone.nordicsemi.com/thread/340763?ContentTypeID=1</link><pubDate>Thu, 25 Nov 2021 14:10:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12015b34-677f-485d-859a-324c604156c6</guid><dc:creator>StefXinet</dc:creator><description>[quote userid="2111" url="~/f/nordic-q-a/81797/how-to-set-up-ble-bonding/339393#339393"]&lt;p&gt;You can find documentation for peer manager here:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_peer_manager.html"&gt;https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_peer_manager.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;Dear&amp;nbsp;&lt;span&gt;Kenneth,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I&amp;#39;m studying the docs. There is already some peer manager configuration in my code so i fixed it up following the documentation.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I can&amp;#39;t understand the parameters for &amp;quot;ble_gap_sec_params_t&amp;quot; settings struct:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;referring to&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.1.0%2Flib_pm_usage.html"&gt;Peer Manager - Usage - Security parameters&lt;/a&gt;&amp;nbsp;there is some common configurations. I&amp;#39;m using the &amp;quot;&lt;b&gt;Just Works bonding&lt;/b&gt;&amp;quot; settings and I can see my device advertising, when I connect it shows all the characteristic and I can read/write them &lt;strong&gt;without bonding&amp;nbsp;&lt;/strong&gt;my device with my phone.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;What are the right parameters to allow the connecton only with bonded devices?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set up BLE bonding</title><link>https://devzone.nordicsemi.com/thread/339393?ContentTypeID=1</link><pubDate>Wed, 17 Nov 2021 10:50:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0fb6573c-787e-4f5a-b141-b625f108f0ba</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;You can find documentation for peer manager here:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_peer_manager.html"&gt;https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_peer_manager.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Honestly speaking, if you want to support bonding, then I strongly recommend that you start with an existing application that already support bonding (peer manager), and include the services and characteristics you want to that application (or even update the softdevice header files and ram/flash usage due to a different softdevice), instead of the other way around. The peer manager module have a lot of depencies and defines, and including all those to a new project is not something I recommend. Instead the nRF5 SDK have already done the work for you by providing&amp;nbsp;applications that support bonding.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>