<?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>Reponse time of WRITE WITH RESPONSE command</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/40044/reponse-time-of-write-with-response-command</link><description>Hi 
 I&amp;#39;m using a NRF52840 as multi central with 8 connections 
 SDK: 15.0; SD: 6.1 S140 
 My central connects to a peripheral with a connection interval of 50ms and latency of 0 
 When connected to 1 peripheral, from the time of issuing the sd_ble_gattc_write</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 14 Nov 2018 14:49:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/40044/reponse-time-of-write-with-response-command" /><item><title>RE: Reponse time of WRITE WITH RESPONSE command</title><link>https://devzone.nordicsemi.com/thread/157344?ContentTypeID=1</link><pubDate>Wed, 14 Nov 2018 14:49:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:845c43dc-1156-417e-b7e5-bd06c9fb7119</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Happy to hear that you&amp;#39;re not getting the events in close succession and I apologize that I didnt see the cause of the issue until now :)&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reponse time of WRITE WITH RESPONSE command</title><link>https://devzone.nordicsemi.com/thread/157340?ContentTypeID=1</link><pubDate>Wed, 14 Nov 2018 14:42:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d30d531-ac25-4313-b5e0-1a8ff721ddfa</guid><dc:creator>Tielman</dc:creator><description>&lt;p&gt;Hi &lt;/p&gt;
