<?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>BLE data loss with nus</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/116711/ble-data-loss-with-nus</link><description>Hi, 
 (nrf52840, custom device, nRF5_SDK_15.3.0_59ac345) 
 I am working on a BLE project involving one central device and two peripheral devices using BLE NUS. The peripheral devices send data with a maximum size of 230 bytes each time a sensor interrupt</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 27 Nov 2024 20:43:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/116711/ble-data-loss-with-nus" /><item><title>RE: BLE data loss with nus</title><link>https://devzone.nordicsemi.com/thread/512449?ContentTypeID=1</link><pubDate>Wed, 27 Nov 2024 20:43:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:397cb8b5-863e-41c5-9e09-4f9ad9e401ff</guid><dc:creator>eleven-x_devteam</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Thanks for the reply! It was a great clue to help me start debugging.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve checked the BLE data transmission (TX) and reception (RX) on both the peripherals and the central device, and they are working perfectly.&lt;/p&gt;
&lt;p&gt;I discovered a race condition in our custom code during BLE data processing, which occurs when the central receives multiple data packets from the peripherals. I&amp;rsquo;ve fixed the issue.&lt;/p&gt;
&lt;p&gt;Thank you again!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data loss with nus</title><link>https://devzone.nordicsemi.com/thread/512185?ContentTypeID=1</link><pubDate>Tue, 26 Nov 2024 15:02:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2047dea5-c9c7-4ab5-855e-15cf65f3c924</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;nbsp;think the data loss must occur somewhere between receiving the sensor measurement value and the BLE send function (assuming the send function always returns with NRF_SUCCESS). Data that is successfully added to the SoftDevice output queue will be sent to the receiver. If the packet fails to be sent after x retransmissions,&amp;nbsp;&amp;nbsp;the&amp;nbsp;Softdevice will terminate the link as required by the specification.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
[quote user=""]I&amp;#39;ve observed occasional data loss at the central device, even though the peripherals seem to send data without errors.[/quote]
&lt;p&gt;A notification or indication packet added to the output queue&amp;nbsp;with&amp;nbsp; sd_ble_gatts_hvx() will be added to the output queue&amp;nbsp;if the&amp;nbsp;return value is&amp;nbsp;NRF_SUCCESS. Does your application verify the return code of this function to detect when a packet failed to be added to the queue?&amp;nbsp;&amp;nbsp;&lt;/p&gt;
[quote user=""]Is it possible for data loss to happen when two data packets arrive simultaneously at the central device?[/quote]
&lt;p&gt;This should not happen, and I do not recall seeing any reports of this being a problem.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>