<?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>Using GATT Module in IoT UDP example</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/67540/using-gatt-module-in-iot-udp-example</link><description>I want to change DLE/MTU in udp (IoT) example in order to test throughput with max mtu, is it possible? 
 The udp example does not contain nrf_ble_gap library, is it possible to just simply add it and try to test max throughput using max mtu?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 28 Oct 2020 02:26:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/67540/using-gatt-module-in-iot-udp-example" /><item><title>RE: Using GATT Module in IoT UDP example</title><link>https://devzone.nordicsemi.com/thread/277270?ContentTypeID=1</link><pubDate>Wed, 28 Oct 2020 02:26:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5b868d8-89fd-4ae6-b8d9-5530569854f0</guid><dc:creator>Umer Mahmood</dc:creator><description>&lt;p&gt;Thank you for your suggestions. Solved!!&lt;/p&gt;
&lt;p&gt;Actually, what I noticed right after posting the question was, my raspberry pi was not 3b+, but 3B actually.&lt;/p&gt;
&lt;p&gt;So no question of having Data length extension feature.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I quickly moved to RPI 3b+, but now, my connection dropped after a minute.&lt;/p&gt;
&lt;p&gt;I tried RPI 4B as well, but connection dropped, even with un modified udp example, i.e without any changes in data length in sdk_config.h , connection dropped.&lt;/p&gt;
&lt;p&gt;After trying different raspbian verions, the problem still persisted, where as connection was still stable with my Raspberrypi 3B (Bluetooth spec 4.1) but data length was ofcourse not extending.&lt;/p&gt;
&lt;p&gt;Then I added following code and connection became stable as well as DLE worked:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define NRF_SDH_BLE_GAP_DATA_LENGTH 251 
#define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 247

#define NRF_BLE_GATT_ENABLED 1&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;//right after ble_stack_init();

err_code = nrf_ble_gatt_init(&amp;amp;m_gatt, gatt_evt_handler);
if (err_code != NRF_SUCCESS)
    {
        return err_code;
    }
    
err_code = nrf_ble_gatt_att_mtu_periph_set(&amp;amp;m_gatt, NRF_SDH_BLE_GATT_MAX_MTU_SIZE);
if (err_code != NRF_SUCCESS)
    {
        return err_code;
    }
    &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;        case BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST:
        {
            NRF_LOG_DEBUG(&amp;quot;BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST&amp;quot;);
            ret_code_t err_code;
            err_code = sd_ble_gap_data_length_update(p_ble_evt-&amp;gt;evt.gap_evt.conn_handle, NULL, NULL);
            if(err_code == NRF_SUCCESS){
              NRF_LOG_DEBUG(&amp;quot;data_length_Resp_sent_success&amp;quot;);
                                        }
            break;
        }
        case BLE_GAP_EVT_DATA_LENGTH_UPDATE:
        {
            NRF_LOG_DEBUG(&amp;quot;BLE_GAP_EVT_DATA_LENGTH_UPDATE&amp;quot;);

            break;
        }&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using GATT Module in IoT UDP example</title><link>https://devzone.nordicsemi.com/thread/276816?ContentTypeID=1</link><pubDate>Mon, 26 Oct 2020 10:21:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6145663-86e4-4b5d-a954-8b0740f6c3a2</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;The MTU is negotiated on each link, and it will always start at a default value, 27/23/20 bytes, depending on how much of the headers you are counting. You have 20 bytes of BLE payload.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;First after the BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST the changes are negotiated, and at the event&amp;nbsp;BLE_GAP_EVT_DATA_LENGTH_UPDATE it is actually set.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;After connection one of the devices will propose a new MTU, let us say the central suggest 251 bytes. Then the other device (say peripheral) says that it can do 180 bytes. That means that they agree on 180. They will always use the minimum that both support. If your RPi only supports 27, then there is nothing you can do.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Do you get the BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST or BLE_GAP_EVT_DATA_LENGTH_UPDATE events?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using GATT Module in IoT UDP example</title><link>https://devzone.nordicsemi.com/thread/276703?ContentTypeID=1</link><pubDate>Fri, 23 Oct 2020 16:25:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:503e261a-ee1e-41c6-af41-c921f0ece05a</guid><dc:creator>Umer Mahmood</dc:creator><description>&lt;p&gt;Thank you for your reply.&lt;/p&gt;
&lt;p&gt;My question had a mistake, I was referring to nrf_ble_gatt.c. (&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrf__ble__gatt.html" rel="noopener noreferrer" target="_blank"&gt;GATT module&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Goal:&lt;/strong&gt; To evaluate ipv6 over ble throughput with different configurations (&lt;em&gt;ATT_MTU, Data_length, Connection Interval, and Gap Event Length&lt;/em&gt;)&amp;nbsp;similar to&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/ble_sdk_app_att_mtu.html" rel="noopener noreferrer" target="_blank"&gt;ATT_MTU Throughput Example&lt;/a&gt; but I want to do that in experimental iot udp examples (&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/iot_sdk_app_ipv6_stack_udp_server.html"&gt;UDP Examples&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;My setup:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;nRF5 SDK v16.0&lt;/li&gt;
&lt;li&gt;I have udp server example running on nrf52840DK, and raspberrypi 3 b+, as border router. &lt;/li&gt;
&lt;li&gt;I am able to communicate to the udp server from my raspberrypi as well as from other linux pc&amp;#39;s in my local network.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I made following changes in sdk_config.h&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define NRF_SDH_BLE_GAP_DATA_LENGTH 251 
#define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 247

#define NRF_BLE_GATT_ENABLED 1&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And following changes in &lt;strong&gt;ipv6_medium_ble.c&lt;/strong&gt; inside &lt;strong&gt;ipv6_medium_init(...)&lt;/strong&gt; function.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;//right after ble_stack_init();

err_code = nrf_ble_gatt_init(&amp;amp;m_gatt, gatt_evt_handler);
if (err_code != NRF_SUCCESS)
    {
        return err_code;
    }
    
err_code = nrf_ble_gatt_att_mtu_periph_set(&amp;amp;m_gatt, NRF_SDH_BLE_GATT_MAX_MTU_SIZE);
if (err_code != NRF_SUCCESS)
    {
        return err_code;
    }
    &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;But after testing I see that att_mtu remains unchanged, its still only 27 bytes.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using GATT Module in IoT UDP example</title><link>https://devzone.nordicsemi.com/thread/276630?ContentTypeID=1</link><pubDate>Fri, 23 Oct 2020 12:44:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8ce961f-0846-4acd-8704-92afec62eafe</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The IoT folder in SDK root is not maintained (actually it was removed from the latest SDKs).&lt;/p&gt;
&lt;p&gt;The reason for this is that it was not much used, and hence never finished.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I suggest that you look into other implementations than the IP over BLE.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;That said, I am not sure how you change the MTU in these examples.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]The udp example does not contain nrf_ble_gap library[/quote]
&lt;p&gt;&amp;nbsp;Where have you seen it being used?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;For MTU changes, I would look into how the SDK\examples\ble_peripheral\ble_app_uart uses&amp;nbsp;nrf_ble_gatt_att_mtu_periph_set() in main.c, and how the service also uses the callback value from&amp;nbsp;gatt_evt_handler() to set the new MTU in the service (not actually setting anything with regards to the softdevice, but as an application layer protection to prevent it to send too long packets).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;That being said, I wouldn&amp;#39;t recommend using the IoT libraries in commercial products. If so, make sure to test it properly.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>