<?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>nRF52805 BLE not fully display data on Android</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/84392/nrf52805-ble-not-fully-display-data-on-android</link><description>Hi, 
 I followed the structure of ble_app_uart__saadc_timer_driven__scan_mode project and customize a program on the nRF52805. I transmit data through BLE to Nordic uart service. I used saadc_callback to send data. However, when receiving data from smart</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 09 Feb 2022 15:31:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/84392/nrf52805-ble-not-fully-display-data-on-android" /><item><title>RE: nRF52805 BLE not fully display data on Android</title><link>https://devzone.nordicsemi.com/thread/352139?ContentTypeID=1</link><pubDate>Wed, 09 Feb 2022 15:31:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21e9bf18-2eea-4ea1-855a-d930040ce99e</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Jeremy&lt;/p&gt;
&lt;p&gt;Thanks for the updated report.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I should have realized that the issue might be related to the&amp;nbsp;NRF_BLE_GATT_MTU_EXCHANGE_INITIATION_ENABLED define.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is a change that was introduced in a recent update to the GATT module where it is up to the application to decide whether or not the peripheral device should initiate the GATT MTU exchange procedure. In older versions the GATT module would always try to do this.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;On iOS this is not necessary since the phone will start the procedure for you, but on some Android devices the phone will not do it and it is up to the peripheral device to do it instead.&amp;nbsp;&lt;/p&gt;
[quote user="Jeremy Wu"]I solve the problem by editing the code in&amp;nbsp;nrf_ble_gatt.c&amp;nbsp; as below:[/quote]
&lt;p&gt;It should not be necessary to change the nrf_ble_gatt.c implementation. All you have to do is set&amp;nbsp;&lt;span&gt;NRF_BLE_GATT_MTU_EXCHANGE_INITIATION_ENABLED&amp;nbsp;to 1 in sdk_config.h:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1644420656639v1.png" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards&lt;br /&gt;Torbjørn&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52805 BLE not fully display data on Android</title><link>https://devzone.nordicsemi.com/thread/351945?ContentTypeID=1</link><pubDate>Wed, 09 Feb 2022 04:25:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f04ec6a-40fb-454d-8a06-865f0e9be2ed</guid><dc:creator>Jeremy Wu</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Torbj&amp;oslash;rn,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I solve the problem by editing the code in&amp;nbsp;nrf_ble_gatt.c&amp;nbsp; as below:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;#if NRF_BLE_GATT_MTU_EXCHANGE_INITIATION_ENABLED
    // Begin an ATT MTU exchange if necessary.
    if (p_link-&amp;gt;att_mtu_desired &amp;gt; p_link-&amp;gt;att_mtu_effective)
    {
        ret_code_t err_code;

        NRF_LOG_DEBUG(&amp;quot;Requesting to update ATT MTU to %u bytes on connection 0x%x.&amp;quot;,
                      p_link-&amp;gt;att_mtu_desired, conn_handle);

        err_code = sd_ble_gattc_exchange_mtu_request(conn_handle, p_link-&amp;gt;att_mtu_desired);

        if (err_code == NRF_SUCCESS)
        {
            p_link-&amp;gt;att_mtu_exchange_requested = true;
        }
        else if (err_code == NRF_ERROR_BUSY)
        {
            p_link-&amp;gt;att_mtu_exchange_pending = true;
            NRF_LOG_DEBUG(&amp;quot;sd_ble_gattc_exchange_mtu_request()&amp;quot;
                          &amp;quot; on connection 0x%x returned busy, will retry.&amp;quot;, conn_handle);
        }
        else
        {
            NRF_LOG_ERROR(&amp;quot;sd_ble_gattc_exchange_mtu_request() returned %s.&amp;quot;,
                          nrf_strerror_get(err_code));
        }
    }
#endif // NRF_BLE_GATT_MTU_EXCHANGE_INITIATION_ENABLED&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The NRF_BLE_GATT_MTU_EXCHANGE_INITIATION_ENABLED&amp;nbsp;is not defined in sdk_config, so when connecting Android the debug output is as below:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app: BLE Data Sent
&amp;lt;info&amp;gt; app: BLE_GAP_EVT_CONNECTED

&amp;lt;info&amp;gt; app: BLE Data Sent
&amp;lt;info&amp;gt; app: BLE_DEFAULT

