<?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>Two services on a single device</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/106286/two-services-on-a-single-device</link><description>Here&amp;#39;s what we&amp;#39;re trying to do. We have a gesture recognition wearable that is intended to be used as a remote control for a smartphone. But some smartphone functions are easier to implement using the HID service and some using a custom service. We have</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 11 Apr 2024 08:28:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/106286/two-services-on-a-single-device" /><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/478225?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2024 08:28:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e410428-b235-418f-a2b3-25255847aa8f</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Karl is out of office, so I will look into your questions.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am sorry but there is a lot of information in this ticket. Is it correct that you are trying to connect, then add a new service after the connection? You are not trying to have two concurrent connections with the same device, right?&lt;/p&gt;
&lt;p&gt;Your snippet:&lt;/p&gt;
&lt;p&gt;&amp;quot;cus_init.custom_value_char_attr_md. ...&amp;quot;&lt;/p&gt;
&lt;p&gt;Where do you use this? The custom_calue_char_attr_md is not something coming from us, so it must be something that you wrote. I understand the context, and that you are trying to say that the device needs to be paired to use this characteristic, but perhaps you can show how it is used in your code?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If the issue is that you do not see the other service on the mobile phone, do you see it if you try to connect to it using nRF Connect for Desktop -&amp;gt; Bluetooth Low Energy?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/477387?ContentTypeID=1</link><pubDate>Fri, 05 Apr 2024 22:54:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e48829d-7e58-4f9e-b6b9-a5a970219e51</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;The no mem issue appears to have been a bad sensor with a stuck interrupt bit. This is very difficult to reproduce in a reliable way, but the two services seem to be coexisting. I did this by getting the HID service to connect and bond first and not starting the custom service advertising until after. But now I can&amp;#39;t read the characteristic value in nRF Connect for android, or any other similar app for that matter. I can connect to the server with the app but when I tap refresh services the whirliegig just keeps spinning forever and none of the arrow buttons do anything. Another app told me that notifications were disabled so I added the following to the init structure for the custom service:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    cus_init.custom_value_char_attr_md.cccd_write_perm.sm = 1;
    cus_init.custom_value_char_attr_md.cccd_write_perm.lv = 1;
    cus_init.custom_value_char_attr_md.write_perm.sm = 1;
    cus_init.custom_value_char_attr_md.write_perm.lv = 1;
    cus_init.custom_value_char_attr_md.read_perm.sm = 1;
    cus_init.custom_value_char_attr_md.read_perm.lv = 1;
	&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The app now reports that notifications are enabled but the services still don&amp;#39;t refresh and I still cannot read the characteristic values in nRF connect on Android. And you suggest adding the&amp;nbsp;&lt;span&gt;BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE&amp;nbsp; flag, how and why would I want to do that? Please advise.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/474139?ContentTypeID=1</link><pubDate>Fri, 15 Mar 2024 16:31:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6bea759-9910-4ffb-ad48-1f14abe60e86</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Thank you for your patience with this.&lt;/p&gt;
