<?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 create characteristics with different UUIDs?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83308/how-to-create-characteristics-with-different-uuids</link><description>Hi everyone, my colleague developed a firmware using Arduino Nano 33 BLE and PlatformIO. Now I have to rewrite the code using Segger Embedded Studio. The problem is in the declaration of the characteristics of a service. There are in fact two characteristics</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 05 Jan 2022 08:46:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83308/how-to-create-characteristics-with-different-uuids" /><item><title>RE: How to create characteristics with different UUIDs?</title><link>https://devzone.nordicsemi.com/thread/346060?ContentTypeID=1</link><pubDate>Wed, 05 Jan 2022 08:46:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a0e0b4c-3e9d-49f6-9f6b-c7640a3fcf66</guid><dc:creator>Stefano1984</dc:creator><description>&lt;p&gt;Thank you very much Vidar.&lt;br /&gt;You have been very kind.&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: How to create characteristics with different UUIDs?</title><link>https://devzone.nordicsemi.com/thread/346056?ContentTypeID=1</link><pubDate>Wed, 05 Jan 2022 08:39:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ec23097-9205-4ff5-9f7f-e22f14e0b24f</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Excellent! characteristic_add() is a helper function to simplify the process of adding new characteristics. If you look at the implementation of it, you can see that it calls the same Softdevice function in the end. &lt;/p&gt;
&lt;p&gt;Regardless of which function you use, you have to set the .write_wo_resp&amp;nbsp; or .write proprty to &amp;#39;1&amp;#39; to enable writes to the characteristic. Here it&amp;#39;s how it&amp;#39;s enabled for the NUS RX characteristic for reference:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1641371901205v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create characteristics with different UUIDs?</title><link>https://devzone.nordicsemi.com/thread/345959?ContentTypeID=1</link><pubDate>Tue, 04 Jan 2022 15:34:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b31a053e-b496-4e02-9821-fbbde60d7d9c</guid><dc:creator>Stefano1984</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;br /&gt;thanks for your answer.&lt;br /&gt;I was able to reach my goal thanks to your help.&lt;br /&gt;I was able to add the characteristic but I can&amp;#39;t read or write the characteristic. How do I enable reading and writing of the characteristic?&lt;br /&gt;I used the ble_gatts_char_md_t structure with the sd_ble_gatts_characteristic_add function. See code below:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    uint32_t authentications_service_key_a_add(ble_cus_t * p_cus, const ble_cus_init_t * p_cus_init)
    {
        uint32_t            err_code;
        ble_gatts_char_md_t char_md;
        ble_gatts_attr_t    attr_char_value;
        ble_uuid_t          ble_uuid;
        ble_gatts_attr_md_t attr_md;

        memset(&amp;amp;char_md, 0, sizeof(char_md));

        char_md.char_props.read   = 1;
        char_md.char_props.write  = 0;
        char_md.char_props.notify = 0; 
        char_md.p_char_user_desc  = NULL;
        char_md.p_char_pf         = NULL;
        char_md.p_user_desc_md    = NULL;
        char_md.p_cccd_md         = NULL; 
        char_md.p_sccd_md         = NULL;
		
        ble_uuid.type = p_cus-&amp;gt;uuid_type;
        ble_uuid.uuid = KEY_A_CHARACTERISTIC_UUID;

        memset(&amp;amp;attr_md, 0, sizeof(attr_md));

        attr_md.read_perm  = p_cus_init-&amp;gt;custom_value_char_attr_md.read_perm;
        attr_md.write_perm = p_cus_init-&amp;gt;custom_value_char_attr_md.write_perm;
        attr_md.vloc       = BLE_GATTS_VLOC_STACK;
        attr_md.rd_auth    = 0;
        attr_md.wr_auth    = 0;
        attr_md.vlen       = 0;

        memset(&amp;amp;attr_char_value, 0, sizeof(attr_char_value));

        attr_char_value.p_uuid    = &amp;amp;ble_uuid;
        attr_char_value.p_attr_md = &amp;amp;attr_md;
        attr_char_value.init_len  = sizeof(uint16_t);
        attr_char_value.init_offs = 0;
        attr_char_value.max_len   = sizeof(uint16_t);

        err_code = sd_ble_gatts_characteristic_add(p_cus-&amp;gt;service_handle, &amp;amp;char_md,
                                                   &amp;amp;attr_char_value,
                                                   &amp;amp;p_cus-&amp;gt;key_a_handles);

        return err_code;
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The characteristic_add function does not have a parameter of type ble_gatts_char_md_t. How can I do?&lt;br /&gt;What is the difference between the characteristic_add function and the sd_ble_gatts_characteristic_add function?&lt;br /&gt;Thanks so much.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to create characteristics with different UUIDs?</title><link>https://devzone.nordicsemi.com/thread/345866?ContentTypeID=1</link><pubDate>Tue, 04 Jan 2022 11:02:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f6166fd-00aa-4894-a5be-835ec7523ee9</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I assume you are using the nRF5 SDK now? In that case, you will need to use &lt;span&gt;&lt;a title="sd_ble_uuid_vs_add" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v7.3.0/group___b_l_e___c_o_m_m_o_n___f_u_n_c_t_i_o_n_s.html?cp=4_7_3_1_2_0_2_2_8#ga265b4251110a15120d0aa97e5152163b"&gt;sd_ble_uuid_vs_add&lt;/a&gt;&lt;/span&gt;() to add the base UUIDs for your characteristics. Below you can find a diff showing the changes I made to our UART service initialization (see&amp;nbsp;&lt;span&gt;&lt;a title="UART/Serial Port Emulation over BLE" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/ble_sdk_app_nus_eval.html?cp=8_1_4_2_2_25"&gt;UART/Serial Port Emulation over BLE&lt;/a&gt;&lt;/span&gt;) to make the RX characteristic have a different base UUID compared to the primary service.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="diff"&gt;diff --git a/ble_nus.c b/ble_nus.c
index ca77de6..b32772f 100644
--- a/ble_nus.c
+++ b/ble_nus.c
@@ -244,12 +244,16 @@ void ble_nus_on_ble_evt(ble_evt_t const * p_ble_evt, void * p_context)
     }
 }
 
