<?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>Transmitting multiple Notifications in one Connection Interval</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69173/transmitting-multiple-notifications-in-one-connection-interval</link><description>Hi, we are developing an Application with one nrf52840 acting as central, that is connected to up to three nrf52840 acting as peripheral. For our Project, latency for transmissions from peripheral to central is essential. Thus, we have set the connection</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 09 Dec 2020 09:02:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69173/transmitting-multiple-notifications-in-one-connection-interval" /><item><title>RE: Transmitting multiple Notifications in one Connection Interval</title><link>https://devzone.nordicsemi.com/thread/283970?ContentTypeID=1</link><pubDate>Wed, 09 Dec 2020 09:02:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:feab9798-033e-4cea-a44a-9fdf84f791f0</guid><dc:creator>BjoernSchmitz</dc:creator><description>&lt;p&gt;Ok, I have found the Issue(s). There were two things that prevented me from sending the notifications as expected:&lt;/p&gt;
&lt;p&gt;1. The tx notification queue size on the peripheral was set to the default value of 1. To send multiple notifications in one connection interval, i had to increase the queue size.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    // Configure the BLE stack using the default settings.
    // Fetch the start address of the application RAM.
    uint32_t ram_start = 0;
    err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &amp;amp;ram_start);
    APP_ERROR_CHECK(err_code);

    //sd_ble_cfg_set( , ,&amp;amp;ram_start)
    ble_cfg_t ble_cfg;
    memset(&amp;amp;ble_cfg, 0, sizeof(ble_cfg));

    ble_cfg.conn_cfg.conn_cfg_tag = APP_BLE_CONN_CFG_TAG;
    ble_cfg.conn_cfg.params.gatts_conn_cfg.hvn_tx_queue_size = 2;
    err_code = sd_ble_cfg_set(BLE_CONN_CFG_GATTS, &amp;amp;ble_cfg, ram_start);
    APP_ERROR_CHECK(err_code);
    // 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;2. The other Problem was the setting of &lt;strong&gt;NRF_SDH_BLE_GAP_DATA_LENGTH&lt;/strong&gt;. I used 78, the maximum that the stack would allow me to use when &lt;strong&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH &lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;is set to 2. Instead of using the maximum value, used a smaller value of 30.&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;These two settings in combination allowed me to sent multiple notifications in one connection interval.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Transmitting multiple Notifications in one Connection Interval</title><link>https://devzone.nordicsemi.com/thread/283659?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2020 18:18:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2968089d-3549-4a5b-9f7c-52a3bb7957e1</guid><dc:creator>Kenneth</dc:creator><description>[quote user="BjoernSchmitz"]Ok but i only transmit data via notifications from the peripheral to the central. Thus the central should generate the event imidiately when the packet is received, correct?[/quote]
&lt;p&gt;I expect it will be raised during post processing of the connection event.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
[quote user="BjoernSchmitz"]&lt;p&gt;Or do you expect the peripheral to wait, until one packet was answered, until it sends the next one?&lt;/p&gt;
&lt;p&gt;However, this still does not explain why notifications with more than 19 bytes are seperated into two connection intervals.&lt;/p&gt;[/quote]
&lt;p&gt;A sniffer log will show what is happening here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Transmitting multiple Notifications in one Connection Interval</title><link>https://devzone.nordicsemi.com/thread/283654?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2020 17:53:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:945c362a-482b-4c57-8b32-83c6e9992e96</guid><dc:creator>BjoernSchmitz</dc:creator><description>&lt;p&gt;Ok but i only transmit data via notifications from the peripheral to the central. Thus the central should generate the event imidiately when the packet is received, correct? Or do you expect the peripheral to wait, until one packet was answered, until it sends the next one?&lt;/p&gt;
&lt;p&gt;However, this still does not explain why notifications with more than 19 bytes are seperated into two connection intervals.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Transmitting multiple Notifications in one Connection Interval</title><link>https://devzone.nordicsemi.com/thread/283634?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2020 16:08:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd587b83-2f39-4243-ac2f-6339b42b6c3b</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;It may be noise in the system that cause packet(s) not be received, in BLE each packet contain a sequence number and a next expected sequence number. It is only after receiving the next expected sequence number that a device will know that the previous packet have been successfully received. So typically a receiving device can raise the event immediately, while a transmitting device may need to wait until next connection event before it will know that the packet was successfully received. It is this way by design to ensure that all packets are reliably sent and received.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Transmitting multiple Notifications in one Connection Interval</title><link>https://devzone.nordicsemi.com/thread/283630?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2020 15:50:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:262cdfde-039c-489e-9d2f-2833950c862f</guid><dc:creator>BjoernSchmitz</dc:creator><description>&lt;p&gt;I allready use gatt_init() and i also check the event handler that tells me that the data length is updated to 78, like i specified with &lt;strong&gt;NRF_SDH_BLE_GAP_DATA_LENGTH&lt;/strong&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**@brief GATT module event handler.
 */