[quote user="apdobaj"]The device is bonded with the smartphone, and the app that handles the custom service connects without intervention, so my conclusion is that it&amp;#39;s bonded.[/quote]
&lt;p&gt;Could you share the full log from your device when both connections are live?&lt;/p&gt;
[quote user="apdobaj"]I&amp;#39;ve discovered that with both services running , if the smartphone goes out of BT range, neither of the services reconnect automatically. But if I run the HID service and not the custom one, the reconnect happens as expected and all is good. What might be preventing the HID service to reconnect when the custom service is active? What is supposed to happen during a reconnect with a bonded peripheral following a&amp;nbsp; reason 8 disconnect?[/quote]
&lt;p&gt;Reason 8 is connection time out, which is expected when the peer stops replying (such as if it goes out of range).&lt;br /&gt;What happens after the disconnection is up to the peripheral device - you could for instance attempt to reconnect quickly by doing high duty cycle directed advertising targeting the peer that was just lost, to attempt to reconnect, or you could start to advertise normally again and see if the central device shows up again.&lt;br /&gt;You will then need to make sure that your central device is also immediately attempting to reconnect to the lost peer, if you wish for that to happen.&lt;/p&gt;
[quote user="apdobaj"]I&amp;#39;m kind of stumped here. I keep getting an NRF_ERROR_NO_MEM when initializing the adv object for one of the services, but from the map file it seems there&amp;#39;s plenty of room in RAM. Here&amp;#39;s the error message that hardfaults the instant I try to run advertising_init_cus. Debugger output, map file and code snippet attached.&amp;nbsp;[/quote]
&lt;p&gt;Assuming the NRF_ERROR_NO_MEM is returned by the call to&amp;nbsp;ble_advertising_init, then it likely stems from&amp;nbsp;sd_ble_gap_adv_set_configure which will be returned when there is not enough memory to configure a new advertising set.&lt;br /&gt;Could you possibly share the full main.c source file (or the file where you set up your advertising) here instead, so that I may see what might be happening here? It would also be great if you could share your sdk_config.h file, so that I may take a look there as well.&lt;br /&gt;Please let me know if you would like me to make the ticket private before sharing, in case there is any sensitive code.&lt;br /&gt;A private ticket is only viewable by yourself and the support staff here at Nordic.&lt;br /&gt;&lt;br /&gt;As a side-note you should also change to using the&amp;nbsp;BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE flag if your advertising will timeout and stop (as opposed to using an infinite advertising duration).&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/473323?ContentTypeID=1</link><pubDate>Tue, 12 Mar 2024 05:09:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f5bb994-81d5-473b-806a-ccf85fc7df8f</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;I really need to get this figured out, your attention would be most appreciated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/473322?ContentTypeID=1</link><pubDate>Tue, 12 Mar 2024 05:08:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a863b01e-e7c8-4cf4-9db3-dc27165c5fce</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;I&amp;#39;m kind of stumped here. I keep getting an NRF_ERROR_NO_MEM when initializing the adv object for one of the services, but from the map file it seems there&amp;#39;s plenty of room in RAM. Here&amp;#39;s the error message that hardfaults the instant I try to run advertising_init_cus. Debugger output, map file and code snippet attached.&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;Haptic driver interface go! 
LIS3MDL Sensor interface go! 
&amp;lt;info&amp;gt; app_timer: RTC: initialized.
&amp;lt;debug&amp;gt; nrf_sdh: State request: 0x00000000
&amp;lt;debug&amp;gt; nrf_sdh: Notify observer 0x00044078 =&amp;gt; ready
&amp;lt;debug&amp;gt; nrf_sdh: State change: 0x00000000
&amp;lt;debug&amp;gt; nrf_sdh: State change: 0x00000001
&amp;lt;debug&amp;gt; nrf_sdh_ble: RAM starts at 0x20002800
&amp;lt;info&amp;gt; ble_bms: Init complete.
&amp;lt;info&amp;gt; app: HID Keyboard example started.
&amp;lt;info&amp;gt; app: Fast advertising.
&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x10.
&amp;lt;info&amp;gt; app: Connected
&amp;lt;error&amp;gt; app: ERROR 4 [NRF_ERROR_NO_MEM] at C:\Nordic\gestr_GRM_Rev2.0\main.c:3809
PC at: 0x0002BFB5
&amp;lt;error&amp;gt; app: End of error report
&lt;/pre&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/0624.gestr_5F00_GRM_5F00_Rev2.0.map"&gt;devzone.nordicsemi.com/.../0624.gestr_5F00_GRM_5F00_Rev2.0.map&lt;/a&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void advertising_init_cus(void)
{
    uint32_t               err_code;
    uint8_t                adv_flags;
    ble_advertising_init_t init;
    //apdobaj move the uuid&amp;#39;s to the scan response packet to advertise the whole name
    ble_advdata_t sr_data;
    memset(&amp;amp;sr_data, 0, sizeof(sr_data));

    memset(&amp;amp;init, 0, sizeof(init));

    adv_flags                            = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    init.advdata.name_type               = BLE_ADVDATA_FULL_NAME;
    init.advdata.include_appearance      = false;
    //apdobaj change flags per HRS example
    init.advdata.flags                   = adv_flags;
    //init.advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids_cus) / sizeof(m_adv_uuids_cus[0]);
    init.srdata.uuids_complete.p_uuids  = m_adv_uuids_cus;

    init.config.ble_adv_whitelist_enabled          = false; //apdobaj debug note setting
    init.config.ble_adv_directed_high_duty_enabled = false;
    // try connecting to the most recent connection
    init.config.ble_adv_directed_enabled           = false;
    init.config.ble_adv_directed_interval          = APP_ADV_DIRECTED_INTERVAL;
    init.config.ble_adv_directed_timeout           = APP_ADV_DIRECTED_DURATION;
    init.config.ble_adv_fast_enabled               = true;
    init.config.ble_adv_fast_interval              = APP_ADV_FAST_INTERVAL;
    init.config.ble_adv_fast_timeout               = APP_ADV_FAST_DURATION;
    init.config.ble_adv_slow_enabled               = true;
    init.config.ble_adv_slow_interval              = APP_ADV_SLOW_INTERVAL;
    init.config.ble_adv_slow_timeout               = APP_ADV_SLOW_DURATION;

    init.evt_handler   = on_adv_evt_cus;
    init.error_handler = ble_advertising_error_handler;

    err_code = ble_advertising_init(&amp;amp;m_advertising_cus, &amp;amp;init);
    APP_ERROR_CHECK(err_code);


    ble_advertising_conn_cfg_tag_set(&amp;amp;m_advertising_cus, APP_BLE_CONN_CFG_TAG);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/473056?ContentTypeID=1</link><pubDate>Sun, 10 Mar 2024 01:22:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:995f366c-eac8-45d9-8a2f-ad08066c2862</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;I&amp;#39;ve discovered that with both services running , if the smartphone goes out of BT range, neither of the services reconnect automatically. But if I run the HID service and not the custom one, the reconnect happens as expected and all is good. What might be preventing the HID service to reconnect when the custom service is active? What is supposed to happen during a reconnect with a bonded peripheral following a&amp;nbsp; reason 8 disconnect?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/472850?ContentTypeID=1</link><pubDate>Fri, 08 Mar 2024 06:36:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c110c6f9-e94a-402d-9e6d-229d57f216d5</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;This line of inquiry might be a red herring. It seems the custom service handler is reaching the&amp;nbsp;BLE_GAP_EVT_CONNECTED event before it&amp;#39;s connected. Here&amp;#39;s the call stack when breaking on line 278 of ble_cus.c.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/Screenshot-2024_2D00_03_2D00_07-233344.png" /&gt;&lt;/p&gt;
&lt;p&gt;Could this be interfering with the HID service?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/472841?ContentTypeID=1</link><pubDate>Fri, 08 Mar 2024 01:21:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c1297ec5-403e-4a85-afd5-c0e3c3ef0ecb</guid><dc:creator>apdobaj</dc:creator><description>[quote userid="87869" url="~/f/nordic-q-a/106286/two-services-on-a-single-device/472647"]Ah, but then you will still need to bond with the second link, if the links are two separate links.[/quote]
&lt;p&gt;The device is bonded with the smartphone, and the app that handles the custom service connects without intervention, so my conclusion is that it&amp;#39;s bonded.&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/106286/two-services-on-a-single-device/472647"]I am only seeing&amp;nbsp;&lt;em&gt;get&lt;/em&gt; calls here, and no&amp;nbsp;&lt;em&gt;set&lt;/em&gt; - if the issue is that these variables has not been set yet you will not be able to get them.&lt;br /&gt;You will need to add the sd_ble_gatts_sys_attr_set call to your handlng of the BLE_GAP_SYS_ATTR_MISSING event handling.&lt;br /&gt;[/quote]
&lt;p&gt;There are two get commands and one set command. The first get is to obtain the size of the attribute data as I mentioned earlier. And there is no BLE_GAP_SYS_ATTR_MISSING event in SDK 17.1. Can you confirm that the 3401 error would exhibit that behavior (calling send_key_scan_press_release in the HID application runs but the code is never received by the smartphone)?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/472647?ContentTypeID=1</link><pubDate>Thu, 07 Mar 2024 09:44:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9fc2d422-9e6a-4e6c-b52b-8c43bff5c5aa</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user="apdobaj"]There is no second device, only a second service from the same device.[/quote]
&lt;p&gt;Ah, but then you will still need to bond with the second link, if the links are two separate links.&lt;/p&gt;
[quote user="apdobaj"]Here is the code for that:[/quote]
&lt;p&gt;Please make sure to check the error codes returned by your calls to &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.2.0/group___b_l_e___g_a_t_t_s___f_u_n_c_t_i_o_n_s.html#ga4a44241bdcc7262603841f77d9eeb29f"&gt;sd_be_gatts_sys_attr_get&lt;/a&gt; as well.&lt;/p&gt;
[quote user="apdobaj"]If this is the correct resolution, why is&amp;nbsp;sd_ble_gatts_sys_attr_get&amp;nbsp; returning error 5? Please advise.[/quote]
&lt;p&gt;NRF_ERROR_NOT_FOUND means that the variable you are trying to read is not found.&lt;/p&gt;
[quote user="apdobaj"] So I&amp;#39;m trying to fix the 3401 error (attribute missing) when calling&amp;nbsp;&lt;span&gt;sd_ble_gatts_hvx by getting the attributes and then setting them. Here is the code for that:&lt;/span&gt;[/quote]
&lt;p&gt;I am only seeing&amp;nbsp;&lt;em&gt;get&lt;/em&gt; calls here, and no&amp;nbsp;&lt;em&gt;set&lt;/em&gt; - if the issue is that these variables has not been set yet you will not be able to get them.&lt;br /&gt;You will need to add the sd_ble_gatts_sys_attr_set call to your handlng of the BLE_GAP_SYS_ATTR_MISSING event handling.&lt;br /&gt;Please &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/32024/error-code-13313-0x3401-returned-by-ble_nus_string_send/124935#124935"&gt;see this comment, for instance&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/472294?ContentTypeID=1</link><pubDate>Tue, 05 Mar 2024 16:35:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61b71718-df17-404d-b382-f6e638967684</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;There is no second device, only a second service from the same device. But I need both services to be working so I&amp;#39;m heading down that path. So I&amp;#39;m trying to fix the 3401 error (attribute missing) when calling&amp;nbsp;&lt;span&gt;sd_ble_gatts_hvx by getting the attributes and then setting them. Here is the code for that:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
    ret_code_t err_code;
    uint8_t p_attr_data[4];
    uint16_t p_len[1];

    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            NRF_LOG_INFO(&amp;quot;Connected&amp;quot;);
            err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
            APP_ERROR_CHECK(err_code);
            m_conn_handle = p_ble_evt-&amp;gt;evt.gap_evt.conn_handle;
            err_code = nrf_ble_qwr_conn_handle_assign(&amp;amp;m_qwr, m_conn_handle);
            APP_ERROR_CHECK(err_code);
            //apdobaj 27Jun2023 set tx power
            err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_CONN, m_conn_handle, +8);
            APP_ERROR_CHECK(err_code);

            //apdobaj 3Mar2024 get and set system attributes to prevent error 3401 when calling
            //  sd_ble_gatts_hvx in ble_hids.c
            //Use a null pointer to get back the data length.
            err_code = sd_ble_gatts_sys_attr_get(m_conn_handle, NULL, p_len, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
            err_code = sd_ble_gatts_sys_attr_get(m_conn_handle, p_attr_data, p_len, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
            err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, p_attr_data, *p_len, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
            //apdobaj connect HID first then custom
            nrf_delay_ms(2);
#if defined(USE_CUSTOM_SERVICE)
            advertising_init_cus();
            advertising_start_cus();
#endif

            break;
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The first call to&amp;nbsp;sd_ble_gatts_sys_attr_get with the NULL attribute pointer is to get the length of the attribute data (this comes from the infocenter which states &amp;quot;NULL can be provided to obtain the length of the data.&amp;quot;). But this call returns error code 5 which according to nrf_error.h means&amp;nbsp;NRF_ERROR_NOT_FOUND which according to the comments in ble_gatts.h means &amp;quot;no system attributes found&amp;quot;. The second call to&amp;nbsp;sd_ble_gatts_sys_attr_get&amp;nbsp;returns the same error.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Am I understanding this correctly? Is the 3401 error the root cause of the keycode not being sent to the smartphone? Why would this error change to 0x0F when disabling the second service? If this is the correct resolution, why is&amp;nbsp;sd_ble_gatts_sys_attr_get&amp;nbsp; returning error 5? Please advise.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/472286?ContentTypeID=1</link><pubDate>Tue, 05 Mar 2024 15:43:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:baebf92a-ee6f-406f-8a7f-e18091684c7b</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user="apdobaj"]More info: when I disable the custom service, the call to&amp;nbsp;sd_ble_gatts_hvx returns error code 0x0F which I glean is&amp;nbsp;NRF_ERROR_FORBIDDEN. How do I correct that?[/quote]
&lt;p&gt;The call to &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.2.0/group___b_l_e___g_a_t_t_s___f_u_n_c_t_i_o_n_s.html#ga313fe43c2e93267da668572e885945db"&gt;sd_ble_gatts_hvx will fail with the NRF_ERROR_FORBIDDEN return code if the security level of the connection is too low for the security requirements of the characteristic you are attempting to write&lt;/a&gt;. Could you bond for second device as well, to see if this resolves the issue?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/472135?ContentTypeID=1</link><pubDate>Mon, 04 Mar 2024 19:36:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09f59219-379f-4d9a-ac4c-2c6e756fe2ac</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;More info: when I disable the custom service, the call to&amp;nbsp;sd_ble_gatts_hvx returns error code 0x0F which I glean is&amp;nbsp;NRF_ERROR_FORBIDDEN. How do I correct that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/471933?ContentTypeID=1</link><pubDate>Mon, 04 Mar 2024 04:48:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b416240-17c0-41ee-8b7b-6b61db3bb3dd</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;OK, I got both services to run at the same time by bonding the HID connection and then establishing that first (advertise the HID interface only), and then starting the custom service advertising only after the HID interface is connected in ble_evt_handler. However, when I do this the HID interface doesn&amp;#39;t work because I get an attribute missing error 3401 when running&amp;nbsp;sd_ble_gatts_hvx in the&amp;nbsp;ble_hids_inp_rep_send subroutine in the file ble_hids.c. The code compiles and runs without error, but the values are never sent to the smartphone. I&amp;#39;ve tried restoring the sys attributes using&amp;nbsp;sd_ble_gatts_sys_attr_get and&amp;nbsp;sd_ble_gatts_sys_attr_set but that hasn&amp;#39;t worked. Here is the code for the &amp;quot;Connected&amp;quot; case:&amp;nbsp;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            NRF_LOG_INFO(&amp;quot;Connected&amp;quot;);
            err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
            APP_ERROR_CHECK(err_code);
            m_conn_handle = p_ble_evt-&amp;gt;evt.gap_evt.conn_handle;
            err_code = nrf_ble_qwr_conn_handle_assign(&amp;amp;m_qwr, m_conn_handle);
            APP_ERROR_CHECK(err_code);
            //apdobaj 27Jun2023 set tx power
            err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_CONN, m_conn_handle, +8);
            APP_ERROR_CHECK(err_code);
            attrs = sd_ble_gatts_sys_attr_get(m_conn_handle, p_attr_data, p_len, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
            err_code = sd_ble_gatts_sys_attr_get(m_conn_handle, p_attr_data, *p_len, BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
            //apdobaj connect HID first then custom
            nrf_delay_ms(2);
#if defined(USE_CUSTOM_SERVICE)
            advertising_init_cus();
            advertising_start_cus();
#endif

            break;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/466942?ContentTypeID=1</link><pubDate>Wed, 31 Jan 2024 13:09:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:added046-36d4-41ae-a2db-d22f6dd22e30</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Thank you for the update.&lt;/p&gt;
[quote user="apdobaj"]&amp;lt;debug&amp;gt; nrf_sdh_ble: RAM start location can be adjusted to 0x20002990.&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_sdh_ble: RAM size for application can be adjusted to 0x3D670.[/quote]
&lt;p&gt;Please make sure to adjust your flash placement macros for the project to match the suggestion from the nrf_sdh_ble module.&lt;/p&gt;
[quote user="apdobaj"]I have 4 services running, could it be that only two are enabled because of the link count setting?[/quote]
&lt;p&gt;No, the link could should not affect the number of enabled services.&lt;br /&gt;Have you tried connecting to your peripheral from 2 different centrals, and seeing that all the services work as intended then?&lt;br /&gt;I expect that there could be some issue on the smartphone side to &amp;#39;share&amp;#39; the link between the OS and your custom application still, and so this would be a good test to verify that the peripheral is working as intended.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/466816?ContentTypeID=1</link><pubDate>Tue, 30 Jan 2024 16:23:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ddf2dab-afc0-41d4-9123-0a60e6107096</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;Logger output and offending code for no mem hardfault:&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; app_timer: RTC: initialized.&lt;br /&gt;&amp;lt;error&amp;gt; app: ERROR 4 [NRF_ERROR_NO_MEM] at C:\Nordic\gestr_GRM_Rev2.0\main.c:3565&lt;br /&gt;PC at: 0x0002C263&lt;br /&gt;&amp;lt;error&amp;gt; app: End of error report&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    // Enable BLE stack.
    err_code = nrf_sdh_ble_enable(&amp;amp;ram_start);
    APP_ERROR_CHECK(err_code);
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Logger output when trying to exercise both HID and custom (link count set to 2 to avoid the nomem crash):&lt;/p&gt;
&lt;p&gt;Haptic driver interface go! &lt;br /&gt;LIS3MDL Sensor interface go! &lt;br /&gt;&amp;lt;info&amp;gt; app_timer: RTC: initialized.&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_sdh: State request: 0x00000000&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_sdh: Notify observer 0x00044604 =&amp;gt; ready&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_sdh: State change: 0x00000000&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_sdh: State change: 0x00000001&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_sdh_ble: RAM starts at 0x20002BE0&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_sdh_ble: RAM start location can be adjusted to 0x20002990.&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_sdh_ble: RAM size for application can be adjusted to 0x3D670.&lt;br /&gt;&amp;lt;info&amp;gt; ble_bms: Init complete.&lt;br /&gt;&amp;lt;info&amp;gt; app: HID Keyboard example started.&lt;br /&gt;&amp;lt;info&amp;gt; app: Fast advertising.&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x10.&lt;br /&gt;&amp;lt;info&amp;gt; app: Connected&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x14.&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x1A.&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x50.&lt;br /&gt;&amp;lt;info&amp;gt; app: on_write: len 2, p_evt_write-&amp;gt;data[0]: 1, p_evt_write-&amp;gt;data[1]: 0.&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x50.&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x12.&lt;br /&gt;gesture: 3&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x57.&lt;br /&gt;gesture: 3&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x57.&lt;br /&gt;gesture: 7&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_sdh_ble: BLE event: 0x57.&lt;br /&gt;gesture: 2&lt;/p&gt;
&lt;p&gt;&lt;span&gt;gesture: 2&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Note that when exercising the custom interface I get a BLE event 0x57, but no event when exercising the HID interface. Here is the code that goes with that log:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;        switch (finalGesture) {
          case L2R:
            //ble_cus_custom_value_update(&amp;amp;m_cus, gestr_cus_key_array[volUp]);
            keys_send( 1, gestr_hid_key_array+finalGesture );
            break;
          case R2L:
            //ble_cus_custom_value_update(&amp;amp;m_cus, gestr_cus_key_array[volDown]);
            keys_send( 1, gestr_hid_key_array+finalGesture );
            break;
          case U2D:
            ble_cus_custom_value_update(&amp;amp;m_cus, gestr_cus_key_array[mediaPP1]);
            break;
          case D2U:
             //ble_cus_custom_value_update(&amp;amp;m_cus, gestr_cus_key_array[mediaNext]);
             keys_send( 1, gestr_hid_key_array+D2U );
            break;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In this case, gestures 3 and 7 run the custom service, 2 runs the HID interface. Here is a screenshot of the nRF Connect view of this connection. I have 4 services running, could it be that only two are enabled because of the link count setting?&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/Screenshot_5F00_20240130_2D00_091827.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/466716?ContentTypeID=1</link><pubDate>Tue, 30 Jan 2024 10:34:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:569ba19a-45f9-4306-a0c7-ab1e7f021ab0</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user="apdobaj"]I&amp;#39;m trying to increase the link count to 3 but I get an NRF_ERROR_NOMEM when enabling the BLE stack. I&amp;#39;ve tried increasing the stack and heap but that doesn&amp;#39;t help, and ram_start is set to it&amp;#39;s lowest value given the soft device.[/quote]
&lt;p&gt;Could you share your full logger output when this happens?&lt;br /&gt;Were you able to see the logs when you changed the logger backend as I mentioned in my previous comment?&lt;/p&gt;
[quote user="apdobaj"]The custom service is still being disconnected when pairing to the HID service, reason is 19.&amp;nbsp;[/quote]
&lt;p&gt;Could you copy the full error message?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/466349?ContentTypeID=1</link><pubDate>Sun, 28 Jan 2024 06:54:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:274ec98a-61f8-42eb-8f11-e82825232120</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;I&amp;#39;m trying to increase the link count to 3 but I get an NRF_ERROR_NOMEM when enabling the BLE stack. I&amp;#39;ve tried increasing the stack and heap but that doesn&amp;#39;t help, and ram_start is set to it&amp;#39;s lowest value given the soft device.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/466348?ContentTypeID=1</link><pubDate>Sun, 28 Jan 2024 06:22:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa33570e-b12f-4fbf-80f2-c5c6e132f46e</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;The custom service is still being disconnected when pairing to the HID service, reason is 19.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/466347?ContentTypeID=1</link><pubDate>Sun, 28 Jan 2024 05:30:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a499da8-57d3-4b59-ae1b-d4ea734d7afe</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;However, the same thing happens when the HID interface is working (ie, the custom is not advertised).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/466346?ContentTypeID=1</link><pubDate>Sun, 28 Jan 2024 05:20:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab59b909-59fe-494f-9899-b3143e3b40dc</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;OK, I got the phone to accept both services (HID and custom) by making sure that both get bonded. But now, only the custom service works, not HID. I traced sending a keycode over the HID interface all the way back to the&amp;nbsp;BLE_GATTS_EVT_HVN_TX_COMPLETE event in the&amp;nbsp;ble_evt_handler method with no errors. This event handler calls buffer_dequeue and this does throw an error:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    if (BUFFER_LIST_EMPTY())
    {
        err_code = NRF_ERROR_NOT_FOUND;
    }
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This appears to be where execution ends. What does this mean?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/462892?ContentTypeID=1</link><pubDate>Fri, 05 Jan 2024 13:04:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a916f84a-ac1d-4b83-addb-c207fadb9b9c</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user="apdobaj"]i have DEBUG in the preprocessor defines but the debug terminal has nothing and the call stack only extends as far as the gcc error handler (app_error_handler_gcc.c) which tells me nothing useful.[/quote]
&lt;p&gt;Which logger backend have you enabled? The debug terminal will only show RTT loggings, and so if you are using the UART backend for the logger you will need to open a serial monitor to view the logs.&lt;/p&gt;
[quote user="apdobaj"]I separate the advertising into two that I can attempt connecting to both services, but then the other service disconnects. See the code snippets.[/quote]
&lt;p&gt;Which disconnection reason is given on the first connection when it disconnects?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/462781?ContentTypeID=1</link><pubDate>Thu, 04 Jan 2024 22:00:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ac6fcd5-b2c4-4bb3-b46c-7739f77c37fa</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;When I set the peripheral and total link counts to 3 the code compiles but then immediately hardfaults when run, screenshot attached. i have DEBUG in the preprocessor defines but the debug terminal has nothing and the call stack only extends as far as the gcc error handler (app_error_handler_gcc.c) which tells me nothing useful.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/3817.hardfault.png" /&gt;&lt;/p&gt;
&lt;p&gt;With the link count set to 2, and advertising initialized to include both uuid&amp;#39;s, if I pair the app first the advertising stops and so there is no way to connect to the HID service. It&amp;#39;s only when I separate the advertising into two that I can attempt connecting to both services, but then the other service disconnects. See the code snippets.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static ble_uuid_t m_adv_uuids_cushid[] =  {{BLE_UUID_HUMAN_INTERFACE_DEVICE_SERVICE, BLE_UUID_TYPE_BLE},
                                        {CUSTOM_SERVICE_UUID, BLE_UUID_TYPE_VENDOR_BEGIN}}; 
