<?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>nRF5340 BLE Transmission delay</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111883/nrf5340-ble-transmission-delay</link><description>Hi 
 
 
 
 
 
 
 
 
 
 
 
 We are using the nRF5340DK with NCS Version 2.6.1. 
 Our goal is to send 52 bytes every 20 ms. To achieve this, we have configured the parameters as follows: MTU is set to 66 bytes, Connection Interval is 7.5 ms, and Event Length</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 26 Jun 2024 06:20:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111883/nrf5340-ble-transmission-delay" /><item><title>RE: nRF5340 BLE Transmission delay</title><link>https://devzone.nordicsemi.com/thread/490748?ContentTypeID=1</link><pubDate>Wed, 26 Jun 2024 06:20:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50b5e607-1fa1-41de-a87b-a76e7e38e6f8</guid><dc:creator>JONATHAN LL</dc:creator><description>&lt;p&gt;I don&amp;#39;t have a reasonable explanation to why it takes that much time as of now, it seems it should not so still looking in to what is causing this behaviour.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;As for examples on real time monitoring technics I am not aware of any examples or setups for this.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;What I think would be the best configuration here is to use a separate thread to that pushes packages to the BLE-stack so that the main thread would not be delayed if the function is blocked.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Best setup for investigating further would be to use SystemViewer and see what is happening, could give some more insight to what is causing the delays.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Jonathan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 BLE Transmission delay</title><link>https://devzone.nordicsemi.com/thread/489891?ContentTypeID=1</link><pubDate>Fri, 21 Jun 2024 09:10:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4c81535-45c8-4d8c-8c91-172c6673f74a</guid><dc:creator>AKV</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for the response.&lt;/p&gt;
