<?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>Custom service is advertised with NUS base UUID</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110141/custom-service-is-advertised-with-nus-base-uuid</link><description>Dear all, I use nRF52840 custom board with nRF52 SDK and I want to advertise two more services: 
 
 one custom service (0x1523) 
 one battery service (0x180F) 
 
 and read them through my mobile with nRF Connect app. 
 I experiment with the ble_app_uart</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 11 Apr 2024 12:59:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110141/custom-service-is-advertised-with-nus-base-uuid" /><item><title>RE: Custom service is advertised with NUS base UUID</title><link>https://devzone.nordicsemi.com/thread/478333?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2024 12:59:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ceecb18-94a5-466f-aebb-c5e0329fcb23</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;That is good to hear. Thanks for letting me know it worked &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom service is advertised with NUS base UUID</title><link>https://devzone.nordicsemi.com/thread/478324?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2024 12:42:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2fde46fe-0733-4eb3-812c-425bc1f0edf6</guid><dc:creator>masterLee</dc:creator><description>&lt;p&gt;Yes you are right! It worked! Great! Thank you for your support!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom service is advertised with NUS base UUID</title><link>https://devzone.nordicsemi.com/thread/478317?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2024 12:35:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ad2bcda-784b-4167-8015-65c332788e25</guid><dc:creator>Einar Thorsrud</dc:creator><description>[quote user="masterLee"]I haven&amp;#39;t changed something else in the code. Only the parts I mentioned before.[/quote]
&lt;p&gt;Then you are still using the wrong base for your custom service, and that needs to be updated.&amp;nbsp;NUS_SERVICE_UUID_TYPE is defined to&amp;nbsp;BLE_UUID_TYPE_VENDOR_BEGIN, which is 2. So with this snippet you are using the same base as NUS:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static ble_uuid_t m_adv_uuids[]   =                                  
{
   {BLE_UUID_NUS_SERVICE, NUS_SERVICE_UUID_TYPE},
   {BLE_UUID_BATTERY_SERVICE, BLE_UUID_TYPE_BLE},
   {CUSTOM_SERVICE_UUID, BLE_UUID_TYPE_VENDOR_BEGIN}
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You should use&amp;nbsp;BLE_UUID_TYPE_VENDOR_BEGIN+1 instead (you can define it to something sensible, like is done in the SDK for&amp;nbsp;NUS_SERVICE_UUID_TYPE if you like). Note that te way this is done, the order matters as mentionned before, but that is not a big problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom service is advertised with NUS base UUID</title><link>https://devzone.nordicsemi.com/thread/478279?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2024 11:12:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c03c5cd6-e442-48f9-b7e6-c4928e3c94e5</guid><dc:creator>masterLee</dc:creator><description>&lt;p&gt;I haven&amp;#39;t changed something else in the code. Only the parts I mentioned before.&lt;/p&gt;
&lt;p&gt;How do I update the type where you add the service to the advertising packet?&lt;/p&gt;
&lt;p&gt;Also, I noticed that when I place the last code part before NUS initialization, both services , NUS and custom service get the UUID of the custom service ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom service is advertised with NUS base UUID</title><link>https://devzone.nordicsemi.com/thread/478267?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2024 10:26:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29dec961-5f0a-4ccc-a31d-2e21f903d01b</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;This looks OK with regards to how the service is added to the GATT table. But did you make sure to also update the type where you add the service to the advertising packet? Can you show the updated code you have for that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom service is advertised with NUS base UUID</title><link>https://devzone.nordicsemi.com/thread/478256?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2024 10:07:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c69885e-7921-41da-ba94-64c8e57da55a</guid><dc:creator>masterLee</dc:creator><description>&lt;p&gt;Update: I added the following code in services_init(), in sdk_config I set NRF_SDH_BLE_VS_UUID_CNT to 2 and updated the ram size but the result is the same again.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    ret_code_t  err_code;
    ble_uuid_t ble_uuid;
    uint16_t service_handle;
    uint8_t  uuid_type = 0;

    ble_uuid128_t base_uuid = CUSTOM_UUID_BASE;
    err_code = sd_ble_uuid_vs_add(&amp;amp;base_uuid, &amp;amp;uuid_type);
    if (err_code != NRF_SUCCESS) {
      NRF_LOG_INFO(&amp;quot;CUSTOM SERVICE ERROR %X| UUID TYPE: %X&amp;quot;,err_code ,uuid_type);
    }
    NRF_LOG_INFO(&amp;quot; UUID TYPE: %X&amp;quot;,uuid_type);  // returns 3

    ble_uuid.type = uuid_type;
    ble_uuid.uuid = CUSTOM_SERVICE_UUID;   //0x1523

    // Add the service.
    err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
                                        &amp;amp;ble_uuid,
                                        &amp;amp;service_handle);
   
    if (err_code != NRF_SUCCESS) {
        NRF_LOG_INFO(&amp;quot;CUSTOM SERVICE ERROR %X| SERVICE HANDLE: %X&amp;quot;,err_code ,service_handle);
    }
    NRF_LOG_INFO(&amp;quot;SERVICE HANDLE: %X&amp;quot;,service_handle); //returns 11&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom service is advertised with NUS base UUID</title><link>https://devzone.nordicsemi.com/thread/478237?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2024 09:10:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24a80d7c-4f68-4683-8b12-4c8cff8b6a40</guid><dc:creator>masterLee</dc:creator><description>&lt;p&gt;Ok I will try it out and I will respond&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Custom service is advertised with NUS base UUID</title><link>https://devzone.nordicsemi.com/thread/478234?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2024 09:05:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa9a7cfa-63fa-402c-99ad-e5c54bacc8ed</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;In order to get the correct base UUID you need to register it with&amp;nbsp;sd_ble_uuid_vs_add(). And when you do, the second parameter is an output, and this is the type you need to use when you subsequently refer to it (this is a counter though, so if the base used by NUS is added first this will be 2 (BLE_UUID_TYPE_VENDOR_BEGIN), and your will be 3, so you can use this as well, but then things will break if the order you register the base addresses change).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>