<?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>BLE Central - Discovering and reading custom 128-bit service UUID and different 128-bit characteristic</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/78509/ble-central---discovering-and-reading-custom-128-bit-service-uuid-and-different-128-bit-characteristic</link><description>Hi Nordic team, 
 My dev environment is as follows: 
 nrf52840 + s140 +SD6.0.0 + SDK15.0.0 + SES + nrf52840-DK 
 Here, nrf52840-DK is configured as BLE Central and my peripheral is a third party board with entirely different controller, architecture and</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 19 Aug 2021 08:34:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/78509/ble-central---discovering-and-reading-custom-128-bit-service-uuid-and-different-128-bit-characteristic" /><item><title>RE: BLE Central - Discovering and reading custom 128-bit service UUID and different 128-bit characteristic</title><link>https://devzone.nordicsemi.com/thread/325655?ContentTypeID=1</link><pubDate>Thu, 19 Aug 2021 08:34:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98788a6f-32b6-47d1-8b6e-e040c2a125d6</guid><dc:creator>PriyeshN</dc:creator><description>&lt;p&gt;Hmm ok,&lt;/p&gt;
&lt;p&gt;Anyway, good news is that &lt;strong&gt;now I&amp;#39;m able to discover the services&lt;/strong&gt;. In the interest of forum members and someone coming with same issue later, here&amp;#39;s what I did change:&lt;/p&gt;
&lt;p&gt;on nRFConnect - I&amp;#39;m seeing the service and characteristic UUID as below (as mentioned in my query as well)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Service UUID - fb349b5f-8000-0080-0010-000052fd0000&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Characteristic UUID -&amp;nbsp;e29819be-3b9f-24bc-3d45-2bf743ea48d8&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;So, when calling&amp;nbsp;&lt;strong&gt;sd_ble_uuid_vs_add()&amp;nbsp;&lt;/strong&gt;I&amp;#39;m providing the&lt;/p&gt;
&lt;p&gt;base UUID as -&amp;nbsp;{0x00, 0x00, 0xfd, 0x52, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb}&amp;nbsp;&lt;/p&gt;
&lt;p&gt;but when registering for discovery using&amp;nbsp;sd_ble_uuid_vs_add() I&amp;#39;m providing the 16-Bit UUID as&amp;nbsp;&lt;br /&gt;&lt;br /&gt;UUID for discovery - 0x9B5F&lt;/p&gt;
&lt;p&gt;The same goes true for Characteristic as well, although, for characteristic, we need not give the discovery event&lt;/p&gt;
&lt;p&gt;For me, this was quiet tricky as I had to discover two custom service UUIDs&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UUID1 - fb349b5f-8000-0080-0010-000052fd0000&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UUID2 - fb349b5f-8000-0080-0010-000051fd0000&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The differentiating factor here is 0xfd52 and 0xfd51, so, till now I was concentrating on them as unique differentiator for discovering, but it&amp;#39;s not the way it is. The discovery UUID should be the 12-13 octet of the base UUID being added in attribute table.&lt;/p&gt;
&lt;p&gt;So, anyone coming to this post with some similar issue, I recommend trying out by reversing base service UUIDs and trying both sets of reversed and non reversed UUID for discovery.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For my third party device, I could not find the documentation regarding how UUID is being sent, so permutation combination helped me.&lt;/p&gt;
&lt;p&gt;Thanks Jared&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central - Discovering and reading custom 128-bit service UUID and different 128-bit characteristic</title><link>https://devzone.nordicsemi.com/thread/325647?ContentTypeID=1</link><pubDate>Thu, 19 Aug 2021 08:11:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2348652-05f4-4f67-b791-b761a71645fd</guid><dc:creator>Jared</dc:creator><description>&lt;ol&gt;
&lt;li&gt;No, not that I know of.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;It all depends on the third-party device, it should be stated somewhere in the documentation how UUID is sent. Most BLE products send with little-endian, meaning the LSB first. If you compare the ble_app_uart and ble_app_uart_c examples you&amp;#39;ll see that the service UUID that the GATT client is looking for and the one that the GATT Server is providing is in the same order. The UUID however is sent in the reverse order, which the GATT client assumes and therefore looks for the UUID in the reverse order.&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;span&gt;It should be of the non-reversed. But the nRF will look for the reversed when it&amp;#39;s actually trying to discover the service.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central - Discovering and reading custom 128-bit service UUID and different 128-bit characteristic</title><link>https://devzone.nordicsemi.com/thread/325304?ContentTypeID=1</link><pubDate>Tue, 17 Aug 2021 12:31:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7dfe68f2-1cfd-40d3-b64a-d835caf8aa41</guid><dc:creator>PriyeshN</dc:creator><description>&lt;p&gt;Yes, actually my code is based from NUS Central example code with a mix from HRS central code (for peer manager library usage).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;DB Discovery init is same as in NUS Central code. And in my custome service Init, as you can see in code, I&amp;#39;m registering the UUID&amp;#39;s I need to look for.&lt;/p&gt;
&lt;p&gt;Few questions:&lt;/p&gt;
&lt;p&gt;1) My peripheral is running on BLE ver 4.2 whereas I&amp;#39;m using nRF52840 with SDk v15. Does this cause any known compatibility issues?&lt;/p&gt;
&lt;p&gt;2) How should I provide the base UUID (128-bit) and the 16-bit UUID for Discovery? Should the base UUID (128-bit) be in reversed order as seen in nRFConnect app, or should it not be?&lt;/p&gt;
&lt;p&gt;3) The 16-Bit UUID provided for discovery, should it be 12-13 Octet of the base UUID as seen in nRFConnect app or should it be 12-13 Octet of the reversed 128-bit base UUID?&lt;/p&gt;
&lt;p&gt;Maybe, answers to above can solve my concern&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central - Discovering and reading custom 128-bit service UUID and different 128-bit characteristic</title><link>https://devzone.nordicsemi.com/thread/325301?ContentTypeID=1</link><pubDate>Tue, 17 Aug 2021 12:22:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2f8b5dc-5229-4846-a84c-95bed843748b</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Our NUS central example shows how you can setup a client that can discover a proprietary&amp;nbsp;ble service. Try comparing your client code with that one and see if there is any distinct differences. How is the initialization of the service discovery done on the client side?&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central - Discovering and reading custom 128-bit service UUID and different 128-bit characteristic</title><link>https://devzone.nordicsemi.com/thread/324857?ContentTypeID=1</link><pubDate>Fri, 13 Aug 2021 12:49:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b7f19c8-c9e2-4259-9d95-8862573fbe67</guid><dc:creator>PriyeshN</dc:creator><description>&lt;p&gt;I&amp;#39;m not even able to discover service with UUID 0xFD52, so I haven&amp;#39;t reached stage of discovering characteristic. My concern lies in discovering primary service itself.&amp;nbsp;Attached is the RTT log post connection:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app: Connecting to target DC:A6:32:A9:77:D5
&amp;lt;debug&amp;gt; nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.
&amp;lt;debug&amp;gt; nrf_ble_gatt: Updating data length to 251 on connection 0x0.
&amp;lt;info&amp;gt; app: Connected to a previously bonded device.
&amp;lt;info&amp;gt; app: Connected to target
&amp;lt;debug&amp;gt; ble_db_disc: Starting discovery of service with UUID 0xFD52 on connection handle 0x0.
&amp;lt;debug&amp;gt; nrf_ble_gatt: Data length updated to 251 on connection 0x0.
&amp;lt;debug&amp;gt; nrf_ble_gatt: max_rx_octets: 251
&amp;lt;debug&amp;gt; nrf_ble_gatt: max_tx_octets: 251
&amp;lt;debug&amp;gt; nrf_ble_gatt: max_rx_time: 2120
&amp;lt;debug&amp;gt; nrf_ble_gatt: max_tx_time: 2120
&amp;lt;info&amp;gt; app: Data length for connection 0x0 updated to 251.
&amp;lt;info&amp;gt; app: Connection secured: role: 2, conn_handle: 0x0, procedure: 0.
&amp;lt;debug&amp;gt; nrf_ble_gatt: ATT MTU updated to 247 bytes on connection 0x0 (response).
&amp;lt;info&amp;gt; app: GATT ATT MTU on connection 0x0 changed to 247.
&amp;lt;debug&amp;gt; ble_db_disc: Starting discovery of service with UUID 0xFD52 on connection handle 0x0.
&amp;lt;debug&amp;gt; nrf_ble_gatt: Peer on connection 0x0 requested an ATT MTU of 517 bytes.
&amp;lt;debug&amp;gt; nrf_ble_gatt: Updating ATT MTU to 247 bytes (desired: 247) on connection 0x0.
&amp;lt;info&amp;gt; app: GATT ATT MTU on connection 0x0 changed to 247.
&amp;lt;debug&amp;gt; ble_db_disc: Service UUID 0xFD52 not found.
&amp;lt;debug&amp;gt; ble_db_disc: Starting discovery of service with UUID 0xFD51 on connection handle 0x0.
&amp;lt;debug&amp;gt; ble_db_disc: Service UUID 0xFD51 not found.&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central - Discovering and reading custom 128-bit service UUID and different 128-bit characteristic</title><link>https://devzone.nordicsemi.com/thread/324853?ContentTypeID=1</link><pubDate>Fri, 13 Aug 2021 12:42:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d570d2f6-d18b-4161-b42b-1c5c8f39784f</guid><dc:creator>PriyeshN</dc:creator><description>&lt;p&gt;Yes, I mean I do use two different UUID bases for getting them added to&amp;nbsp;&lt;span&gt;sd_ble_uuid_vs_add(). My init code looks something like this. Sorry for the dev style code, but that does means I have tried a lot&amp;nbsp;&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f603.svg" title="Smiley"&gt;&amp;#x1f603;&lt;/span&gt;&lt;/span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;ret_code_t ble_oes_init(ble_oes_t * p_ble_oes, const ble_oes_init_t * p_ble_oes_init)
{
    ret_code_t   err_code;
    ble_uuid_t ble_uuid;
    ble_uuid128_t base_uuid         = {BLE_ONITY_EVENT_SERVICE_COMPLETE_UUID_REV};//{BLE_ONITY_EVENT_SERVICE_COMPLETE_UUID}; BLE_ONITY_EVENT_SERVICE_COMPLETE_UUID_REV
    ble_uuid128_t char_base_uuid    = {BLE_OES_CHARACTERISTIC_UUID_REV};

    VERIFY_PARAM_NOT_NULL(p_ble_oes);
    VERIFY_PARAM_NOT_NULL(p_ble_oes_init);

    // Initialize service structure
    p_ble_oes-&amp;gt;evt_handler                  = p_ble_oes_init-&amp;gt;evt_handler;
    p_ble_oes-&amp;gt;conn_handle                  = BLE_CONN_HANDLE_INVALID;
    p_ble_oes-&amp;gt;handles.oes_handle           = BLE_GATT_HANDLE_INVALID;

    // Add custom Service UUID
    err_code =  sd_ble_uuid_vs_add(&amp;amp;base_uuid, &amp;amp;p_ble_oes-&amp;gt;uuid_type);
    VERIFY_SUCCESS(err_code);
    
    // Add custom Service characteristic UUID
    err_code =  sd_ble_uuid_vs_add(&amp;amp;char_base_uuid, &amp;amp;p_ble_oes-&amp;gt;char_uuid_type);
    VERIFY_SUCCESS(err_code);

    ble_uuid.type = p_ble_oes-&amp;gt;uuid_type;
    ble_uuid.uuid = BLE_ONITY_EVENT_SERVICE_UUID;

    ble_oes_char_uuid.type = p_ble_oes-&amp;gt;char_uuid_type;
    //ble_oes_char_uuid.uuid = 0xEA43;

    //return NRF_SUCCESS;
    APP_ERROR_CHECK(ble_db_discovery_evt_register(&amp;amp;ble_uuid));
    //APP_ERROR_CHECK(ble_db_discovery_evt_register(&amp;amp;ble_oes_char_uuid));
    return NRF_SUCCESS;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Central - Discovering and reading custom 128-bit service UUID and different 128-bit characteristic</title><link>https://devzone.nordicsemi.com/thread/324846?ContentTypeID=1</link><pubDate>Fri, 13 Aug 2021 12:29:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:060b68a3-f0f6-498b-81ea-2d71f704eac8</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Have you tried using two different UUID bases? I think that should work.&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>