<?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 first scan event starts with a delay (nRF 52832)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95153/ble-first-scan-event-starts-with-a-delay-nrf-52832</link><description>Hi, 
 I am running the following example from the SDK for Thread v4.1.0: ble_central/ble_app_blinky_c, with a some minor changes (pins definition for a custom board based on nRF52832, and radio notifications enabled) 
 When testing the scanning window</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 23 Jan 2023 14:03:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95153/ble-first-scan-event-starts-with-a-delay-nrf-52832" /><item><title>RE: BLE first scan event starts with a delay (nRF 52832)</title><link>https://devzone.nordicsemi.com/thread/406048?ContentTypeID=1</link><pubDate>Mon, 23 Jan 2023 14:03:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a217db4-806b-4970-8e33-92c24f6ad829</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="hector77"]&lt;p&gt;On question 3), this will mean that the effective advertising (TX)&amp;nbsp; on a specific channel will start some 1.5 ms after the radio notification + distance ? Would you know if it if possible, by timing the advertising more precisely, to overlap them a little bit (say 1ms) across different devices in order to&amp;nbsp;send a maximum of advertisings in a limited scan time (obviously on another device) ?&lt;br /&gt;And that would bring me to the same timing delay on the scan side: what is the time between end of radio notification + distance to the actual start of RX ?&lt;/p&gt;