static ble_uuid_t m_adv_uuids_cus[] = {CUSTOM_SERVICE_UUID, BLE_UUID_TYPE_VENDOR_BEGIN};

static ble_uuid_t m_adv_uuids_hid[] = {BLE_UUID_HUMAN_INTERFACE_DEVICE_SERVICE, BLE_UUID_TYPE_BLE};
&lt;/pre&gt;This shows the formulation of the ble_uuid_t struct for both, just custom and just hid.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void advertising_init_cus(void)
{
    uint32_t               err_code;
    uint8_t                adv_flags;
    ble_advertising_init_t init;
    //apdobaj move the uuid&amp;#39;s to the scan response packet to advertise the whole name
    ble_advdata_t sr_data;
    memset(&amp;amp;sr_data, 0, sizeof(sr_data));

    memset(&amp;amp;init, 0, sizeof(init));

    adv_flags                            = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    init.advdata.name_type               = BLE_ADVDATA_FULL_NAME;
    init.advdata.include_appearance      = false;
    //apdobaj change flags per HRS example
    init.advdata.flags                   = adv_flags;
    //init.advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids_cushid) / sizeof(m_adv_uuids_cushid[0]);
    init.srdata.uuids_complete.p_uuids  = m_adv_uuids_cushid;

    init.config.ble_adv_whitelist_enabled          = false; //apdobaj debug note setting
    init.config.ble_adv_directed_high_duty_enabled = false;
    // try connecting to the most recent connection
    init.config.ble_adv_directed_enabled           = false;
    init.config.ble_adv_directed_interval          = APP_ADV_DIRECTED_INTERVAL;
    init.config.ble_adv_directed_timeout           = APP_ADV_DIRECTED_DURATION;
    init.config.ble_adv_fast_enabled               = true;
    init.config.ble_adv_fast_interval              = APP_ADV_FAST_INTERVAL;
    init.config.ble_adv_fast_timeout               = APP_ADV_FAST_DURATION;
    init.config.ble_adv_slow_enabled               = true;
    init.config.ble_adv_slow_interval              = APP_ADV_SLOW_INTERVAL;
    init.config.ble_adv_slow_timeout               = APP_ADV_SLOW_DURATION;

    init.evt_handler   = on_adv_evt;
    init.error_handler = ble_advertising_error_handler;

    err_code = ble_advertising_init(&amp;amp;m_advertising, &amp;amp;init);
    APP_ERROR_CHECK(err_code);


    ble_advertising_conn_cfg_tag_set(&amp;amp;m_advertising, APP_BLE_CONN_CFG_TAG);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And here is the init routine that uses those uuid structs. the only thing I&amp;#39;m changing in this is the two lines involving the uuid, in this code snippet lines 18 and 19.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/462757?ContentTypeID=1</link><pubDate>Thu, 04 Jan 2024 15:48:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67a07c42-871b-4522-9dbe-94ab8a5dab3c</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Thank you for your patience with this.&lt;/p&gt;
[quote user="apdobaj"]and&amp;nbsp;NRF_SDH_BLE_TOTAL_LINK_COUNT to 3 I get a hard fault (I now have a custom service, HID over GATT, BMS, and BAS). When set to 2, it runs but it doesn&amp;#39;t advertise both services. When they advertise concurrently, which &amp;quot;name&amp;quot; do they use?[/quote]
&lt;p&gt;You will need to adjust the total- and the peripheral link-count. Since your device will not be working as a central the centra link-count can be 0. The total link count should be the sum of the central and peripheral link-count, correct.&lt;br /&gt;&lt;br /&gt;What hardfault do you get when you change these settings? Does the BLE init return an error?&lt;br /&gt;Please make sure to have DEBUG defined in your preprocessor defines, like shown in the included image, since this will make the logger output a detailed error message whenever a non-NRF_SUCCESS error code is passed to an APP_ERROR_CHECK.&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/6661.enabling_5F00_debug_5F00_SES.PNG" /&gt;&lt;/p&gt;
[quote user="apdobaj"]When set to 2, it runs but it doesn&amp;#39;t advertise both services. When they advertise concurrently, which &amp;quot;name&amp;quot; do they use?[/quote]
&lt;p&gt;The advertising payload will not change at all when you change the max link-count. Could you clarify what you mean when you say that it does not advertise both services? The advertising will be the same in both cases - i.e the only difference will be that it keeps advertising after the first connection. The second central will connect to the same advertisement as the first central connected to.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/462745?ContentTypeID=1</link><pubDate>Thu, 04 Jan 2024 15:09:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0c9438f-4ef6-4b20-b49d-ff805bb4b9c4</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;Hey Karl, you there? I&amp;#39;ve gotten to the point where I advertise for each service separately by first pairing with the custom service (advertising only with that uuid) and then setting a flag when that connection is established in the custom service event handler. When that flag is detected (it is polled in a timer ISR) then the HID advertising is initialized with its uuid and started. Then I can see the device name in the system settings connected devices dialog and I pair to the HID service. Unfortunately, this causes the custom service to disconnect immediately. This method obviously doesn&amp;#39;t work, so what will work? The device name is set in the GAP settings so I&amp;#39;m presuming this cannot be changed per service. Please advise.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Two services on a single device</title><link>https://devzone.nordicsemi.com/thread/462132?ContentTypeID=1</link><pubDate>Sat, 30 Dec 2023 04:26:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72cb4c02-5d56-4855-b8a7-9b962389d02a</guid><dc:creator>apdobaj</dc:creator><description>&lt;p&gt;OK Karl good stuff, but I need some clarification. First, how do you get more &amp;quot;concurrent connections&amp;quot;? Is it the #define&amp;nbsp;NRF_SDH_BLE_PERIPHERAL_LINK_COUNT, or&amp;nbsp;NRF_SDH_BLE_CENTRAL_LINK_COUNT, or both? Should the number assigned to&amp;nbsp;NRF_SDH_BLE_TOTAL_LINK_COUNT be the first two added together? When I set&amp;nbsp;&lt;span&gt;NRF_SDH_BLE_PERIPHERAL_LINK_COUNT to 3,&amp;nbsp;NRF_SDH_BLE_CENTRAL_LINK_COUNT to zero and&amp;nbsp;NRF_SDH_BLE_TOTAL_LINK_COUNT to 3 I get a hard fault (I now have a custom service, HID over GATT, BMS, and BAS). When set to 2, it runs but it doesn&amp;#39;t advertise both services. When they advertise concurrently, which &amp;quot;name&amp;quot; do they use? Please share the details.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>