<?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>Write request and Write confirmation</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/56543/write-request-and-write-confirmation</link><description>Hello, 
 When we analyzing the traffic of our application (many thanks to the team developing the sniffer), we have several questions about sending write confirmation. 
 for example, I will use the captured traffic between the sensor and our dongle. Device</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 07 Feb 2020 09:26:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/56543/write-request-and-write-confirmation" /><item><title>RE: Write request and Write confirmation</title><link>https://devzone.nordicsemi.com/thread/233216?ContentTypeID=1</link><pubDate>Fri, 07 Feb 2020 09:26:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:122eb3cd-f4fd-4b1c-9f56-9837aa2d3352</guid><dc:creator>CheMax</dc:creator><description>&lt;p&gt;ok, thanks.&lt;/p&gt;
&lt;p&gt;at the moment there are no questions, but if new ones arise, I&amp;#39;ll&amp;nbsp;be back)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write request and Write confirmation</title><link>https://devzone.nordicsemi.com/thread/231783?ContentTypeID=1</link><pubDate>Thu, 30 Jan 2020 07:10:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:675316bd-f762-43c9-bec7-45c0f1373582</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="CheMax"]Doesn&amp;#39;t the function&amp;nbsp;&lt;strong&gt;sd_ble_gap_next_conn_evt_counter_get() (&lt;/strong&gt;from s140 v7.x.x&lt;strong&gt;)&lt;/strong&gt;&amp;nbsp; no returned the connection event number?[/quote]
&lt;p&gt;&amp;nbsp;Sorry CheMax, yes i missed to see this function. This will get you the event number and return the connection event number, is exactly what you needed&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="CheMax"]I thought that this value would be limited by the size of the buffer allocated to the stack (setting BLE_GATTS_HVN_TX_QUEUE_SIZE_DEFAULT in ble_gatts.h) .but when tracking, I couldn’t queue more than 6-7 packets.here it turns out)[/quote]
&lt;p&gt;&amp;nbsp;How much did you set&amp;nbsp;&lt;span&gt;BLE_GATTS_HVN_TX_QUEUE_SIZE_DEFAULT to be? The number of packets that can be queued into one connection event depends on how the size of the MTU , connection event size and how many the application manage to queue the packets within the connection event.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Sometime the application queing software latency causes it to be unable to queue more than X number of packets. You should be able to identify this by toggling some gpios when you queue a packet for notification and looking at those gpio pins in the logic analyzer to see how fast your application queues the packets.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write request and Write confirmation</title><link>https://devzone.nordicsemi.com/thread/230336?ContentTypeID=1</link><pubDate>Wed, 22 Jan 2020 12:18:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d5aa62e-cf6f-4a55-b8d9-0e8d749de47a</guid><dc:creator>CheMax</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
&lt;p&gt;Nice system on crystal, nice questions about it.&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/56543/write-request-and-write-confirmation/229832"]&amp;nbsp;Yes, only if you set it to Authorize write requests and the confirmation cannot be pulled by the app instantly since the softdevice finished what it does before relinquishing the control to the app. So if you want to have some timestamps in the app event logger then the timestamps will not match the time the SD receives the response.&amp;nbsp;[/quote]
&lt;p&gt;I looked at the messaging sequence diagram in the documentation. However, it seemed to me that this would not let me know when the client would receive a response from the server. But on the other hand, can I see when I queued up a response for sending?&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/56543/write-request-and-write-confirmation/229832"]No. The event counter that sniffer uses means different than the events given to the application from the softdevice. There is no event counter feature in SD and the application need to track this by itself.[/quote]
&lt;p&gt;Doesn&amp;#39;t the function&amp;nbsp;&lt;strong&gt;sd_ble_gap_next_conn_evt_counter_get() (&lt;/strong&gt;from s140 v7.x.x&lt;strong&gt;)&lt;/strong&gt;&amp;nbsp; no returned the connection event number?&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/56543/write-request-and-write-confirmation/229832"]and the application need to track this by itself[/quote]
&lt;p&gt;By application do you understand my part of the server code? or on the client side. If this does not cause difficulties, can you elaborate on this?&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/56543/write-request-and-write-confirmation/229832"] If there were already 7 notifications queued[/quote]
&lt;p&gt;I thought that this value would be limited by the size of the buffer allocated to the stack (setting BLE_GATTS_HVN_TX_QUEUE_SIZE_DEFAULT in ble_gatts.h) .but when tracking, I couldn&amp;rsquo;t queue more than 6-7 packets.here it turns out)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write request and Write confirmation</title><link>https://devzone.nordicsemi.com/thread/229832?ContentTypeID=1</link><pubDate>Mon, 20 Jan 2020 12:31:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c05abe5b-3bf9-459f-a262-cecedbbd0f18</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi CheMax,&lt;/p&gt;
&lt;p&gt;Nice questions. Assuming these are write requests without authorization.&lt;/p&gt;
[quote user=""]&lt;strong&gt;Q1&lt;/strong&gt;. What behavior is considered the most expected (specification does not give an explicit answer)?[/quote]
&lt;p&gt;I think the behavior depends on what state the softdevice is in when it gets the write request. It then need to process the incoming packet and request a timeslot from the timer to be able to schedule to write the response back.&amp;nbsp;The timer module responsibile for giving the timeslot for the softdevice to send a radio packet is a complex beast. There are many variables in which it can decide that it cannot allocate a timeslot to send the packet within the same connection interval and one of the reason could be like you mentioned is that after the request came, there is no enough time left considering that the radio is already transmitting some empty packet.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""]&lt;strong&gt;Q2&lt;/strong&gt;. Is it possible to artificially influence the process of transmitting confirmation (placing characteristics data on the stack (use BLE_GATTS_VLOC_STACK), for example)?[/quote]
&lt;p&gt;I do not think so, Since this is placed in RAM either way and not in flash, the number of instructions that differ to fetch the value from user ram location should not influence this.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
[quote user=""]&lt;strong&gt;Q3&lt;/strong&gt;. Is it possible to receive a program event when confirmation is sent?[/quote]
&lt;p&gt;&amp;nbsp;Yes, only if you set it to Authorize write requests and the confirmation cannot be pulled by the app instantly since the softdevice finished what it does before relinquishing the control to the app. So if you want to have some timestamps in the app event logger then the timestamps will not match the time the SD receives the response.&amp;nbsp;&lt;/p&gt;
[quote user=""]&lt;strong&gt;Q4&lt;/strong&gt;.&amp;nbsp;The sniffer for analysis through a Wireshark adds an event counter. Can I get an event counter in my application?[/quote]
&lt;p&gt;No. The event counter that sniffer uses means different than the events given to the application from the softdevice. There is no event counter feature in SD and the application need to track this by itself.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]&lt;strong&gt;1&lt;/strong&gt; Is this regular behavior or an error in the logic of my application?&amp;nbsp;[/quote]
&lt;p&gt;&amp;nbsp;This is normal if the slave has already&amp;nbsp; buffered notifications to transmit on its end before receiving the write request.&lt;/p&gt;
[quote user=""]&lt;strong&gt;Q5.2&lt;/strong&gt; Does the stack have data sending priorities?[/quote]
&lt;p&gt;No, With respect to data, it transmits in the same sequence the data is queued to be transmitted. If there were already 7 notifications queued when it received a write request, it cannot put the write response in front of all the data that is already queued in front of it.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>