&lt;p&gt;Great, thanks! Changing &lt;span&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH&amp;nbsp; to 5 does force &lt;em&gt;tevent=6.25ms&lt;/em&gt; and the events are delivered in close succession.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks! This marathon session left me with traces coming out of my ears, but I am glad it is resolved &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&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;Tielman&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reponse time of WRITE WITH RESPONSE command</title><link>https://devzone.nordicsemi.com/thread/157332?ContentTypeID=1</link><pubDate>Wed, 14 Nov 2018 14:23:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b3f2c57-6d6f-493c-8e99-5656c833c82a</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Yes, I think that you are absolutly correct. I just assumed that there were packets missing, i.e. that we didn&amp;#39;t see the empty packets transmitted from the central in the trace.&lt;/p&gt;
&lt;p&gt;So what I think is going on is that SoftDevice scheduler on the Central is allocating the maximum event length for each connection, i.e. connection event length == connection interval, since the&amp;nbsp;&lt;span&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH is set to 320(400ms). If we take a look at &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.sds/dita/softdevices/s130/multilink_scheduling/central_connection_timing.html?cp=2_3_2_0_14_2#concept_fhx_scg_cs__fig_pdp_lqg_cs"&gt;Multilink scheduling with eight connections as a Central and minimum interval&lt;/a&gt;&lt;/span&gt;&lt;a title="Connection timing as a Central" href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.sds/dita/softdevices/s130/multilink_scheduling/central_connection_timing.html?cp=2_3_2_0_14_2"&gt;l&lt;/a&gt;, then we see that the minimum connection interval for C0( and other 7 connections) will be 8*connection event length, which in your case will be 8*30ms = 240ms&lt;/p&gt;
&lt;p&gt;So setting the&amp;nbsp;&lt;span&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH to&amp;nbsp; 5, i.e. a connection event length of 6.25ms, the minimum connection interval is&amp;nbsp;5*1.25ms*8=50ms, should resolve the issue.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Bjørn&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reponse time of WRITE WITH RESPONSE command</title><link>https://devzone.nordicsemi.com/thread/157299?ContentTypeID=1</link><pubDate>Wed, 14 Nov 2018 13:12:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b59c8ae-e7c1-487f-9336-8fe6ba6f1f13</guid><dc:creator>Tielman</dc:creator><description>&lt;p&gt;Hi &lt;span&gt;Bj&amp;oslash;rn&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for the detailed response.&lt;/p&gt;
&lt;p&gt;From my side, I will change &lt;span&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH to 6 and see what happens to the timing. It will be great if the fix is that simple and I&amp;#39;ll let you know what the result is.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
[quote userid="7571" url="~/f/nordic-q-a/40044/reponse-time-of-write-with-response-command/157276"]However, the sniffer trace indicates that the Write response is sent after 6-8 connection events, so it is either the peripheral that takes longer to send the Write Response or it is missing 6-8 connection events[/quote]
&lt;p&gt;Forgive me, but I believe you are not interpreting the trace correctly. A WRITE_RESPONSE is never sent from a peripheral as the first comms on the connection event. It is always after the master sends an Data Channel PDU to start the communications. As per BLE spec Vol 6 Part B 4.5.1:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;The start of a connection event is called an anchor point. At the anchor point, a&lt;/em&gt;&lt;br /&gt;&lt;em&gt;master shall start to transmit a Data Channel PDU to the slave. ... The slave&lt;/em&gt;&lt;br /&gt;&lt;em&gt;listens for the packet sent by its master at the anchor point.&amp;quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;What you pointed out with no packets being sent between the master or slave for the 6-8 connection events points to the softdevice not sending the Data Channel PDU as per Spec:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;Each connection event contains at least one packet sent by the master.&amp;quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Here is a breakdown per packet from 1302 in the trace&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;(Connection EVT 1)&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;1302 - &lt;strong&gt;Master&lt;/strong&gt; send Write Request&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;1303 - Slave ack in same connection event&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;No data for 6-8 connection events&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;(Connection EVT x)&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;1304 - &lt;strong&gt;Master&lt;/strong&gt; initiales comms after 300ms with the empty PDU&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;1305 - Slave send WR_RSP in same connection event&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;You can look through the entire trace, but it is always the master that initiates the communications on a new connection event. If the master does not, the peripheral does not respond. You can therefor see that it is the master that starts the comms (after skipping 6-8 connection events) only 300ms later for the peripheral to then send the WR_RSP.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Tielman&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reponse time of WRITE WITH RESPONSE command</title><link>https://devzone.nordicsemi.com/thread/157276?ContentTypeID=1</link><pubDate>Wed, 14 Nov 2018 12:05:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3c89035-7685-4343-a174-f4a43820dff6</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Tielman,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;the event counter in the sniffer trace shows that the Write Response is sent from the peripheral 6-8 connection events, i.e. 180 &lt;span&gt;msec&lt;/span&gt;(6*30) to 240&amp;nbsp;&lt;span&gt;msec&lt;/span&gt; (8*30) after the Write Request is sent from the central.&amp;nbsp;&lt;span&gt;&amp;nbsp;As you have pointed out he peripheral&amp;nbsp;timing should not change when additional peripherals are connected to the central as the central schedules the connection events for each connection so that all connections have communicate with the central every 30msec. However, the sniffer trace indicates that the Write response is sent after 6-8 connection events, so it is either the peripheral that takes longer to send the Write Response or it is missing 6-8 connection events. The latter should be visible in the sniffer trace, i.e. we should see multiple Write Response packets for each Write Request.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;From the first comment (Nov 1st) it seems that with one peripheral connected the Write Response is sent on the next connection event, i.e. 30msec after the Write Request is sent from the central. The connection event length (&lt;span&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH) defines the maximum length of a connection event in 1.25msec units, i.e. if its set to 320, then the maximum connection event length is 400msec. However, the connection event will close when the transmit buffer is empty, i.e if there is only one packet to be sent, then the connection event is ended and the central moves on to the next connection event for the next peripheral.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The write request is a total of 49 bytes on-air, which at 1Mbps will take 390us, so sending 8 Write Requests&amp;nbsp;will take&amp;nbsp;3.1360 msec&amp;nbsp;, in addition you need to add the time it takes to change between TX and RX for each event (about 40us) and changing&amp;nbsp; frequency of the radio between the event( 140us ), So in total is should be somewhere in the&amp;nbsp;3.1360msec + 8*40us + 8*140us ~ 4.60 milliseconds area., which is leagues away from the max event length of 400msec.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;My suggestion would be to reduce the&amp;nbsp;&lt;span&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH to&amp;nbsp; 6, i.e. a connection event length of 7.5ms and see if that removes the delays. If not, is it possible to run the central and peripheral code on nRF52840 DKs? I could then reproduce the issue here and sniff the on-air packets with a Ellisys Bluetooth protocol analyzer to get the complete picture with no missing packets.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;Best regards&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;Bjørn&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reponse time of WRITE WITH RESPONSE command</title><link>https://devzone.nordicsemi.com/thread/157211?ContentTypeID=1</link><pubDate>Wed, 14 Nov 2018 07:24:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58e143f7-26fd-4230-bab4-dbaada55005f</guid><dc:creator>Tielman</dc:creator><description>&lt;p&gt;Hi Bj&amp;oslash;rn&lt;/p&gt;
&lt;p&gt;1) 30ms connection interval - You are correct, thanks for pointing this out. My peripherals were configured to use 50ms, but I found the the BLE_CONN_INT_MAX_MS on the master side is set to 30 so the connections are created at 30ms and never updated. (I will get back to this)&lt;/p&gt;
&lt;p&gt;2) Your assumption that the peripheral is responsible for the delay in response does not make sense since the peripheral cannot be aware of other peripherals connecting to the master and can therefore not &amp;quot;decide&amp;quot; to wait longer before sending a response when there are more peripherals connected to the master.&lt;/p&gt;
&lt;p&gt;I reiterate the issue: The peripheral response DOES arrive in a timely manner when &lt;strong&gt;only one&lt;/strong&gt; peripheral is connected. As soon as a second is connected, the time from transmitting the WR to receiving the first connections EVT increases, but also that there is a 30ms space between receiving the EVT from each of the other connections. In other words, when sending a WR to 8 different connections at the same time, the first event arrives roughly 300ms later, but all events from the other connections take an extra 30ms to arrive making the total time to wait for receiving the events from all 8 connections to 8x30ms=240ms.&lt;/p&gt;
&lt;p&gt;Since you pointed out the my connection interval is 30ms (which matches the connection event length seen as 30ms), I changed my connection interval to 50ms and then to 100ms just to see that the connection event length also increases to 50ms and then 100ms. Now it takes even longer to receive all the events.&lt;/p&gt;
&lt;p&gt;The softdevice appears to use the connection interval for the connection event length.&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Tielman&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reponse time of WRITE WITH RESPONSE command</title><link>https://devzone.nordicsemi.com/thread/157118?ContentTypeID=1</link><pubDate>Tue, 13 Nov 2018 14:15:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b71f5d4-3dd7-4d07-823c-eba0cacaefb0</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Tielman,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I apologize for the late reply, the SoftDevice needed some time to get back to me.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Ok, so from connection request in the trace we see that the connection interval is set to 30msec, the transmit window is set to 6.5msec and slave latency to 0. The Connection Request is followed up by a MTU Request, where the central asks for it to be set to 247 and the Peripheral replies with 23, i.e. the MTU size for the connection is set to 23.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The first thing&amp;nbsp;they suspected was that the messages were fragmented, e.g. the data sent with the write response did not fit within the MTU of 23. However, this appears to not be the case for the packets after packet no 1301. As far as I can see the value is a 16 byte number, i.e. 19byte in total with the ATT header, which is well within the 23 byte MTU.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Taking a closer look at the trace you attached and the packets sent after packet 1301. From the event counter&amp;nbsp;it seems that&amp;nbsp;the peripheral is sending the Write Response 6-8 connection events after the Write request is sent from the central, but there are packets missing from the trace as the event counter states that there has been 6-8 connection events between the Write Request and Write Response, but in the trace we only see one or two Master-Slave message exchanges(i.e. one or two connection events). This is a known issue with the current version of the sniffer&lt;/p&gt;
&lt;p&gt;So that the delay is at the Link Layer, i.e. the packet is not sent from the peripheral before 6-8 connection events have passed, and not between the reception of the&amp;nbsp;&lt;span&gt;Write Response and signaling of the&amp;nbsp;BLE_GATTC_EVT_WRITE_RSP event in the S140 on the central side.&amp;nbsp;Rather its the peripheral that takes its time to send the Write response.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I think an idea would be to look at the timing on the peripheral side, for instance that you toogle a GPIO when you get the BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST on the peripheral and then toogle the same&amp;nbsp;GPIO prior to calling sd_ble_gatts_rw_authorize_reply() which sends the Write Response? That way we could find out if the delay is added in the peripheral application or by the SD.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;It would also be interesting to get a complete trace, so I was wondering if you have access to a commercial Bluetooth Protocol sniffer (e.g. Ellisys, Frontline or similar)?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;BEst regards&lt;/p&gt;
&lt;p&gt;Bjørn&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reponse time of WRITE WITH RESPONSE command</title><link>https://devzone.nordicsemi.com/thread/156716?ContentTypeID=1</link><pubDate>Fri, 09 Nov 2018 15:57:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3fa32bb0-39f8-401e-aae0-aaa191aa9f67</guid><dc:creator>Tielman</dc:creator><description>&lt;p&gt;Hi &lt;span&gt;Bj&amp;oslash;rn&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I will wait for the softdevice team&amp;#39;s response, thanks.&lt;/p&gt;
&lt;p&gt;However, the 30ms mentioned above is not between events for 1 peripheral, it is between the consecutive connections. In other words,&lt;/p&gt;
&lt;p&gt;Connection 1 receives EVT, 30ms later connection 2 receives EVT, 30ms later connection 3 receives EVT, etc...Also, the 30ms stays the same for 2 connections or for 8 so the 7.5ms x 4 does not seem relevant at all. Also, it does not appear that the connection event length is 7.5ms unless there is another delay that pushes event scheduling to 30ms instead of servicing each connection every 7.5ms.&lt;/p&gt;
&lt;p&gt;From what I see each connection is serviced (Connection_count x &lt;strong&gt;30ms&lt;/strong&gt;) and not (Connection_count x 7.5ms)&lt;/p&gt;
&lt;p&gt;But I will await the response from the team&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Tielman&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reponse time of WRITE WITH RESPONSE command</title><link>https://devzone.nordicsemi.com/thread/156706?ContentTypeID=1</link><pubDate>Fri, 09 Nov 2018 15:18:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5373880c-9311-4f8b-98a2-080578ae751b</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Tielman,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would expect the SoftDevice to&amp;nbsp;issue the&amp;nbsp;&lt;span&gt;BLE_GATTC_EVT_WRITE_RSP&amp;nbsp;to the application as soon as connection event has passed, i.e. after&amp;nbsp;&lt;strong&gt;Connection Event Length ms&lt;/strong&gt; after the connection event started and before the next connection interval.&amp;nbsp; 200ms between the reception of the ATT Write Response and the SoftDevice issuing the&amp;nbsp;BLE_GATTC_EVT_WRITE_RSP&amp;nbsp;to the application does not sound reasonable, when you have a connection interval of 50ms. I have raised this question with the SoftDevice team and will come back to you with their comments.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;As for the questions in your previous comment&lt;br /&gt;&lt;br /&gt;1) Well, in the sniffer trace you are only monitoring the traffic between one peripheral and the central. Keep in mind that you also have 4 other peripherals connected at the same time, so if the&amp;nbsp;&amp;nbsp;Connection Event Length is 7.5ms then the Central will schedule 7.5ms for each connection. This means that the central will use 4*7.5ms = 30ms to talk to the 4 other peripherals before talking to the monitored peripheral again.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2)&amp;nbsp;NRF_SDH_BLE_GAP_EVENT_LENGTH&amp;nbsp;&amp;nbsp;==&amp;nbsp;&amp;nbsp;Connection Event Length. It&amp;#39;s the same thing.&amp;nbsp;&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;Bjørn&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reponse time of WRITE WITH RESPONSE command</title><link>https://devzone.nordicsemi.com/thread/155941?ContentTypeID=1</link><pubDate>Mon, 05 Nov 2018 12:19:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:11239b9e-2f37-452f-973c-c76127bbb330</guid><dc:creator>Tielman</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi&amp;nbsp;&lt;/span&gt;&lt;span&gt;Bj&amp;oslash;rn&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Attached is a sniffer trace between the master and one of the peripherals using Sniffer V2 and Wireshark.&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;From packet 0 to 400 is peripheral advertising&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;From packet 400 to 1050 (roughly) they are connected by not talking (only one connection)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;From packet&amp;nbsp;1050 five more peripherals connected, but with peripheral 1 still not talking&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;From packet 1300 (roughly), the monitored peripheral and central communicate&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Pico-intervals-2.pcapng"&gt;devzone.nordicsemi.com/.../Pico-intervals-2.pcapng&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;From what I could see, the timing corresponded exactly to my previous findings, except that it looks like the peripheral sends the WRITE_RSP in the same connection interval as when it received the write command from the central&amp;nbsp;and also appears tp respond with a notification in the same event (all 150us apart). So is the softdevice&amp;nbsp;receiving the WRITE_RSP event&amp;nbsp;and possibly also a notification from the peripheral in the same 1ms, but only giving that back to the application layer &amp;gt;200ms later?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Let me know your thoughts&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reponse time of WRITE WITH RESPONSE command</title><link>https://devzone.nordicsemi.com/thread/155896?ContentTypeID=1</link><pubDate>Mon, 05 Nov 2018 09:58:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14b027a5-38a1-4b93-983c-fe5bb6e1c7c4</guid><dc:creator>Tielman</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Bj&amp;oslash;rn&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I have not changed those parameters in the config file, but here is what they are configured as:&lt;/p&gt;
&lt;p&gt;#define NRF_SDH_BLE_GAP_EVENT_LENGTH 320&lt;/p&gt;
&lt;p&gt;#define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 247&lt;/p&gt;
&lt;p&gt;#define NRF_SDH_BLE_GAP_DATA_LENGTH 27&lt;/p&gt;
&lt;p&gt;My scan window is 50ms and interval is 100ms, though when I have 8 connections, scanning is stopped so this will only apply to the connection graphs above with less than 8 connections.&lt;/p&gt;
&lt;p&gt;Thanks for the links. I see there is some optimization I need to do in terms of my connection intervals and scanning windows and intervals. Regardless, and to understand the timing better:&lt;/p&gt;
&lt;p&gt;1)&amp;nbsp;You gave an example Connection Event Length of 7.5ms&lt;/p&gt;
[quote userid="7571" url="~/f/nordic-q-a/40044/reponse-time-of-write-with-response-command/155793"]connection event length off 6*1.25ms = 7.5ms[/quote]
&lt;p&gt;, however, from my graphs, it looks like my Tevent-Cx = 30ms since the events arrive 30ms apart? Why so slow and is there a way to reduce this?&lt;/p&gt;
&lt;p&gt;2) I honestly don&amp;#39;t understand what&amp;nbsp;&lt;span&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH&amp;nbsp; is for. Infocentre gives the following description&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;quot;&lt;em&gt;The time set aside for this connection on every connection interval in 1.25 ms units&lt;/em&gt;&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Does this have a part to play in the connection event length?&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 will try and get my packet sniffer working and let you know what I find.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reponse time of WRITE WITH RESPONSE command</title><link>https://devzone.nordicsemi.com/thread/155793?ContentTypeID=1</link><pubDate>Fri, 02 Nov 2018 15:13:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32f6a97d-cae2-41b2-ac58-265fd4b910ba</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Tielman,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Are you able to capture a sniffer trace of the on-air packets using a BLE protocol sniffer e.g. Ellisys or using the &lt;a href="https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF-Sniffer"&gt;nRF Sniffer&lt;/a&gt;&amp;nbsp;v2&amp;nbsp;? It would be very useful in debugging the issue.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also have you altered the&amp;nbsp;NRF_SDH_BLE_GAP_EVENT_LENGTH,&amp;nbsp;NRF_SDH_BLE_GATT_MAX_MTU_SIZE or&amp;nbsp;NRF_SDH_BLE_GAP_DATA_LENGTH values in sdk_config.h?&lt;/p&gt;
&lt;p&gt;The S140 in a central role will schedule the connections as described in the&amp;nbsp;&lt;strong&gt;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.sds/dita/softdevices/s130/multilink_scheduling/central_connection_timing.html"&gt;Connection timing as a Central&lt;/a&gt;&amp;nbsp;&lt;/strong&gt;section in the S140 SoftDevice Specification. In addition to the scheduling the connection events, the central will also&amp;nbsp;add&amp;nbsp;the scanner event&amp;nbsp;after all the connection events, see&amp;nbsp;&lt;span&gt;Figure 3.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;Scanner timing - one or more connections as a Central in the&amp;nbsp;&lt;strong&gt;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.sds/dita/softdevices/s130/multilink_scheduling/scanner_timing_primary_channel.html"&gt;Primary channel scanner timing&lt;/a&gt;&amp;nbsp;&lt;/strong&gt;section.&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In short, if all the write request are send at the same time then the last connection that is scheduled be sent after N*Connection Event Length, where N is the number of connections. So with 50ms and a connection event length off 6*1.25ms = 7.5ms, then the last Write request will be sent 8*7.5ms = &amp;gt;&lt;span&gt;60 milliseconds after the first connection event. If you&amp;#39;re scanning at the same time, then the scan window will have to be added to the&amp;nbsp;N*Connection Event Length value.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regard&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Bjørn&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reponse time of WRITE WITH RESPONSE command</title><link>https://devzone.nordicsemi.com/thread/155523?ContentTypeID=1</link><pubDate>Thu, 01 Nov 2018 10:12:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18a5aa10-a1d5-47bd-a0ca-524bef58ebf4</guid><dc:creator>Tielman</dc:creator><description>&lt;p&gt;To add more details to this...&lt;/p&gt;
&lt;p&gt;I am using FreeRTOS to start with.&lt;/p&gt;
&lt;p&gt;Then, I have done some more controlled test in the following way:&lt;/p&gt;
&lt;p&gt;1)&amp;nbsp;Connections: 1; Send 1 message and resend the message on every WRITE_RSP event&lt;/p&gt;
&lt;p&gt;Result: WRITE_RSP event arrival times after sending message: 210ms, 60ms, 120ms, 150ms, 60ms ... (perfect 30ms windows)&lt;/p&gt;
&lt;p&gt;(IMAGE: Looking at the bottom two rows where there are &amp;#39;i&amp;#39; in: First row&amp;nbsp;is calling&amp;nbsp;&lt;span&gt;sd_ble_gattc_write(); 2nd row is getting BLE_GATTC_EVT_WRITE_RSP)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/Conn_5F00_1-Msg_5F00_repeatSend.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;2) Connections: 2; Send only 1 message on each connection at the same time, not to be repeated on EVT&lt;/p&gt;
&lt;p&gt;Result: First connection&amp;#39;s WR_RSP arrives 130ms after send, 2nd connection&amp;#39;s&amp;nbsp;&lt;span&gt;WR_RSP&lt;/span&gt; arrives another 30ms later&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/Conn_5F00_2-Msg_5F00_1.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;3) Same test as in (2) but with 4 connections&lt;/p&gt;
&lt;p&gt;Result: First connection&amp;#39;s&amp;nbsp;&lt;span&gt;WR_RSP arrives 300ms later, followed by each of the other connections&amp;#39;&amp;nbsp;WR_RSP an extra 30ms later&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/Conn_5F00_4-Msg_5F00_1.PNG" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;4) Same test as (2) &amp;amp; (3) but with 8 connections&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Result: Interestingly the first&amp;nbsp;WR_RSP arrives 250ms later followed by the&amp;nbsp;WR_RSP for of the other connections 30ms appart&amp;nbsp;(so a total of 450ms to receive all&amp;nbsp;WR_RSP events)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/Conn_5F00_8-Msg_5F00_1.PNG" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;5) Connections: 8; Send 1 message per connection at the same time and reply to each&amp;nbsp;WR_RSP event with another message as it arrives&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Result: First&amp;nbsp;WR_RSP event arrives 250ms after sending WRITE with 30ms spacing between each connection&amp;#39;s&amp;nbsp;WR_RSP event, however, the next set of events arrive 250ms after the last&amp;nbsp;WR_RSP event was received. This means that for the second set of sending of WRITE_WITH_RESPONSE commands sent, their corresponding event arrives 470ms later&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/Conn_5F00_8-Msg_5F00_more_5F00_all.PNG" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;6) Connections: 8; Send only 1 message on only one connection and reply to the&amp;nbsp;WR_RSP event (So only 1 connection is talking)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Result: Almost xact same timing&amp;nbsp;as per (5), however, only one connection is talking. Time to event from first write is 300ms. Time to every other event after a write is 470ms&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/Conn_5F00_8-Msg_5F00_only_5F00_to_5F00_one_5F00_peripheral_5F00_continuous.PNG" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So with 8 connections and only one device talking, it takes 470ms just to send one WRITE_WITH_REPONSE and get the corresponding&amp;nbsp;WR_RSP event.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;1) What is the softdevice design that explains this? &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2) Does each connection receive a 30ms (or something) timeslot in which data is sent and received?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3) Is there a SDK setting or something that will allow me to change this to not have such a slow turnaround time for WRITE_WITH_RESPONSE issues when having multiple connections? We are planning on supporting 20 connections so this might be a painful experience if it cannot be changed.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>