<?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>Simultaneous Beacon and Peripheral Role Connection: Impact on Connection Packet Latency</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/115419/simultaneous-beacon-and-peripheral-role-connection-impact-on-connection-packet-latency</link><description>Hello, I am building a device which simultaneously advertises as a beacon and acts as a peripheral role device. Advertisements are sent at ~20 Hz with the connection to the central configured with an interval of 15 ms. I am observing significant variability</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 21 Oct 2024 14:04:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/115419/simultaneous-beacon-and-peripheral-role-connection-impact-on-connection-packet-latency" /><item><title>RE: Simultaneous Beacon and Peripheral Role Connection: Impact on Connection Packet Latency</title><link>https://devzone.nordicsemi.com/thread/507176?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2024 14:04:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94b26b78-2bbd-41bd-82a6-535e2044f610</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Both connection event as peripheral and advertiser fall in the &amp;quot;third priority&amp;quot; category of &amp;quot;All Bluetooth Low Energy roles in states other than above&amp;quot;. See &lt;a href="https://docs.nordicsemi.com/bundle/sds_s140/page/SDS/s1xx/multilink_scheduling/priorities_and_events_intro.html#priorities_and_events__table_qgg_zc2_cs"&gt;SoftDevice timing-activities and priorities&lt;/a&gt; for details. Since both are at the same priority, and the connection as peripheral is not about to time out, those collisions will typically be handled in a round-robin fashion.&lt;/p&gt;
&lt;p&gt;Please note that both intervals are highly variable:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Timings for the BLE connection as a peripheral are tied to the clock of the central, leading to drifting connection interval if measured with the peripheral clock.&lt;/li&gt;
&lt;li&gt;BLE advertising has a random component, leading to drifting advertising interval (back and forth), from the random distribution of the 0-10 ms random delay.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This means if advertising interval (including expected delay of 5 ms) aligns with connection interval, you should expect periods of repeated collisions, leading to alternating dropped events from advertising and connection, when those events are in phase. Since both intervals drift uncorrelated to each other, you should expect to drift into and out of this state of collisions.&lt;/p&gt;
&lt;p&gt;When the advertiser is off, you only have the connection and there should be no collisions. Occasional packet losses could still occur, due to e.g. packet collisions or other interference from nearby electronic equipment.&lt;/p&gt;
&lt;p&gt;If you want to prioritize the BLE connection, then reducing slave latency and/or supervision timeout (both are connection parameters) could improve the situation, since the BLE connection event as peripheral would then be considered a &amp;quot;peripheral connection that is about to time out&amp;quot; and therefore given higher priority. Please note however that this would lead to more advertiser events being dropped (typically many events in a row if intervals are similar,) and the BLE connection would break more easily from packet collisions etc.&lt;/p&gt;
&lt;p&gt;If you want to spread the collisions more evenly (so that they are not arriving as bursts of many collisions in a row) then I would choose an advertising interval which (when the additional 0-10 ms random delay is taken into account) does not align with the connection interval. This would also ensure more advertisements go through should you reduce slave latency / supervision timeout as suggested above.&lt;/p&gt;
&lt;p&gt;Please note that both advertising events and connection events could last a few milliseconds, so if the interval is low there may be not much space for interleaving. (Note that any interleaving is accidental and temporary, due to the drifting explained above.) With short intervals (around 10 ms and shorter) you should expect collisions almost constantly. For longer intervals (50 ms and above) you should typically expect collisions to occur less often, but depending on connection event length. Please note that those are ballpark figures, and your mileage may vary. You should test this in practice for deciding on what parameters best suit your needs, and you should test with different devices (for different drift between central and peripheral clocks.)&lt;/p&gt;
&lt;p&gt;Longer connection events will typically collide more than shorter ones. In order to reduce the overall number of collisions, you could therefore try reducing the connection event length.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>