static void gatt_evt_handler(nrf_ble_gatt_t * p_gatt, nrf_ble_gatt_evt_t const * p_evt)
{
    switch (p_evt-&amp;gt;evt_id)
    {
        case NRF_BLE_GATT_EVT_ATT_MTU_UPDATED:
        {
            NRF_LOG_INFO(&amp;quot;GATT ATT MTU on connection 0x%x changed to %d.&amp;quot;,
                         p_evt-&amp;gt;conn_handle,
                         p_evt-&amp;gt;params.att_mtu_effective);
        } break;

        case NRF_BLE_GATT_EVT_DATA_LENGTH_UPDATED:
        {
            NRF_LOG_INFO(&amp;quot;Data length for connection 0x%x updated to %d.&amp;quot;,
                         p_evt-&amp;gt;conn_handle,
                         p_evt-&amp;gt;params.data_length);
        } break;

        default:
            break;
    }
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This outputs me &amp;quot;Data length for connection 0 updated to 78.&amp;quot; after the connection is established. Does that mean DLE is enabled?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="2111" url="~/f/nordic-q-a/69173/transmitting-multiple-notifications-in-one-connection-interval/283623#283623"]I would like to see the sniffer log, because it may be that there are 2 packets sent in the connection interval, however the link layer acknowledge that they are actually received may be on the next connection interval. This will seemingly look like it takes two intervals to wait for the HVX event.[/quote]
&lt;p&gt;When I send two notifications at the same time, both notifications are received in 7.5 ms delay at the central. So one notification is answered direclty and the other is answered in the next connection interval? Does the softdevice generate the event on the central only after the answer to the peripheral was sent?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Transmitting multiple Notifications in one Connection Interval</title><link>https://devzone.nordicsemi.com/thread/283623?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2020 15:34:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de22bff1-97bd-4589-853c-1ccf71e174d6</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;In general you will need DLE enabled to send notifications larger than 20bytes effectively, else they will be split into several packets on the link layer. If you include gatt_init() in your application this typically will ensure that the DLE is updated (you can check the callback handler if you have enabled it).&lt;/p&gt;
&lt;p&gt;I would like to see the sniffer log, because it may be that there are 2 packets sent in the connection interval, however the link layer acknowledge that they are actually received may be on the next connection interval. This will seemingly look like it takes two intervals to wait for the HVX event.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Transmitting multiple Notifications in one Connection Interval</title><link>https://devzone.nordicsemi.com/thread/283619?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2020 15:24:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66b25114-ec27-4dbb-b3f3-a8d77a96cf63</guid><dc:creator>BjoernSchmitz</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;thanks for the quick reply. Unfortunaltely we don&amp;#39;t have a sniffer yet. But we will get the correct Developement Kit and install the sniffer software as soon as possible. In the meantime, do you have any idea why we can not send more than 19 bytes per connection interval, using NUS? If &lt;strong&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH &lt;/strong&gt;is set to 78, we should be able to sent multiple notifications per connection interval. Is that correct?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Bj&amp;ouml;rn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Transmitting multiple Notifications in one Connection Interval</title><link>https://devzone.nordicsemi.com/thread/283610?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2020 15:06:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:adc5a193-7383-4a5a-871e-71b330836132</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Do you have any on-air sniffer log that we can take a look at?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Sniffer-for-Bluetooth-LE"&gt;https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Sniffer-for-Bluetooth-LE&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ug_sniffer_ble/UG/sniffer_ble/intro.html"&gt;https://infocenter.nordicsemi.com/topic/ug_sniffer_ble/UG/sniffer_ble/intro.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>