<?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>nRF52840 (BMD-340-A-R) + Raspberry Pi 3B+ max MTU size does not work</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/53446/nrf52840-bmd-340-a-r-raspberry-pi-3b-max-mtu-size-does-not-work</link><description>Dear Nordic Support, 
 I am using ble_nus service on nRF52840 (BMD-340-A-R) + Raspberry Pi 3B+ ( https://github.com/IanHarvey/bluepy ). The nRF52840 is the peripheral and the Pi 3B+ is the central. Using nRF5 SDK 15.3 . 
 I set following parameters: </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 13 Nov 2019 08:34:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/53446/nrf52840-bmd-340-a-r-raspberry-pi-3b-max-mtu-size-does-not-work" /><item><title>RE: nRF52840 (BMD-340-A-R) + Raspberry Pi 3B+ max MTU size does not work</title><link>https://devzone.nordicsemi.com/thread/219821?ContentTypeID=1</link><pubDate>Wed, 13 Nov 2019 08:34:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72563279-f72e-43fb-8042-5ff34f93c3b2</guid><dc:creator>Duy</dc:creator><description>&lt;p&gt;Hello &lt;a href="https://devzone.nordicsemi.com/members/simonr"&gt;Simonr&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;Thank you for your support. I think the document is enough for me. I will take time to play with the&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/throughput-and-long-range-demo"&gt;throughput and long-range demo&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; Duy&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 (BMD-340-A-R) + Raspberry Pi 3B+ max MTU size does not work</title><link>https://devzone.nordicsemi.com/thread/219819?ContentTypeID=1</link><pubDate>Wed, 13 Nov 2019 08:23:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30065c6e-1b0f-4cd2-b06d-dd534f2d930f</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Duy&lt;/p&gt;
&lt;p&gt;Our&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/throughput-and-long-range-demo"&gt;throughput and long-range demo&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;(and the documentation it links to) might be able to help you understand the MTU process better. As for how to change the MTU size for the Raspberry Pi, I&amp;#39;m not sure how to do this, and I think that question is better suited for a&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://lb.raspberrypi.org/forums/viewtopic.php?t=212982"&gt;Raspberry Pi forum&lt;/a&gt;, as we focus on Nordic products.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 (BMD-340-A-R) + Raspberry Pi 3B+ max MTU size does not work</title><link>https://devzone.nordicsemi.com/thread/219696?ContentTypeID=1</link><pubDate>Tue, 12 Nov 2019 13:57:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:363c9b44-8ef2-4a9c-9fe9-0e7166d83689</guid><dc:creator>Duy</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/simonr"&gt;Simonr&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;Sorry for my late reply, I don&amp;#39;t have enough board so I had to bought one. I tested as you said and the issues lies in the Raspberry Pi. I don&amp;#39;t know what happens inside it.&lt;/p&gt;
&lt;p&gt;I attached log with both cases: &lt;strong&gt;with MTU exchange removed&lt;/strong&gt; (work - similar to the &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/38563/max-mtu-for-characteristic-read-not-honoured-in-some-cases"&gt;relevant case&lt;/a&gt;) and &lt;strong&gt;without MTU exahnge&lt;/strong&gt;&lt;strong&gt; removed&amp;nbsp;&lt;/strong&gt;(not work). These logs are the connection between the&amp;nbsp;&lt;strong&gt;nRF52840&lt;/strong&gt; and the&amp;nbsp;&lt;strong&gt;Raspberry Pi 3 B+&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Sniffer-with-MTU-exchanged-removed.pcapng"&gt;devzone.nordicsemi.com/.../Sniffer-with-MTU-exchanged-removed.pcapng&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Sniffer-without-MTU-exchanged-removed.pcapng"&gt;devzone.nordicsemi.com/.../Sniffer-without-MTU-exchanged-removed.pcapng&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Honestly, I don&amp;#39;t understand well the about this MTU exchange process, do you know any helpful documents for this?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you and best regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Duy&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 (BMD-340-A-R) + Raspberry Pi 3B+ max MTU size does not work</title><link>https://devzone.nordicsemi.com/thread/216280?ContentTypeID=1</link><pubDate>Wed, 23 Oct 2019 07:08:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8f30b6a-46b2-40bf-b4f7-16dee878a18f</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Have you tried connecting the Raspberry Pi to your Android phone, to confirm whether you&amp;#39;re able to transfer more than 23 bytes between those devices? If not, I think it&amp;#39;s safe to say that the Raspberry Pi is the common denominator in this issue.&lt;/p&gt;
&lt;p&gt;If that&amp;#39;s not the case, you can try sniffing the connection (between the nRF and the Raspberry Pi) using the nRF Sniffer, and upload the sniffer log here, so I can take a look at what happens between the devices when they connect and negotiate the MTU size.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 (BMD-340-A-R) + Raspberry Pi 3B+ max MTU size does not work</title><link>https://devzone.nordicsemi.com/thread/216257?ContentTypeID=1</link><pubDate>Wed, 23 Oct 2019 00:18:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69fc2abb-96ac-47a9-817f-0e10a5697387</guid><dc:creator>Duy</dc:creator><description>&lt;p&gt;Hello &lt;a href="https://devzone.nordicsemi.com/members/simonr"&gt;Simonr&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;Thank you for your answer, you understand the problem correctly.&lt;/p&gt;
&lt;p&gt;I checks things that you told me:&lt;/p&gt;
&lt;p&gt;1/&amp;nbsp;&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/53446/nrf52840-bmd-340-a-r-raspberry-pi-3b-max-mtu-size-does-not-work/215904"]What are the MTU settings of the Raspberry Pi? Is that set to transfer more than 23 bytes by default? I have not looked specifically at this example, but could it be that the Raspberry Pi also uses ble_gatt.h to decide the default MTU?[/quote]
&lt;p&gt;=&amp;gt; It is set to 247 already. There is a configuration param.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2/&amp;nbsp;&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/53446/nrf52840-bmd-340-a-r-raspberry-pi-3b-max-mtu-size-does-not-work/215904"]Did you try the workaround from the &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/38563/max-mtu-for-characteristic-read-not-honoured-in-some-cases"&gt;relevant case&lt;/a&gt; you linked to? Please see the verified answer, and try that out.[/quote]
&lt;p&gt;=&amp;gt; I am still working on the relevant case. Not yet work.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;3/&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/53446/nrf52840-bmd-340-a-r-raspberry-pi-3b-max-mtu-size-does-not-work/215904"]Where in the code is the&amp;nbsp;&lt;strong&gt;NRF_SDH_BLE_GATT_MAX_MTU_SIZE&amp;nbsp;&lt;/strong&gt;set? Are you sure that that is the MTU size that is used by the application, and not the &lt;strong&gt;BLE_GATT_ATT_MTU_DEFAULT&lt;/strong&gt;?[/quote]
&lt;p&gt;=&amp;gt; Below is the function I am using to check. I copied from an example. I also run the debug and it shows that the MTU is changed to 247 bytes.&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))
    {
        m_ble_nus_max_data_len = p_evt-&amp;gt;params.att_mtu_effective - OPCODE_LENGTH - HANDLE_LENGTH;
        NRF_LOG_INFO(&amp;quot;Data len is set to 0x%X(%d)&amp;quot;, m_ble_nus_max_data_len, m_ble_nus_max_data_len);
    }

    m_wrench_send++;

    NRF_LOG_INFO(&amp;quot;ATT MTU exchange completed. central 0x%x peripheral 0x%x&amp;quot;,
                  p_gatt-&amp;gt;att_mtu_desired_central,
                  p_gatt-&amp;gt;att_mtu_desired_periph);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; Duy&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 (BMD-340-A-R) + Raspberry Pi 3B+ max MTU size does not work</title><link>https://devzone.nordicsemi.com/thread/215904?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2019 11:45:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:abf04c45-c498-440e-b9f5-b1b30e68f5d1</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Duy Tran&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s see if I understand your problem correctly. Your nRF52840 (peripheral) is not able to receive/send more than 23 bytes when it is connected to a Raspberry Pi central, but there are no problems if the central is an Android phone for example, is that correct?&lt;/p&gt;
&lt;p&gt;A few things you can check:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What are the MTU settings of the Raspberry Pi? Is that set to transfer more than 23 bytes by default? I have not looked specifically at this example, but could it be that the Raspberry Pi also uses ble_gatt.h to decide the default MTU?&lt;/li&gt;
&lt;li&gt;Did you try the workaround from the &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/38563/max-mtu-for-characteristic-read-not-honoured-in-some-cases"&gt;relevant case&lt;/a&gt; you linked to? Please see the verified answer, and try that out.&lt;/li&gt;
&lt;li&gt;Where in the code is the&amp;nbsp;&lt;strong&gt;NRF_SDH_BLE_GATT_MAX_MTU_SIZE&amp;nbsp;&lt;/strong&gt;set? Are you sure that that is the MTU size that is used by the application, and not the &lt;strong&gt;BLE_GATT_ATT_MTU_DEFAULT&lt;/strong&gt;?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>