&amp;lt;info&amp;gt; app: BLE Data Sent
&amp;lt;info&amp;gt; app: BLE_DEFAULT&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt; So when I set NRF_BLE_GATT_MTU_EXCHANGE_INITIATION_ENABLED&amp;nbsp;as 1, it solves the problem. The debug displayed output connecting Android is as below:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app: BLE Data Sent
&amp;lt;info&amp;gt; app: BLE_GAP_EVT_CONNECTED

&amp;lt;info&amp;gt; app: BLE Data Sent
&amp;lt;info&amp;gt; app: Data len is set to 0xF4(244)
&amp;lt;info&amp;gt; app: BLE_DEFAULT

&amp;lt;info&amp;gt; app: BLE Data Sent
&amp;lt;info&amp;gt; app: BLE_DEFAULT

&amp;lt;info&amp;gt; app: BLE Data Sent
&amp;lt;info&amp;gt; app: BLE_DEFAULT&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;However, I still want to know what this MTU exchange Initiation is actually for and why it only works for Andriod. Is this related to a specific Android type? When connecting iOS system, the debug output is always:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app: BLE Data Sent
&amp;lt;info&amp;gt; app: BLE_GAP_EVT_CONNECTED

&amp;lt;info&amp;gt; app: BLE Data Sent
&amp;lt;info&amp;gt; app: BLE_GAP_EVT_PHY_UPDATE_REQUEST

&amp;lt;info&amp;gt; app: BLE Data Sent
&amp;lt;info&amp;gt; app: BLE_DEFAULT

&amp;lt;info&amp;gt; app: BLE Data Sent
&amp;lt;info&amp;gt; app: Data len is set to 0xF4(244)
&amp;lt;info&amp;gt; app: BLE_DEFAULT&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Could you please explain a little about it?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you in advance&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Jeremy&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52805 BLE not fully display data on Android</title><link>https://devzone.nordicsemi.com/thread/351922?ContentTypeID=1</link><pubDate>Tue, 08 Feb 2022 19:11:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9652df91-fac7-4ce6-85c5-8c9ca33444e0</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Jeremy&lt;/p&gt;
&lt;p&gt;Do you think it would be possible to capture a Bluetooth sniffer trace when you connect to the phone and try to send data to it?&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t have a professional Bluetooth sniffer available it is possible to use a Nordic devkit or dongle as a Bluetooth sniffer using the &lt;a href="https://www.nordicsemi.com/Products/Development-tools/nRF-Sniffer-for-Bluetooth-LE"&gt;nRF Sniffer&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52805 BLE not fully display data on Android</title><link>https://devzone.nordicsemi.com/thread/351439?ContentTypeID=1</link><pubDate>Mon, 07 Feb 2022 01:28:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e78596be-23e7-480e-9b70-166a482c4b3c</guid><dc:creator>Jeremy Wu</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Torbj&amp;oslash;rn,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you for your reply.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I am using the Redmi 9A from Xiaomi. It has the Android version: 10 QP1A. 190711.020.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The logging line in&amp;nbsp;gatt_evt_handler is not called in Android or&amp;nbsp;iOS. The log only shows these two lines. The first line is from my ssadc_callback.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app: BLE Data Sent
&amp;lt;info&amp;gt; app: BLE_GAP_EVT_CONNECTED&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Jeremy&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52805 BLE not fully display data on Android</title><link>https://devzone.nordicsemi.com/thread/351293?ContentTypeID=1</link><pubDate>Fri, 04 Feb 2022 11:15:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb06641a-cd7c-4d5d-ac22-1a0da39bbbd9</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What kind of Android device are you using for the test?&lt;/p&gt;
&lt;p&gt;It seems like the MTU exchange is not done on this device, and as such each update is limited to the default 20 bytes (the update from the Android screenshot seems to stop at 20 characters).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you run logging in the example and see if the following line is called?&lt;br /&gt;&lt;a href="https://github.com/NordicPlayground/nRF52-ADC-examples/blob/master/ble_app_uart__saadc_timer_driven__scan_mode/main.c#L470"&gt;https://github.com/NordicPlayground/nRF52-ADC-examples/blob/master/ble_app_uart__saadc_timer_driven__scan_mode/main.c#L470&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>