+#define NUS_RX_BASE_UUID {0x80, 0xb9, 0xcb, 0x22, 0xd4, 0x47, 0x4b, 0x85, 0x8a, 0x4b, 0x88, 0x8e, 0x00, 0x00, 0x90, 0xf2}
+
 
 uint32_t ble_nus_init(ble_nus_t * p_nus, ble_nus_init_t const * p_nus_init)
 {
     ret_code_t            err_code;
     ble_uuid_t            ble_uuid;
+    uint8_t               uuid_tag;
     ble_uuid128_t         nus_base_uuid = NUS_BASE_UUID;
+    ble_uuid128_t         nus_rx_base_uuid = NUS_RX_BASE_UUID;
     ble_add_char_params_t add_char_params;
 
     VERIFY_PARAM_NOT_NULL(p_nus);
@@ -272,11 +276,15 @@ uint32_t ble_nus_init(ble_nus_t * p_nus, ble_nus_init_t const * p_nus_init)
                                         &amp;amp;p_nus-&amp;gt;service_handle);
     /**@snippet [Adding proprietary Service to the SoftDevice] */
     VERIFY_SUCCESS(err_code);
+    
+
+    err_code = sd_ble_uuid_vs_add(&amp;amp;nus_rx_base_uuid, &amp;amp;uuid_tag);
+    VERIFY_SUCCESS(err_code);
 
     // Add the RX Characteristic.
     memset(&amp;amp;add_char_params, 0, sizeof(add_char_params));
     add_char_params.uuid                     = BLE_UUID_NUS_RX_CHARACTERISTIC;
-    add_char_params.uuid_type                = p_nus-&amp;gt;uuid_type;
+    add_char_params.uuid_type                = uuid_tag;
     add_char_params.max_len                  = BLE_NUS_MAX_RX_CHAR_LEN;
     add_char_params.init_len                 = sizeof(uint8_t);
     add_char_params.is_var_len               = true;
diff --git a/sdk_config.h b/sdk_config.h
index 126fe8f..aa4b7ad 100644
--- a/sdk_config.h
+++ b/sdk_config.h
@@ -11466,7 +11466,7 @@
 
 // &amp;lt;o&amp;gt; NRF_SDH_BLE_VS_UUID_COUNT - The number of vendor-specific UUIDs. 
 #ifndef NRF_SDH_BLE_VS_UUID_COUNT
-#define NRF_SDH_BLE_VS_UUID_COUNT 1
+#define NRF_SDH_BLE_VS_UUID_COUNT 2
 #endif
 
 // &amp;lt;q&amp;gt; NRF_SDH_BLE_SERVICE_CHANGED  - Include the Service Changed characteristic in the Attribute Table.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>