<?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>NUS service connect by MAC address</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112408/nus-service-connect-by-mac-address</link><description>I am using nRF5 SDK v17.1.0. 
 Is it possible to connect a peripheral device by MAC address, and the device is advertising with a different UUID from the central device? 
 That is, the central device has NUS_C service enabled, and the UUID is different</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 01 Jul 2024 17:32:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112408/nus-service-connect-by-mac-address" /><item><title>RE: NUS service connect by MAC address</title><link>https://devzone.nordicsemi.com/thread/491667?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2024 17:32:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a483f70-55ff-47a8-bea9-e4bfe9ff7c6f</guid><dc:creator>davidz</dc:creator><description>&lt;p&gt;Thank you very much for the confirmation.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;After adding the logs, it turns out that the central indeed is&amp;nbsp;disconnecting after it connects to the peripheral.&lt;/p&gt;
&lt;p&gt;By disabling the disconnecting, the central can stay connected.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NUS service connect by MAC address</title><link>https://devzone.nordicsemi.com/thread/491249?ContentTypeID=1</link><pubDate>Fri, 28 Jun 2024 08:50:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0a5da25-5e3c-4b5c-967c-256bf27cd2b0</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Scan response isn&amp;#39;t required to maintain a connection, unless some specific application logic makes it so. I don&amp;#39;t think that is a cause for disconnection.&lt;br /&gt;&lt;br /&gt;I suggest adding some log before all the disconnect function call in your central app.&lt;/p&gt;
&lt;p&gt;Just in case something is mixed up, the device that log disconnect reason&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/s140_api/page/group___b_l_e___h_c_i___s_t_a_t_u_s___c_o_d_e_s.html#ga0b7bcbe31925c6d2c305ba4f0ff9889b"&gt;BLE_HCI_LOCAL_HOST_TERMINATED_CONNECTION&lt;/a&gt;&lt;span&gt;&amp;nbsp;0x16 is the one&amp;nbsp;initiating the disconnect.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NUS service connect by MAC address</title><link>https://devzone.nordicsemi.com/thread/491215?ContentTypeID=1</link><pubDate>Fri, 28 Jun 2024 06:06:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ded50c83-a060-4234-9560-7f543b3d93e9</guid><dc:creator>davidz</dc:creator><description>&lt;p&gt;I have checked around, but&amp;nbsp;can not find the reason that the central/client disconnects yet.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Does the peripheral need to have scan response, so that the central can stay connected? I&amp;nbsp;added scan response at the peripheral, but the central still disconnected like before.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I will test adding back the NUS UUID at the peripheral side.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NUS service connect by MAC address</title><link>https://devzone.nordicsemi.com/thread/490893?ContentTypeID=1</link><pubDate>Wed, 26 Jun 2024 13:15:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7eb55903-a943-4206-9e50-c7e91f65a3ea</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;The default implementation of the NUS Client requires that the Server has the NUS with its expected UUID, yes.&lt;/p&gt;
&lt;p&gt;Refer to the &lt;a href="https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.1.0/page/group__ble__db__discovery.html#gaf0f29a047cb3eb1f1b65d19be8192fc0"&gt;ble_db_discovery_evt_register()&lt;/a&gt;&amp;nbsp;call in&amp;nbsp;ble_nus_c_init().&lt;/p&gt;
&lt;p&gt;However, I just check the&amp;nbsp;examples and even though the client searches for the UUID, it doesn&amp;#39;t disconnect if the UUID is not found.&lt;/p&gt;
&lt;p&gt;You might want to check for all places that trigger a disconnection in your application and see which part is the cause.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NUS service connect by MAC address</title><link>https://devzone.nordicsemi.com/thread/490718?ContentTypeID=1</link><pubDate>Tue, 25 Jun 2024 21:05:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:acd52d57-7e83-42fa-aa9d-a8c3eccd7355</guid><dc:creator>davidz</dc:creator><description>&lt;p&gt;I used the default NUS service. Does the NUS central device verifies UUID before it accepts NUS service? Since the peripheral has dynamic UUID that changes each time, if the central only accepts fixed UUID for NUS service, then it won&amp;#39;t work.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NUS service connect by MAC address</title><link>https://devzone.nordicsemi.com/thread/490610?ContentTypeID=1</link><pubDate>Tue, 25 Jun 2024 11:49:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:196b8c15-26da-4053-8836-f1c9c772fe8c</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;The disconnection reasons follow standard&amp;nbsp;Bluetooth Spec status codes. The codes are&amp;nbsp;also documented here:&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/s140_api/page/group___b_l_e___h_c_i___s_t_a_t_u_s___c_o_d_e_s.html"&gt;S140 SoftDevice v7.2.0: Bluetooth status codes (nordicsemi.com)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Looks like the central is actively disconnecting from the peer. You mentioned some UUID change. Are there some logics in the application that check for&amp;nbsp;a specific UUID on the peripheral&amp;#39;s server?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NUS service connect by MAC address</title><link>https://devzone.nordicsemi.com/thread/490456?ContentTypeID=1</link><pubDate>Tue, 25 Jun 2024 04:45:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff458a2f-6f17-464c-8c40-9e193f829c28</guid><dc:creator>davidz</dc:creator><description>&lt;p&gt;Yes I checked both inverted address already. The commented out code &amp;quot;//&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; memcpy(&amp;amp;m_mac_filter.addr,target_mac_addr, 6);&amp;quot; is actually the inverted address. Either direction does not work. Very strange.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However, if I try to connect via&amp;nbsp;BLE_GAP_EVT_ADV_REPORT event, then the central can connect to the peripheral, but then disconnect immediately. The debug info at the central showed the following:&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; app: GAP connected. &lt;br /&gt;&amp;lt;info&amp;gt; app: ATT MTU exchange completed handle 0x0&lt;br /&gt;&amp;lt;info&amp;gt; app: GAP disconnected. conn_handle: 0x0, reason: 0x16&lt;/p&gt;
&lt;p&gt;At the peripheral side, the peripheral showed &amp;quot;GAP disconnected reason 0x13&amp;quot;. What could be the cause?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The following is the code used at&amp;nbsp;BLE_GAP_EVT_ADV_REPORT event at the central:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if (memcmp(target_mac_addr, p_adv_report-&amp;gt;peer_addr.addr, sizeof(p_adv_report-&amp;gt;peer_addr.addr)) == 0)
 {

          err_code=sd_ble_gap_connect(&amp;amp;p_gap_evt-&amp;gt;params.adv_report.peer_addr,
                                 &amp;amp;m_scan_param,
                                 &amp;amp;m_connection_param, APP_BLE_CONN_CFG_TAG);
          APP_ERROR_CHECK(err_code);
                                  
  }
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NUS service connect by MAC address</title><link>https://devzone.nordicsemi.com/thread/490297?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2024 12:43:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7180e4ca-9ebf-47e4-8323-3d6e9accf0c4</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi davidz,&lt;/p&gt;
&lt;p&gt;Scan and connect filtering by address&amp;nbsp;is entirely possible. Your code looks correct too.&lt;/p&gt;
&lt;p&gt;I know you are already using&amp;nbsp;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;nrf_ble_scan_copy_addr_to_sd_gap_addr()&lt;/span&gt;, but could you please check if the address is inverted?&lt;/p&gt;
&lt;p&gt;An easy way to test this is to add both the current version of the address and an inverted&amp;nbsp;version of the address to the filter list and see if there is any difference.&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>