<?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 Scanning Implementation Inquiry</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/107212/ble-scanning-implementation-inquiry</link><description>Hi, 
 My team is developing a BLE receiver that listens for advertisements from a large number of beacons. 
 We are concerned that some advertisements may be getting dropped when the receiver is already busy filtering/parsing another advertisement. My</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 18 Jan 2024 15:17:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/107212/ble-scanning-implementation-inquiry" /><item><title>RE: BLE Scanning Implementation Inquiry</title><link>https://devzone.nordicsemi.com/thread/464866?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2024 15:17:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22d13b51-cf23-4d39-845a-8e047110bfcf</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The code you refer to is from the SDK scan module, and that always use the same scan buffer. So it will be overwritten by the SoftDevice. That should not be a problem in practice tough as the way it is implemented in the scan module the event handler (callback) is called before restarting scanning.&lt;/p&gt;
&lt;p&gt;If you want to restart scanning immediately before any filtering you can do that, but then you have to skip the SDK scan module and use the SoftDevice API&amp;#39;s directly. In that case, you can cycle through several scan buffers that you handle, and provide the buffer when you call&amp;nbsp;sd_ble_gap_scan_start().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Scanning Implementation Inquiry</title><link>https://devzone.nordicsemi.com/thread/464475?ContentTypeID=1</link><pubDate>Tue, 16 Jan 2024 19:07:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db4b1f73-8b61-4f0a-9470-70788cfb0778</guid><dc:creator>Parker Lloyd</dc:creator><description>&lt;p&gt;In other words, what happens to the scan buffer when a new advertising report starts getting received but is not yet fully received?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Scanning Implementation Inquiry</title><link>https://devzone.nordicsemi.com/thread/464473?ContentTypeID=1</link><pubDate>Tue, 16 Jan 2024 19:00:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e191e62-d0dd-4464-9d04-2a88e5e3b6f2</guid><dc:creator>Parker Lloyd</dc:creator><description>&lt;p&gt;&lt;span style="font-size:inherit;"&gt;Hi Einar,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;Thanks for your response.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;For the older nRF5 SDK, there is only one buffer for storing advertising reports.&amp;nbsp;The length of this buffer is defined in the the sdk_config.h (NRF_BLE_SCAN_BUFFER) and is referenced in nrf_ble_scan.c (line 1094) :&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span style="font-size:inherit;"&gt; // Assign a buffer where the advertising reports are to be stored by the SoftDevice.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size:inherit;"&gt; p_scan_ctx-&amp;gt;scan_buffer.p_data = p_scan_ctx-&amp;gt;scan_buffer_data;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size:inherit;"&gt; p_scan_ctx-&amp;gt;scan_buffer.len = NRF_BLE_SCAN_BUFFER;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size:inherit;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size:inherit;"&gt;Do the contents of this buffer get copied out during processing by the scanning module? I am mainly interested in whether this scan buffer can asynchronously receive a new advertisement if scanning is enabled while the previous advertising report is still being processed.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size:inherit;"&gt;In simpler terms,&amp;nbsp;does the nRF5 SDK scanning module store 2 advertising reports at once if scanning is enabled while an earlier report is still being processed?&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size:inherit;"&gt;Your help is greatly appreciated.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size:inherit;"&gt;Parker&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Scanning Implementation Inquiry</title><link>https://devzone.nordicsemi.com/thread/463914?ContentTypeID=1</link><pubDate>Fri, 12 Jan 2024 08:15:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9285328c-1371-4c6c-8cf4-204e5bd92e4a</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Parker,&lt;/p&gt;
&lt;p&gt;Yes, that parameter is for the nRF Connect SDK only. For the nRF5 SDK with SoftDevice it is different and there is no similar functionality. There scanning is stopped by the SoftDevice when an advertising packet is received, and it is up to the application (either directly or via the SDK scan module) to resume scanning.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Scanning Implementation Inquiry</title><link>https://devzone.nordicsemi.com/thread/463857?ContentTypeID=1</link><pubDate>Thu, 11 Jan 2024 18:20:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:684d68da-9d28-42a9-ada3-caf388d18ba3</guid><dc:creator>Parker Lloyd</dc:creator><description>&lt;p&gt;Our firmware project was developed using the nRF5 SDK (v17.1.0).&lt;br /&gt;&lt;br /&gt;The sdk_config.h does not appear to include a parameter analogous to BT_CTLR_SDC_SCAN_BUFFER_COUNT. After looking deeper into components/ble/nrf_ble_scan/ the implementation appears to only use one buffer.&lt;br /&gt;&lt;br /&gt;Is this functionality only supported by the newer nRF Connect SDK?&lt;/p&gt;
&lt;p&gt;Parker&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Scanning Implementation Inquiry</title><link>https://devzone.nordicsemi.com/thread/463850?ContentTypeID=1</link><pubDate>Thu, 11 Jan 2024 17:28:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf6881a4-7ece-4ab4-826c-b9c3dd00c0c1</guid><dc:creator>Parker Lloyd</dc:creator><description>&lt;p&gt;Perfect thanks. That&amp;#39;s exactly what I needed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Scanning Implementation Inquiry</title><link>https://devzone.nordicsemi.com/thread/463724?ContentTypeID=1</link><pubDate>Thu, 11 Jan 2024 11:30:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c56b867-b76a-4b8c-9eb2-50f2b270b3e7</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Parker,&lt;/p&gt;
&lt;p&gt;The SoftDevice controller (which is the link layer) can buffer multiple packets. The nuber of buffers is configurable with &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.5.1/kconfig/index.html#CONFIG_BT_CTLR_SDC_SCAN_BUFFER_COUNT"&gt;BT_CTLR_SDC_SCAN_BUFFER_COUNT&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Scanning Implementation Inquiry</title><link>https://devzone.nordicsemi.com/thread/463421?ContentTypeID=1</link><pubDate>Tue, 09 Jan 2024 17:41:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af8428e1-7bd1-46cd-a693-ee601e7a3be9</guid><dc:creator>Parker Lloyd</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;Thanks for your response.&lt;/p&gt;
&lt;p&gt;Just to clarify, are you saying that the scanning backend can only&amp;nbsp;store the contents of one advertisement at a time? Or is it able to buffer new advertisements (to be processed later) if it is currently processing another ad?&lt;/p&gt;
&lt;p&gt;That is mainly what I am interested in figuring out: whether the backend can store (any) new incoming ads while it is busy processing another ad.&lt;/p&gt;
&lt;p&gt;Parker&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Scanning Implementation Inquiry</title><link>https://devzone.nordicsemi.com/thread/463352?ContentTypeID=1</link><pubDate>Tue, 09 Jan 2024 13:01:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebfda61b-f26d-4353-98e7-9f42b18c3a79</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Parker,&lt;/p&gt;
&lt;p&gt;You will not receive all advertising packets in a busy environment. That is because of several reasons, where these are the most important:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;If advertising packets is received faster than the application can process them, the stack will need to drop som advertising packets.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Packet colissions leading to packet loss.&lt;/li&gt;
&lt;li&gt;Re-starting scanning on a new advertising channel at the beginning of a new scan window&lt;/li&gt;
&lt;li&gt;Not scanning at all (if the scan duty cycle is not 100%).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This means that you will &lt;em&gt;always&lt;/em&gt;&amp;nbsp;loose some (and often a high number) of advertising packets, and your system must be designed to handle that.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>