<?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>How can I identify the transmission completion of a packet when using NCS?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/104557/how-can-i-identify-the-transmission-completion-of-a-packet-when-using-ncs</link><description>Hi Nordic team, 
 
 
 
 
 
 
 
 I&amp;#39;m using the bt_gatt_notify_cb function to send notifications about data. 
 
 
 
 
 
 
 
 In the SDK, I can ascertain that the data has been successfully sent through the &amp;quot;BLE_GATTS_EVT_HVN_TX_COMPLETE&amp;quot; event. However</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 23 Oct 2023 10:06:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/104557/how-can-i-identify-the-transmission-completion-of-a-packet-when-using-ncs" /><item><title>RE: How can I identify the transmission completion of a packet when using NCS?</title><link>https://devzone.nordicsemi.com/thread/451667?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2023 10:06:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3f19c63-db85-4ac9-88e2-1ab70855ce90</guid><dc:creator>lammobile</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/kme"&gt;Kenneth&lt;/a&gt;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;It sounds reasonable, I use this method to indirectly count the number of packets in the Queue. Thank you for your enthusiastic help.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Thanks,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Lam&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I identify the transmission completion of a packet when using NCS?</title><link>https://devzone.nordicsemi.com/thread/451666?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2023 10:03:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e853a79-cbd3-4a55-8b3a-b891c7fd1696</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;It may be that the packet is actually sent, but the acknowledge that the packet is received is likely not received until next event (because then the sequence number is incremented). In case of packet loss, it will wait for &amp;quot;acknowledge&amp;quot; before stating that packet was sent.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I identify the transmission completion of a packet when using NCS?</title><link>https://devzone.nordicsemi.com/thread/451664?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2023 09:51:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad7dabe0-3e5a-40e4-aa9b-419c3557ddf3</guid><dc:creator>lammobile</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/kme"&gt;Kenneth&lt;/a&gt;&amp;nbsp;,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for quick reply.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;div data-testid="conversation-turn-3"&gt;
&lt;div class="p-4 justify-center text-base md:gap-6 md:py-6 m-auto"&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div class="flex-col gap-1 md:gap-3"&gt;
&lt;div class="flex flex-grow flex-col gap-3 max-w-full"&gt;
&lt;div&gt;
&lt;div class="markdown prose w-full break-words dark:prose-invert dark"&gt;
&lt;p&gt;That&amp;#39;s not really a problem, I just want to find an explanation for this phenomenon because I always see one packet left in the queue after notifying. It would make more sense if it was sent out and there were no packets left in the queue.&lt;br /&gt;&lt;br /&gt;Lam&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="flex justify-between empty:hidden gizmo:justify-start gizmo:gap-3 lg:block"&gt;
&lt;div class="text-gray-400 flex self-end lg:self-center justify-center gizmo:lg:justify-start mt-2 gizmo:mt-0 visible lg:gap-1 lg:absolute lg:top-0 lg:translate-x-full lg:right-0 lg:mt-0 lg:pl-2 gap-2 md:gap-3"&gt;
&lt;div class="flex gap-1 gizmo:gap-3"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I identify the transmission completion of a packet when using NCS?</title><link>https://devzone.nordicsemi.com/thread/451643?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2023 08:32:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7bd5b288-19a8-408b-9cc6-73ab154978f6</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Normally data should be sent every connection interval yes, but if either peer is doing something different (e.g. scanning, advertising, possible flash write operation), then this may skip one of a few intervals. Can that be the problem here? Alternatively it can be noise of course (e.g. wifi) that cause packet to be lost, or you may also look into trying to increase the tolerance (e.g. in ppm) of the lfclk in case it&amp;#39;s somethow related to either lfclk sources are a bit on the edge of configured setting, but if that was the problem you should see it much more frequently than like you do in this plot.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I identify the transmission completion of a packet when using NCS?</title><link>https://devzone.nordicsemi.com/thread/451472?ContentTypeID=1</link><pubDate>Fri, 20 Oct 2023 10:05:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:167b0126-8951-43e7-bf8c-4ce3f7da3249</guid><dc:creator>lammobile</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/kme"&gt;Kenneth&lt;/a&gt;&amp;nbsp;&lt;br /&gt;&lt;span&gt;One more question, according to my connection parameters, the Windowsize is 6.25ms, which means it can transmit a maximum of 3 packets per interval. However, in my image, it doesn&amp;#39;t meet the expectation. It doesn&amp;#39;t flush all the data in the queue as quickly as expected, like the last packet, it only succeeds after some time of notification, under good connection conditions.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1697796349710v2.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I identify the transmission completion of a packet when using NCS?</title><link>https://devzone.nordicsemi.com/thread/451470?ContentTypeID=1</link><pubDate>Fri, 20 Oct 2023 09:56:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e2fcda6-953e-48e0-acca-32245e128bf8</guid><dc:creator>lammobile</dc:creator><description>&lt;div data-testid="conversation-turn-11"&gt;
&lt;div class="p-4 justify-center text-base md:gap-6 md:py-6 m-auto"&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div class="flex-col gap-1 md:gap-3"&gt;
&lt;div class="flex flex-grow flex-col gap-3 max-w-full"&gt;
&lt;div&gt;
&lt;div class="markdown prose w-full break-words dark:prose-invert light"&gt;
&lt;p&gt;Thank you, it has been working for me.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="flex justify-between empty:hidden gizmo:justify-start gizmo:gap-3 lg:block"&gt;
&lt;div class="text-gray-400 flex self-end lg:self-center justify-center gizmo:lg:justify-start mt-2 gizmo:mt-0 visible lg:gap-1 lg:absolute lg:top-0 lg:translate-x-full lg:right-0 lg:mt-0 lg:pl-2 gap-2 md:gap-3"&gt;
&lt;div class="flex gap-1 gizmo:gap-3"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How can I identify the transmission completion of a packet when using NCS?</title><link>https://devzone.nordicsemi.com/thread/449835?ContentTypeID=1</link><pubDate>Wed, 11 Oct 2023 13:04:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f9dd7c47-2de6-4e6b-ac67-f4cfe70fec33</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am not aware of any way to find how many packets are waiting in the queue no, but if you are using the notify with callback function, isn&amp;#39;t the callback being called to indicate that the packet is sent? Ref for instance from nus.c service where on_sent() is called:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int bt_nus_send(struct bt_conn *conn, const uint8_t *data, uint16_t len)
{
	struct bt_gatt_notify_params params = {0};
	const struct bt_gatt_attr *attr = &amp;amp;nus_svc.attrs[2];

	params.attr = attr;
	params.data = data;
	params.len = len;
	params.func = on_sent;

	if (!conn) {
		LOG_DBG(&amp;quot;Notification send to all connected peers&amp;quot;);
		return bt_gatt_notify_cb(NULL, &amp;amp;params);
	} else if (bt_gatt_is_subscribed(conn, attr, BT_GATT_CCC_NOTIFY)) {
		return bt_gatt_notify_cb(conn, &amp;amp;params);
	} else {
		return -EINVAL;
	}
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>