<?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>sd_ble_gatts_hvx returns NRF_ERROR_INVALID_STATE after sending many notifications.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70867/sd_ble_gatts_hvx-returns-nrf_error_invalid_state-after-sending-many-notifications</link><description>Hi, 
 I am using SDK 17.0.2. I am using write and notification characteristics. There is a write and notification communication between iOS app and device. After successful connection between app and device, app sends some continuous packets and device</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 01 Feb 2021 13:16:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70867/sd_ble_gatts_hvx-returns-nrf_error_invalid_state-after-sending-many-notifications" /><item><title>RE: sd_ble_gatts_hvx returns NRF_ERROR_INVALID_STATE after sending many notifications.</title><link>https://devzone.nordicsemi.com/thread/292240?ContentTypeID=1</link><pubDate>Mon, 01 Feb 2021 13:16:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99187905-6659-4d29-90a1-9f9410419a47</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;I recommend to check out chapter 36:&lt;br /&gt;&lt;a href="https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf"&gt;https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I am not aware of such document for Android, but if it works with iOS, it will work with Android is the general impression I have.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sd_ble_gatts_hvx returns NRF_ERROR_INVALID_STATE after sending many notifications.</title><link>https://devzone.nordicsemi.com/thread/291902?ContentTypeID=1</link><pubDate>Fri, 29 Jan 2021 06:36:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9dd40186-8b22-4f31-af57-daa33f6c5b06</guid><dc:creator>karanbakshi</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;/p&gt;
&lt;p&gt;After some research on devezon, I found similar problem as below.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/11837/automatically-disconnection-ios/44800#44800"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/11837/automatically-disconnection-ios/44800#44800&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So I have tried a sniffer trace and found that there is a &amp;quot;LL_TERMINATE_IND&amp;quot; about 95 seconds after the &amp;quot;CONNECT_REQ&amp;quot;. This error code&amp;nbsp;means &amp;quot;Unacceptable connection parameter&amp;quot;. My issue was with iOS only. With android, it works well.&lt;/p&gt;
&lt;p&gt;So with change in min and max connection interval, it is resolved now but my concern is that what min and mix connection interval should be kept in firmware to make it compatible with all kind of iOS and android devices?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Bipin Patel&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sd_ble_gatts_hvx returns NRF_ERROR_INVALID_STATE after sending many notifications.</title><link>https://devzone.nordicsemi.com/thread/291541?ContentTypeID=1</link><pubDate>Wed, 27 Jan 2021 14:29:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae2d77a2-b64d-4c58-a60c-49037da0766c</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;I can&amp;#39;t really think of anything else no, an nRF sniffer log may be helpful. If you ignore&amp;nbsp;&lt;span&gt;NRF_ERROR_INVALID_STATE, does it eventually work again later?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sd_ble_gatts_hvx returns NRF_ERROR_INVALID_STATE after sending many notifications.</title><link>https://devzone.nordicsemi.com/thread/291427?ContentTypeID=1</link><pubDate>Wed, 27 Jan 2021 07:50:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48762c2c-5e53-472d-b389-4280d60c0977</guid><dc:creator>karanbakshi</dc:creator><description>&lt;p&gt;Thanks Kenneth for reply.&lt;/p&gt;
&lt;p&gt;For &lt;strong&gt;Invalid Connection State&lt;/strong&gt;, I have tried to check any disconnection request from device or phone app side but there is no such request occur from any side&lt;strong&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;For&lt;strong&gt;&amp;nbsp;On going ATT MTU exchange, &lt;/strong&gt;I think this happened initially after connection but I am getting&amp;nbsp;NRF_ERROR_INVALID_STATE after&amp;nbsp;a while, nearly 1 min. Do you think ATT MTU exchange may also happened after 1 mins?&lt;/p&gt;
&lt;p&gt;Let me know if other things I needs to check.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Bipin Patel&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sd_ble_gatts_hvx returns NRF_ERROR_INVALID_STATE after sending many notifications.</title><link>https://devzone.nordicsemi.com/thread/291095?ContentTypeID=1</link><pubDate>Mon, 25 Jan 2021 15:15:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3fb3b6f6-0e53-4198-b63c-cafbc5a4b85b</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;From the documentation I can find about &lt;span&gt;NRF_ERROR_INVALID_STATE&lt;/span&gt;:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v7.2.0/group___b_l_e___g_a_t_t_s___f_u_n_c_t_i_o_n_s.html#ga313fe43c2e93267da668572e885945db"&gt;https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v7.2.0/group___b_l_e___g_a_t_t_s___f_u_n_c_t_i_o_n_s.html#ga313fe43c2e93267da668572e885945db&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;One or more of the following is true:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Invalid Connection State&lt;/li&gt;
&lt;li&gt;Notifications and/or indications not enabled in the CCCD&lt;/li&gt;
&lt;li&gt;An ATT_MTU exchange is ongoing&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If this happens after a while I guess the most likely reasons are:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Invalid Connection State&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;An example would be if sd_ble_gatts_hvx is called&amp;nbsp; when disconnected, for instance after sd_ble_gap_disconnect() but before the reception of the BLE_GAP_EVT_DISCONNECTED event.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;On going ATT MTU exchange&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The simplest solution would be to retry until the ATT MTU exchange is finished. Another solution would be to set a flag when a BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST is received, check this flag prior to calling sd_ble_gatts_hvx and then clear the flag when the NRF_BLE_GATT_EVT_ATT_MTU_UPDATED is generated by the NRF GATT module(nrf_ble_gatt.c).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>