<?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>Confused about how to set data length</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/121761/confused-about-how-to-set-data-length</link><description>During my development, I found NRF5 SDK only supports symmetric RX/TX data length settings. 
 Here is the on_data_length_update_request_evt in nrf_ble_gatt.c file. 
 static void on_data_length_update_request_evt(nrf_ble_gatt_t * p_gatt, ble_evt_t const</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 09 Jun 2025 03:44:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/121761/confused-about-how-to-set-data-length" /><item><title>RE: Confused about how to set data length</title><link>https://devzone.nordicsemi.com/thread/538540?ContentTypeID=1</link><pubDate>Mon, 09 Jun 2025 03:44:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e92e94ac-d56d-4d11-8dd5-50082ce29cea</guid><dc:creator>HarryGe</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Thank you for your response&amp;mdash;everything&amp;rsquo;s working great now! I&amp;rsquo;m actually using SDK 15.3, which doesn&amp;rsquo;t include the &lt;code&gt;NRF_BLE_GATT_MTU_EXCHANGE_INITIATION_ENABLED&lt;/code&gt; macro. I checked SDK 17.1 to confirm its scope, then commented out that section in &lt;code&gt;gatt.c&lt;/code&gt; to simulate the macro&amp;rsquo;s behavior. In &lt;code&gt;main()&lt;/code&gt;, I set up a 500 ms timer so that, when acting as a peripheral, it triggers the MTU exchange 500 ms after BLE_GAP_EVT_CONNECTED. The code runs perfectly, and the phone no longer repeatedly requests an asymmetric LL LENGTH (I suspect the previous MTU exchange wasn&amp;rsquo;t actually effective).&lt;/p&gt;
&lt;p&gt;Thanks again for your guidance.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Harry&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Confused about how to set data length</title><link>https://devzone.nordicsemi.com/thread/538504?ContentTypeID=1</link><pubDate>Sat, 07 Jun 2025 06:15:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:706a497f-7733-4df1-bdda-cbbed6149118</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Harry,&lt;/p&gt;
&lt;p&gt;Thanks for confirming. So it seems to be a timing problem. That is, the particular phone(s) you are testing with don&amp;#39;t like that the MTU exchange is initiated immediately from the connection callback. I think a workaround&amp;nbsp;would be if you could delay the MTU initiation. For example, if the phone does not initate the MTU exchange, wait x seconds and&amp;nbsp;call&amp;nbsp;sd_ble_gattc_exchange_mtu_request() in your app.&lt;/p&gt;
&lt;p&gt;The GATT Client role is separate from the GAP central/peripheral roles. A device can act as a GATT Client regardless of whether it&amp;#39;s a GAP central or peripheral.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Confused about how to set data length</title><link>https://devzone.nordicsemi.com/thread/538500?ContentTypeID=1</link><pubDate>Sat, 07 Jun 2025 03:27:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87b2549a-f998-423e-88e2-efe0091c0c57</guid><dc:creator>HarryGe</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Thank you for your previous guidance&amp;mdash;your suggestions were partially helpful. I&amp;rsquo;d like to share an observation regarding MTU exchange behavior:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;With&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;NRF_BLE_GATT_MTU_EXCHANGE_INITIATION_ENABLED&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;enabled&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;My device (as a BLE peripheral) actively initiates MTU exchange in the role of GATTC when connecting to both Android and iOS phones.&lt;/li&gt;
&lt;li&gt;This is unexpected, as I understand the Bluetooth specification requires the central (phone) to act as GATTC and initiate MTU negotiation.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;With the option disabled&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;iOS&lt;/strong&gt;: The phone (central) correctly initiates MTU exchange as GATTC, and communication works normally.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Android&lt;/strong&gt;: The phone does&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;em&gt;not&lt;/em&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;initiate MTU exchange, forcing communication at MTU=23. This causes significant data loss. Additionally, the phone sends inconsistent RX/TX length requests.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Workaround&lt;/strong&gt;: Manually triggering &amp;quot;Request MTU&amp;quot; in the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;em&gt;nRF Connect&lt;/em&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;app resolves the issue&amp;mdash;MTU increases to 247, and RX/TX lengths align at 251.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Given this, disabling the option isn&amp;rsquo;t viable due to Android&amp;rsquo;s failure to initiate MTU exchange. The MTU=23 limitation leads to critical data loss, so I must keep&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;NRF_BLE_GATT_MTU_EXCHANGE_INITIATION_ENABLED&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;enabled for now. However, your insight pinpoints the root issue:&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;the MTU exchange process&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I appreciate your troubleshooting direction&amp;mdash;this clarifies where to focus further efforts. If you have additional suggestions for resolving the non-standard initiation behavior, I&amp;rsquo;d be grateful for your input.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Harry&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Confused about how to set data length</title><link>https://devzone.nordicsemi.com/thread/538428?ContentTypeID=1</link><pubDate>Fri, 06 Jun 2025 13:11:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f4a9a80-e435-4686-adc5-2eb9baa590e9</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Harry,&lt;/p&gt;
&lt;p&gt;Sorry for the delayed response. The latest nRF5 SDK releases included an option named NRF_BLE_GATT_MTU_EXCHANGE_INITIATION_ENABLED, which allowed you to disable automatic MTU exchange initiation. I&amp;#39;m not sure which SDK version you&amp;#39;re using, but could you try not initiating the MTU exchange yourself and instead let the phone handle it to see if that prevents the phone from selecting asymmetric data lengths?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Confused about how to set data length</title><link>https://devzone.nordicsemi.com/thread/537082?ContentTypeID=1</link><pubDate>Tue, 27 May 2025 08:20:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eee2eb53-589b-48b7-8101-90734e17fbdf</guid><dc:creator>HarryGe</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Thank you for getting back to me. I&amp;rsquo;m not completely sure which part of my previous note you were referring to. Could you clarify whether:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;you couldn&amp;rsquo;t find the specific API I mentioned in the SoftDevice documentation, &lt;strong&gt;or&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;you couldn&amp;rsquo;t find anything that confirms whether a manually supplied &lt;em&gt;asymmetric&lt;/em&gt; RX/TX data-length response is actually applied by the stack?&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The challenge I&amp;rsquo;m facing is that the third-party app I need to support sends an LL-length update with different RX and TX values (e.g. RX = 251 bytes, TX = 27 bytes). If I let the SDK handle the request automatically, it forces both directions down to 27 bytes, its unacceptable.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Harry&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Confused about how to set data length</title><link>https://devzone.nordicsemi.com/thread/536939?ContentTypeID=1</link><pubDate>Mon, 26 May 2025 12:58:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ed4ad3d-be8d-45ca-8337-73ab873fef89</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I was not able to find&amp;nbsp;anything in the Softdevice documentation confirming this statement. However, I would still recommend setting the RX/TX values the same way as in the GATT module to avoid potential interoperability issues or bugs with other devices.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>