<?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>Loss of notifications when sending them from peripheral to central as bulk transfer</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/45679/loss-of-notifications-when-sending-them-from-peripheral-to-central-as-bulk-transfer</link><description>Hi, 
 I have read this thread Notification_Loss but could not understand my problem. 
 On peripheral side, I am making sure that error events are properly handled while doing the bulk transfer. Please see my code below: 
 
 Where TTL_CHUNKS_TEMP == 25</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 03 Apr 2019 14:32:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/45679/loss-of-notifications-when-sending-them-from-peripheral-to-central-as-bulk-transfer" /><item><title>RE: Loss of notifications when sending them from peripheral to central as bulk transfer</title><link>https://devzone.nordicsemi.com/thread/180055?ContentTypeID=1</link><pubDate>Wed, 03 Apr 2019 14:32:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c45d7e2-9152-4235-941f-aece0fb2021f</guid><dc:creator>Muhammad Akram Karimi</dc:creator><description>&lt;p&gt;Oh, what an obvious mistake I made.&lt;/p&gt;
&lt;p&gt;Thanks Edvin for the correction. The issue has been resolved with the following implementation of the code.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint32_t temp_data_burst_xfer(uint32_t* read_buffer_temp)
{
	 static uint8_t cnt = 0;			//Counting the chunks transfered 
   uint32_t        err_code;
	
	while (cnt &amp;lt; TTL_CHUNKS_TEMP &amp;amp;&amp;amp; burst_xfer_process)
  {
        err_code =  Burst_characteristic_update(&amp;amp;m_our_service, read_buffer_temp, cnt);		//Sending 20 bytes [cnt represents which block]
				if(err_code == NRF_SUCCESS)
				{
					cnt++;
				}
				else if (err_code == BLE_ERROR_NO_TX_PACKETS ||
            err_code == NRF_ERROR_INVALID_STATE || 
            err_code == BLE_ERROR_GATTS_SYS_ATTR_MISSING)
        {
					if (err_code == BLE_ERROR_GATTS_SYS_ATTR_MISSING)		//Special handling of BLE_ERROR_GATTS_SYS_ATTR_MISSING
					{
							 SEGGER_RTT_printf(0,&amp;quot;\n\r***  BLE_ERROR_GATTS_SYS_ATTR_MISSING ***\n\r&amp;quot;);
					}
					else if(err_code == NRF_ERROR_INVALID_STATE)
					{
							SEGGER_RTT_printf(0,&amp;quot;NRF_ERROR_INVALID_STATE \n\r&amp;quot;);
					}
					else if (err_code == NRF_ERROR_INVALID_STATE)
					{
							SEGGER_RTT_printf(0,&amp;quot;BLE_ERROR_NO_TX_PACKETS\n\r&amp;quot;);
					}
					break;
        }
				else if (err_code != NRF_SUCCESS) 
        {
						SEGGER_RTT_printf (0, &amp;quot;\r\n Error # 0x%x in &amp;#39;mag_data_burst_xfer&amp;#39;\r\n&amp;quot;,err_code);
            APP_ERROR_HANDLER(err_code);											//Unhandled
        }
	}
	if(cnt == TTL_CHUNKS_TEMP)
	{
		burst_xfer_process=0;			//Burst transfer stopped
		cnt = 0 ;									//Reset for next record transfer
		return NRF_SUCCESS;
	}
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Loss of notifications when sending them from peripheral to central as bulk transfer</title><link>https://devzone.nordicsemi.com/thread/180030?ContentTypeID=1</link><pubDate>Wed, 03 Apr 2019 13:29:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48437ebd-2a01-4246-9256-cd60359f5c87</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;My guess is that your&amp;nbsp;Burst_characteristic_update() returns&amp;nbsp;BLE_ERROR_NO_TX_PACKETS() meaning your buffer is full. When it returns this, it also means that the softdevice didn&amp;#39;t queue the packet that returned this.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I see that you just filter out this return value. I bet that if you add the extra check like you do with&amp;nbsp;BLE_ERROR_GATTS_SYS_ATTR_MISSING and&amp;nbsp;NRF_ERROR_INVALID_STATE, you will see that it is printed.&lt;/p&gt;
&lt;p&gt;since you increase your counter,&amp;nbsp;cnt++ regardless if&amp;nbsp;&lt;span&gt;Burst_characteristic_update() returns NRF_SUCCESS or BLE_ERROR_NO_TX_PACKETS, these packets are never sent.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I suggest that you increase the count only if err_code == NRF_SUCCESS.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Something like this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint32_t temp_data_burst_xfer(uint32_t* read_buffer_temp)
{
	 static uint8_t cnt = 0;			//Counting the chunks transfered 
   uint32_t        err_code;
	
	while (cnt &amp;lt; TTL_CHUNKS_TEMP &amp;amp;&amp;amp; burst_xfer_process)
  {
			  //cnt++;		// Next 20 byte block to send
        err_code =  Burst_characteristic_update(&amp;amp;m_our_service, read_buffer_temp, cnt);		//Sending 20 bytes [cnt represents which block]
				if (err_code == BLE_ERROR_NO_TX_PACKETS ||
            err_code == NRF_ERROR_INVALID_STATE || 
            err_code == BLE_ERROR_GATTS_SYS_ATTR_MISSING)
        {
                    if(err_code == NRF_SUCCESS)
                    {
                        cnt++;  // &amp;lt;-- add this
                    }
					else if (err_code == BLE_ERROR_GATTS_SYS_ATTR_MISSING)		//Special handling of BLE_ERROR_GATTS_SYS_ATTR_MISSING
					{
							 SEGGER_RTT_printf(0,&amp;quot;\n\r***  BLE_ERROR_GATTS_SYS_ATTR_MISSING ***\n\r&amp;quot;);
					}
					else if(err_code == NRF_ERROR_INVALID_STATE)
					{
							SEGGER_RTT_printf(0,&amp;quot;Burst transfer halted due to error NRF_ERROR_INVALID_STATE \n\r&amp;quot;);
					}
					else if(err_code == BLE_ERROR_NO_TX_PACKETS)
					{
					        SEGGER_RTT_printf(0,&amp;quot;BLE_ERROR_NO_TX_PACKETS. Don&amp;#39;t increase cnt++&amp;quot;);
					}
				break;
        }
				else if (err_code != NRF_SUCCESS) 
        {
						SEGGER_RTT_printf (0, &amp;quot;\r\n Error # 0x%x in &amp;#39;mag_data_burst_xfer&amp;#39;\r\n&amp;quot;,err_code);
            APP_ERROR_HANDLER(err_code);											//Unhandled
        }
	}
	if(cnt == TTL_CHUNKS_TEMP)
	{
		burst_xfer_process=0;			//Burst transfer stopped
		cnt = 0 ;									//Reset for next record transfer
		return NRF_SUCCESS;
	}
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I also noted that you increment your counter before you start sending. I believe this means that you skip your first measurement.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you receive BLE_ERROR_NO_TX_PACKETS, and you want to save some battery, you can, instead of just keep trying to send until it receives NRF_SUCCESS, wait until you receive the BLE_GATTS_EVT_HVN_TX_COMPLETE event, and then continue sending notifications after this. This is described in the&amp;nbsp;sd_ble_gatts_hvx() softdevice call.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&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;Edvin&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>