&lt;p&gt;Thanks a lot for you help.&lt;/p&gt;[/quote]
&lt;p&gt;Sorry for very late reply hector, I was away.&lt;br /&gt;I do not see the exact number for the distance you are seeking but there are some estimates that you can find &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsds_s140%2FSDS%2Fs1xx%2Fradio_notif%2Fradio_notification.html&amp;amp;cp=4_7_4_0_10"&gt;here&lt;/a&gt;. Also these numbers may vary between different softdevice versions.&lt;br /&gt;&lt;br /&gt;If you want to the exact numbers then it should be possible to toggle a gpio pin at the entry of radio notification and also set a GPIOTE connection to convert the radio start trigger task to another pin toggle and check the distance in the logic analyzer or oscilloscope.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE first scan event starts with a delay (nRF 52832)</title><link>https://devzone.nordicsemi.com/thread/404147?ContentTypeID=1</link><pubDate>Tue, 10 Jan 2023 14:46:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29a2041e-b8bf-4ec1-87e1-86abb10d02a8</guid><dc:creator>hector77</dc:creator><description>&lt;p&gt;Dear Susheel,&lt;/p&gt;
&lt;p&gt;Thanks a lot for the investigations on the scan delay.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;For step 1) and 2), I made no progress yet, and I don&amp;#39;t really know where to head next. Any ideas to explore?&lt;/p&gt;
&lt;p&gt;On question 3), this will mean that the effective advertising (TX)&amp;nbsp; on a specific channel will start some 1.5 ms after the radio notification + distance ? Would you know if it if possible, by timing the advertising more precisely, to overlap them a little bit (say 1ms) across different devices in order to&amp;nbsp;send a maximum of advertisings in a limited scan time (obviously on another device) ?&lt;br /&gt;And that would bring me to the same timing delay on the scan side: what is the time between end of radio notification + distance to the actual start of RX ?&lt;/p&gt;
&lt;p&gt;Thanks a lot for you help.&lt;/p&gt;
&lt;p&gt;Best regards,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;H&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE first scan event starts with a delay (nRF 52832)</title><link>https://devzone.nordicsemi.com/thread/403297?ContentTypeID=1</link><pubDate>Thu, 05 Jan 2023 07:44:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea6fe21b-eef2-4ae0-aabb-3bd915ca2b9e</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Hector,&lt;/p&gt;
&lt;p&gt;Step 1)&lt;/p&gt;
&lt;p&gt;I tried to run the blinky central sample as it is (both debug and release version) using SES project. It looks to run ok for me.&lt;br /&gt;&lt;img style="max-height:68px;max-width:530px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/1060x136/__key/communityserver-discussions-components-files/4/6114.pastedimage1672903804377v2.png" /&gt;&lt;/p&gt;
&lt;p&gt;Step 2) no error here as wekk.&lt;/p&gt;
&lt;p&gt;Step 3) I am able to replicate this, not sure why we see this but it seems like asking for a scanner timeslot for a longer interval seems to set the anchor point after one interval. Maybe this is a way for the softdevice to make sure that longer slot commitments just after the softdevice initialize might not be promised from the timeslot management module.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I will have to do some more investigation to see if the Radio Notifications are causing this, but it is a hard debugging path to verify the scanning first anchor point distance without notifications enabled.&lt;/p&gt;
[quote user="hector77"]question 3&amp;nbsp;: browsing through the (very nice and useful) Online Power Profiler for Bluetooth LE, we would have a follow-up question about the time reference used in radio events. For instance, a 5.5m distance refers to which point exactely on the chart displayed in the Profiler, for Radio event (active&amp;nbsp;: 1) would that be «Pre-processing» stage, «Start radio» or «Radio Tx»&amp;nbsp;? Same for active&amp;nbsp;: 0, end of «Radio Rx» or end of «Post-processing» stage&amp;nbsp;?[/quote]
&lt;p&gt;It is a preprocessing stage for the application to do pre steps needed before starting the radio activity.&lt;/p&gt;
&lt;p&gt;Happy New year to you too Hector.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE first scan event starts with a delay (nRF 52832)</title><link>https://devzone.nordicsemi.com/thread/403212?ContentTypeID=1</link><pubDate>Wed, 04 Jan 2023 14:29:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3ba2dc6-39ef-471d-af1d-a91fac554904</guid><dc:creator>hector77</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;No problem for the delay, same here.&lt;/p&gt;
&lt;p&gt;To answer your questions&amp;nbsp;: we do not use Thread and started simple by working with SDK example. Below a detailed explanation of the steps taken so far&amp;nbsp;:&lt;/p&gt;
&lt;p&gt;One device is advertising with about 200 ms interval.&lt;/p&gt;
&lt;p&gt;The other device is scanning, for that we use an example from the SDK as mentioned in the original post. To test further, we went one step backward and run that example code on an nRF DK board (ie, away from our own hardware, just to make sure). With this setup, here is what I do&amp;nbsp;:&lt;/p&gt;
&lt;p&gt;Step 1. Run the example blinky &lt;span style="text-decoration:underline;"&gt;as is&lt;/span&gt; on nRF DK board:&lt;/p&gt;
&lt;p&gt;log&amp;nbsp;:&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; app_timer: RTC: initialized.&lt;/p&gt;
&lt;p&gt;&amp;lt;error&amp;gt; app: Fatal error&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Step 2. Run the example blinky with a delay, just before ble_stack_init()&amp;nbsp;:&lt;/p&gt;
&lt;p&gt;log&amp;nbsp;:&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; app_timer: RTC: initialized.&lt;/p&gt;
&lt;p&gt;&amp;lt;error&amp;gt; app: Fatal error&lt;/p&gt;
&lt;p&gt;&amp;lt;warning&amp;gt; app: System reset&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; app_timer: RTC: initialized.&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; app: Blinky CENTRAL example started.&lt;/p&gt;
&lt;p&gt;(See related question 1 below)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Step 3. Run the example blinky and add the following line just before scan_start()&lt;/p&gt;
&lt;p&gt;radio_notification_init(); (the associated handler will just output &amp;laquo;Radio event&amp;raquo;, as shown below)&lt;/p&gt;
&lt;p&gt;log&amp;nbsp;:&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; app_timer: RTC: initialized.&lt;/p&gt;
&lt;p&gt;&amp;lt;error&amp;gt; app: Fatal error&lt;/p&gt;
&lt;p&gt;&amp;lt;warning&amp;gt; app: System reset&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; app_timer: RTC: initialized.&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; app: Blinky CENTRAL example started.&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; app: Radio event (active: 1) &amp;lt;----Time to reach this point, from the line above (scan start command)&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; app: Radio event (active: 0)&lt;/p&gt;
&lt;p&gt;(See related question 2, 3 below)&lt;/p&gt;
&lt;p&gt;The way we determine the scan start delay is just by changing the following parameter in sdk_config.h&amp;nbsp;: NRF_BLE_SCAN_SCAN_INTERVAL.&lt;/p&gt;
&lt;p&gt;With a short interval, Radio event active occurs almost immediately, but with an interval of, say, 5 seconds (1600&amp;nbsp;*5), the radio event occurs after 5 seconds.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This experiment also raised more questions, maybe they are related&amp;nbsp;:&lt;/p&gt;
&lt;p&gt;question 1&amp;nbsp;: what could be the reason we see this fatal error using the example from the SDK and a DK board&amp;nbsp;?&lt;/p&gt;
&lt;p&gt;question 2&amp;nbsp;: is it possible that the delayed scan start is caused by the radio notification request? With regards to that, may I ask what is the expected behavior if we configure a radio even with a distance of 5.5ms, but start the scan right after&amp;nbsp;? In this case the radio event cannot occur 5.5 ms before scan (there not enough time), is this the reason why this first scan event is missed&amp;nbsp;?&lt;/p&gt;
&lt;p&gt;question 3&amp;nbsp;: browsing through the (very nice and useful) Online Power Profiler for Bluetooth LE, we would have a follow-up question about the time reference used in radio events. For instance, a 5.5m distance refers to which point exactely on the chart displayed in the Profiler, for Radio event (active&amp;nbsp;: 1) would that be &amp;laquo;Pre-processing&amp;raquo; stage, &amp;laquo;Start radio&amp;raquo; or &amp;laquo;Radio Tx&amp;raquo;&amp;nbsp;? Same for active&amp;nbsp;: 0, end of &amp;laquo;Radio Rx&amp;raquo; or end of &amp;laquo;Post-processing&amp;raquo; stage&amp;nbsp;?&lt;/p&gt;
&lt;p&gt;Many thanks for you kind help indeed.&lt;/p&gt;
&lt;p&gt;Best regards, and best wishes for the new starting year !&lt;/p&gt;
&lt;p&gt;H&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE first scan event starts with a delay (nRF 52832)</title><link>https://devzone.nordicsemi.com/thread/402903?ContentTypeID=1</link><pubDate>Tue, 03 Jan 2023 08:35:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee4e549f-b275-4cc8-942e-33b71898bdcc</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Sorry for the delayed response. We were away for year end holidays and thanks a lot for your patience.&lt;/p&gt;
&lt;p&gt;I am assuming that you are not using any Thread related features. If there are no any other radio activity scheduled before your first scan request, then it should not have taken one scan interval delay to start the scanner. That feels strange. How are you measuring this delay? I am assuming that you are toggling some gpios in your timer handlers and radio events?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you give me a minimalistic project to replicate this along with your gpio setup to toggle pins to measure the delay?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>