<?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>Verifying connection event length extension and data length extension</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/39787/verifying-connection-event-length-extension-and-data-length-extension</link><description>Hi, NRF52832, SDK 15.2, SD 132 6.1.0 
 1. How to verify if connection event length extension is enabled (or supported)? 
 In ble_app_att_mtu_throughput in function conn_evt_len_ext_set you are using err_code = sd_ble_opt_set(BLE_COMMON_OPT_CONN_EVT_EXT</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 12 Nov 2018 12:47:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/39787/verifying-connection-event-length-extension-and-data-length-extension" /><item><title>RE: Verifying connection event length extension and data length extension</title><link>https://devzone.nordicsemi.com/thread/156871?ContentTypeID=1</link><pubDate>Mon, 12 Nov 2018 12:47:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51d90f33-ea2e-4e27-bd0a-8e665e23e0b8</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It&amp;#39;s recommended to use &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/sdk_config.html?cp=4_0_0_1_6"&gt;sdk_config.h&lt;/a&gt; to set desired MTU and DLE length. These settings are applied when calling&amp;nbsp;nrf_sdh_ble_default_cfg_set() in ble_stack_init().&amp;nbsp; Data length (MTU/DLE) is then negotiated with the peer device after the connection is established, typically trough the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/lib_ble_gatt.html?cp=4_0_0_3_2_12"&gt;GATT module&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-2fc3deeb59f6433fba04841677497b42/pastedimage1542024890318v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Initialize the GATT module as follows if you want to request the max.&amp;nbsp; MTU size:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Function for initializing the GATT library. */
void gatt_init(void)
{
    ret_code_t err_code;

    err_code = nrf_ble_gatt_init(&amp;amp;m_gatt, gatt_evt_handler);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_ble_gatt_att_mtu_periph_set(&amp;amp;m_gatt, NRF_SDH_BLE_GATT_MAX_MTU_SIZE);
    APP_ERROR_CHECK(err_code);
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You can then check the result of the negotiation by monitoring the callback from the GATT module. E.g.,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Function for handling events from the GATT library. */
void gatt_evt_handler(nrf_ble_gatt_t * p_gatt, nrf_ble_gatt_evt_t const * p_evt)
{
    if ((m_conn_handle == p_evt-&amp;gt;conn_handle) &amp;amp;&amp;amp; (p_evt-&amp;gt;evt_id == NRF_BLE_GATT_EVT_ATT_MTU_UPDATED))
    {
        NRF_LOG_INFO(&amp;quot;MTU size is set to 0x%X(%d)&amp;quot;, p_evt-&amp;gt;params.att_mtu_effective, p_evt-&amp;gt;params.att_mtu_effective);
    }

    if ((m_conn_handle == p_evt-&amp;gt;conn_handle) &amp;amp;&amp;amp; (p_evt-&amp;gt;evt_id == NRF_BLE_GATT_EVT_DATA_LENGTH_UPDATED))
    {
         NRF_LOG_INFO(&amp;quot;LL packet size is set to %d&amp;quot;, p_gatt-&amp;gt;data_length);
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Connection event length extension enables the softdevice to overstay the configured event length in sdk_config.h (see NRF_SDH_BLE_GAP_EVENT_LENGTH), and should be enabled if you want to maximize throughput. Excerpt from SDS:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;&amp;quot;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.sds/dita/softdevices/s130/multilink_scheduling/extend_connection_event.html"&gt;To get the maximum bandwidth on a single link, it is recommended to enable Connection Event Length Extension and increase the connection interval. This will allow the SoftDevice to send more packets within the event and limit the overhead of processing between connection events. For more information, see&amp;nbsp;Suggested intervals and windows.&lt;/a&gt;&amp;quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Unfortunately, I&amp;#39;m not aware of any method for checking if&amp;nbsp; whether event&amp;nbsp;length extension is supported by the peer device except for measuring the throughput or by analyzing the packet transfer with a&amp;nbsp; Bluetooth sniffer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>