[quote userid="91187" url="~/f/nordic-q-a/111883/nrf5340-ble-transmission-delay/488358"]Also, writing something two fast can cause some noise that will interfare with the next, so this can create a situation where there will be 21+ms or more delays.&amp;nbsp;[/quote]
&lt;p&gt;As you mentioned, we have understood the delay issue.&lt;/p&gt;
&lt;div class="flex flex-grow flex-col max-w-full"&gt;
&lt;div dir="auto" data-message-author-role="assistant" data-message-id="e2b05679-f6eb-4f3e-8982-c7809d8ded4b"&gt;
&lt;div&gt;
&lt;div class="markdown prose w-full break-words dark:prose-invert dark"&gt;
&lt;p&gt;We have tried different write methods: write with response, write without response, and notification. However, all three approaches had the same impact, with no speed improvement. Our understanding is that notification is supposed to be faster, but since it also involves a callback, it isn&amp;#39;t actually faster than the write methods.&lt;/p&gt;
[quote userid="73768" url="~/f/nordic-q-a/111883/nrf5340-ble-transmission-delay"]&lt;p&gt;If we use &lt;code&gt;bt_gatt_write_without_response()&lt;/code&gt; without the transmit complete callback function, the system enters a hang state when the stack buffer is full.&lt;/p&gt;
&lt;p&gt;3. How can we monitor the stack buffer queue in real-time to prevent deadlock without using the transmit complete callback? Are there any example codes available?&lt;/p&gt;[/quote]
&lt;p&gt;Could you please answer the question that was previously asked?&lt;/p&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: nRF5340 BLE Transmission delay</title><link>https://devzone.nordicsemi.com/thread/488469?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2024 10:53:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e350f932-7401-4c2d-b04f-7b694e19b8ce</guid><dc:creator>JONATHAN LL</dc:creator><description>&lt;p&gt;Adding some debug option here that you can use to speed up the process, you should be able to see what is going on in more detail.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There could be latencies in the firmware (callbacks, pre processing of data before queueing to transmit in BLE, or post processing of incoming data)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Not sure which side is the dUT (Central or Peripheral) but it is easy to pin point where the latencies are using &lt;a class="fui-Link ___1rxvrpe f2hkw1w f3rmtva f1ewtqcl fyind8e f1k6fduh f1w7gpdv fk6fouc fjoy568 figsok6 f1hu3pq6 f11qmguv f19f4twv f1tyq0we f1g0x7ka fhxju0i f1qch9an f1cnd47f fqv5qza f1vmzxwi f1o700av f13mvf36 f1cmlufx f9n3di6 f1ids18y f1tx3yz7 f1deo86v f1eh06m1 f1iescvh fhgqx19 f1olyrje f1p93eir f1nev41a f1h8hb77 f1lqvz6u f10aw75t fsle3fq f17ae5zn" title="https://docs.zephyrproject.org/latest/services/tracing/index.html#segger-systemview-support" href="https://docs.zephyrproject.org/latest/services/tracing/index.html#segger-systemview-support" rel="noopener noreferrer" target="_blank"&gt;Systemviewer&lt;/a&gt;. With that you can get a timeline view of every context running in Zephyr in the firmware and we can know which context is using up most of that 20ms.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span class="ui-provider bhz bia awe bib bic bid bie bif big bih bii bij bik bil bim bin bio bip biq bir bis bit biu biv biw bix biy biz bja bjb bjc bjd bje bjf bjg" dir="ltr"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Regards,&lt;br /&gt;Jonathan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 BLE Transmission delay</title><link>https://devzone.nordicsemi.com/thread/488358?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2024 14:13:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65561754-3236-482e-8ea4-9a49809c78f5</guid><dc:creator>JONATHAN LL</dc:creator><description>&lt;p&gt;Looks like most things are in line and the connection intervall is 7.5ms as you set it to be, so it looks to be ok, but when ever the 20ms or longer delay happens I dont see any specific issue other then that it looks to be more package loss in some situations.&amp;nbsp;This could be due to noise in the area blocking the communication and causing re-transmissions or It could be the sniffer that is not able pick up the packets, most likely senario.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;One thing that you can test is to do this somewhere else, away from other WIFI and BLE devices.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote userid="73768" url="~/f/nordic-q-a/111883/nrf5340-ble-transmission-delay"]We noticed that the time interval between placing data in the buffer using bt_gatt_write_without_response_cb() and receiving the transmit complete callback frequently &lt;span&gt;exceeds&amp;nbsp;&lt;/span&gt;20 ms, even when the device is in close proximity. [/quote]
&lt;p&gt;Also just to clear things up, are you not expecting a response?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Also, writing something two fast can cause some noise that will interfare with the next, so this can create a situation where there will be 21+ms or more delays.&amp;nbsp; Do having a connection interval of 7.5ms and then writing something 1ms after the previous one will cause the next 2 to be missed in some cases.&amp;nbsp;&lt;br /&gt;The callback will first occur after LL has received the packaged from peer.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;So can try to slow things down and see if less delays happen.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Jonathan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 BLE Transmission delay</title><link>https://devzone.nordicsemi.com/thread/488350?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2024 13:21:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:554fb03d-9d3c-4a84-a407-0911ccd0b102</guid><dc:creator>AKV</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Update:&lt;/p&gt;
&lt;p&gt;I have tried sending packets using the notification method with the bt_gatt_notify_cb() function, which includes a callback. We used this callback to capture the transmission timing, but the data transmission time frequently exceeds 20 ms. Additionally, I observed that the transmission time exceeding 20 ms occurs more often on the peripheral side compared to the central side.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 BLE Transmission delay</title><link>https://devzone.nordicsemi.com/thread/487758?ContentTypeID=1</link><pubDate>Thu, 06 Jun 2024 13:53:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7bf7b34a-ead3-4379-9ff7-78edbfb0e9c9</guid><dc:creator>AKV</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for the response.&lt;/p&gt;
&lt;p&gt;I have attached the sniffer log.&lt;/p&gt;
&lt;p&gt;We are transmitting data in both directions&amp;mdash;master to slave and slave to master&amp;mdash;every 20 milliseconds.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We&amp;nbsp;are using the function k_uptime_get_32() for time capture. The start time is recorded when data is sent using the bt_gatt_write_without_response_cb() function, and the stop time is recorded upon receiving the callback.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nRF5340_5F00_Sniffer.pcapng"&gt;devzone.nordicsemi.com/.../nRF5340_5F00_Sniffer.pcapng&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 BLE Transmission delay</title><link>https://devzone.nordicsemi.com/thread/487749?ContentTypeID=1</link><pubDate>Thu, 06 Jun 2024 13:31:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:792363c8-edeb-4fe0-a188-a513228ac46a</guid><dc:creator>JONATHAN LL</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Can you provide us with a sniffer trace?&lt;br /&gt;&lt;br /&gt;How do you measure the timing. A sniffer trace\log would give us some insight to what is going on here.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Jonathan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>