<?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>GATT client error NRF_ERROR_DATA_SIZE when performing GATT write even though length is less that ATT_MTU - 3</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110652/gatt-client-error-nrf_error_data_size-when-performing-gatt-write-even-though-length-is-less-that-att_mtu---3</link><description>Hello Nordic team, 
 I have a central client BLE application on nrf52840 that performs GATT write on another BLE server device. From BLE specifications and from various posts on Nordic Dev Zone, I understand that the BLE client can perform a write of</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 08 May 2024 07:19:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110652/gatt-client-error-nrf_error_data_size-when-performing-gatt-write-even-though-length-is-less-that-att_mtu---3" /><item><title>RE: GATT client error NRF_ERROR_DATA_SIZE when performing GATT write even though length is less that ATT_MTU - 3</title><link>https://devzone.nordicsemi.com/thread/482429?ContentTypeID=1</link><pubDate>Wed, 08 May 2024 07:19:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c18930d-3765-4525-a681-d173f6b7ab9f</guid><dc:creator>anusha_14</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;After talking to the 3rd party, I got to know that the maz MTU size for characteristic length was set to 241. When I changed&amp;nbsp;NRF_SDH_BLE_GATT_MAX_MTU_SIZE to 241 on the BLE centra, then it started to work. I think this is because there were two GATT characteristics on BLE peripheral side. BLE central was writing to one characteristic and the other characteristic that needs to be read had a size close to 241 bytes. I think it was probably the application logic on the BLE peripheral that was causing the write to fail.&lt;/p&gt;
&lt;p&gt;I think this ticket can be closed now.&lt;/p&gt;
&lt;p&gt;Thanks for your support.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Anusha&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GATT client error NRF_ERROR_DATA_SIZE when performing GATT write even though length is less that ATT_MTU - 3</title><link>https://devzone.nordicsemi.com/thread/482078?ContentTypeID=1</link><pubDate>Mon, 06 May 2024 14:16:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a63c503e-fead-4ebd-8e2a-12241d62af05</guid><dc:creator>anusha_14</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;Thanks for your response.&amp;nbsp;I am using the BLE peripheral from a 3rd party. So, I have asked them about the max length that is set in their application.&lt;/p&gt;
&lt;p&gt;I will update you once I have an answer.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Anusha&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GATT client error NRF_ERROR_DATA_SIZE when performing GATT write even though length is less that ATT_MTU - 3</title><link>https://devzone.nordicsemi.com/thread/481915?ContentTypeID=1</link><pubDate>Mon, 06 May 2024 07:03:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99f2ab18-6f14-4816-8b3c-1841c0dc2515</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Anusha,&lt;/p&gt;
&lt;p&gt;The only reason I can think of where sd_ble_gattc_write() returns NRF_ERROR_SIZE if it is not limited by the MTU size is if the characteristic that you are trying to write to has a size less than what you are trying to write.&lt;/p&gt;
&lt;p&gt;Taking the ble_app_uart application as an example, the service and characteristics are set up in ble_nus_init().&lt;/p&gt;
&lt;p&gt;If you look at where it initializes it&amp;#39;s RX Characteristic, it sets add_char_params.max_len = BLE_NUS_MAX_RX_CHAR_LEN, so if you increase the MTU, this length will not necessarily increase.&lt;/p&gt;
&lt;p&gt;However, in this example, it is set to NRF_SDH_BLE_GATT_MAX_MTU_SIZE - OPCODE_LENGTH - HANDLE_LENGTH = 247 - 1 - 2 = 244.&lt;/p&gt;
&lt;p&gt;Check what your peripheral has set up as it&amp;#39;s max length on the characteristic that you are trying to write to. If you struggle to find it, what example are you basing your peripheral on?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GATT client error NRF_ERROR_DATA_SIZE when performing GATT write even though length is less that ATT_MTU - 3</title><link>https://devzone.nordicsemi.com/thread/481800?ContentTypeID=1</link><pubDate>Fri, 03 May 2024 12:51:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3ffd1ff-24c2-41ed-8cc6-5e2f32145298</guid><dc:creator>anusha_14</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;Thanks for updating me. I appreciate it.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Anusha&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GATT client error NRF_ERROR_DATA_SIZE when performing GATT write even though length is less that ATT_MTU - 3</title><link>https://devzone.nordicsemi.com/thread/481788?ContentTypeID=1</link><pubDate>Fri, 03 May 2024 12:28:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64c6002b-d610-4714-ace6-8a925e57b297</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Anusha,&lt;/p&gt;
&lt;p&gt;Simon is out of office, and his team asked if I could look into this. I just wanted to let you know that this is not forgotten. I will look into it as soon as possible.&lt;/p&gt;
&lt;p&gt;Sorry for the inconvenience.&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><item><title>RE: GATT client error NRF_ERROR_DATA_SIZE when performing GATT write even though length is less that ATT_MTU - 3</title><link>https://devzone.nordicsemi.com/thread/481199?ContentTypeID=1</link><pubDate>Tue, 30 Apr 2024 06:32:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa5d3345-06f5-40ee-b8d1-698dc6fefbf5</guid><dc:creator>anusha_14</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;Thanks for your response.&lt;/p&gt;
&lt;p&gt;I checked which function was returning the error code as&amp;nbsp;&lt;span&gt;NRF_ERROR_DATA_SIZE. It is this function&amp;nbsp;&lt;strong&gt;sd_ble_gattc_write&amp;nbsp;&lt;/strong&gt;that returns this error code.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;For GATT instance creating, I am using this macro&amp;nbsp;&lt;strong&gt;NRF_BLE_GATT_DEF.&amp;nbsp;&lt;/strong&gt; For GATT initialisation, I am using this function&amp;nbsp;&lt;strong&gt;nrf_ble_gatt_init.&amp;nbsp;&lt;/strong&gt;The values of the macro&amp;nbsp;&lt;strong&gt;NRF_SDH_BLE_GATT_MAX_MTU_SIZE&lt;/strong&gt; is set to &lt;strong&gt;23&lt;/strong&gt; and the macro&amp;nbsp;&lt;strong&gt;NRF_SDH_BLE_GAP_DATA_LENGTH&lt;/strong&gt; is set to &lt;strong&gt;27&lt;/strong&gt; in sdk_config.h&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I am using nRF SDK for Thread and Zigbee since my application needs to work either in Zigbee mode or BLE mode (not concurrently). My application checks a user variable value and depending on its value, it either starts in Zigbee mode or BLE mode. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Please let me know if you need any other details to help in solving this problem.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Anusha&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: GATT client error NRF_ERROR_DATA_SIZE when performing GATT write even though length is less that ATT_MTU - 3</title><link>https://devzone.nordicsemi.com/thread/481098?ContentTypeID=1</link><pubDate>Mon, 29 Apr 2024 13:12:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3df8438-f366-4af7-91b2-16e640d4ac97</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Anusha&lt;/p&gt;
&lt;p&gt;Are you able to see what exact function it is that returns the NRF_ERROR_DATA_SIZE message in your application, as that might give us a pointer to what exactly isn&amp;#39;t the correct data size. My suspicion is that the maximum length in some init function is set to something that won&amp;#39;t allow for bigger writes than 17 somewhere.&lt;/p&gt;
&lt;p&gt;Also, is there a specific reason you&amp;#39;re using the Thread and Zigbee SDK if you&amp;#39;re only doing BLE communication?&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></channel></rss>