<?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>NRF52 DK is missing 40% of advertising packets</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/76796/nrf52-dk-is-missing-40-of-advertising-packets</link><description>I am using the NRF52 DK with Keil IDE in Windows. I uploaded the ble_app_uart_c example (Examples &amp;gt; ble_central &amp;gt; ble_app_uart_c) and modified it so that it would print a message whenever it received data from a sensor with a specific MAC address. 
 It</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 06 Jul 2021 11:51:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/76796/nrf52-dk-is-missing-40-of-advertising-packets" /><item><title>RE: NRF52 DK is missing 40% of advertising packets</title><link>https://devzone.nordicsemi.com/thread/318773?ContentTypeID=1</link><pubDate>Tue, 06 Jul 2021 11:51:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f987ae3b-909b-4270-90f7-e81d2d51b733</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello Maria,&lt;/p&gt;
[quote user="panda_noob_2000"]I&amp;#39;ll try to implement the sniffer when I get home.&amp;nbsp;[/quote]
&lt;p&gt;Great! Please do not hesitate to open a ticket if you should encounter any issues or questions about the sniffer and its setup.&lt;/p&gt;
[quote user="panda_noob_2000"]In the code, I check the MAC address and if it is the door sensor, I flash an LED. With the NRF52 DK, the LED flashed 60% of the time the door sensor sent a message. With the Particle device, the LED flashed 100% of the time the door sensor sent a message. I know the door sensor sends a message because there is a signal LED. With the NRF52 DK, I have also tried using print statements instead of an LED flash to indicate a message received, and the results also indicated that 40% of the packets were dropped.[/quote]
&lt;p&gt;Aha, I see. Thank you for elaborating!&lt;br /&gt;This is unfortunately not a entirely accurate way of measuring the percentage of received advertisements, since the device likely is advertising multiple times in the given interval, etc. but this explanation gets your point very well across, and I suspect that this behavior might be caused by the device being busy sorting through all other advertisements being present, or similar. I suggest that we get the sniffer up and running so we may see the exact contents of the lock&amp;#39;s advertisments, and then add a filter so that the application is only ever told of relevant advertisements.&lt;/p&gt;
[quote user="panda_noob_2000"]My impression was that the BLE callback function ( on_ble_evt() ) was the first piece of code run when the NRF picks up a Bluetooth signal, and that a new thread running this function was created whenever a bluetooth signal was encountered. What is the application? Is it the code I am programming? Is there other code run on the NRF that I don&amp;#39;t have access to that runs first?[/quote]
&lt;p&gt;This is not exactly correct, but I understand where the confusion comes from. The BLE callback will be the first part of&amp;nbsp;&lt;em&gt;your application&lt;/em&gt; that runs when a BLE event is passed to the application. However, the SoftDevice lies on top of the application, and takes control of the CPU whenever it needs to meet any of the timing-critical deadlines to uphold the BLE specification. The SoftDevice then uses the CPU and radio peripheral to receive and send messages, before it then generates the appropriate BLE events for the application. Then, after it finishes up its BLE event handling it gives control of the CPU back to the application, so that the application may proceed with whatever logic you have implemented.&lt;br /&gt;The reason why the SoftDevice is implemented in this way is that the BLE Specification is very strict, and must be followed to the letter in order to get certified as a BLE device. Luckily, the SoftDevice takes care of all these things for the developer, so the only thing the developer needs to do instead is to account for the fact that their application may be interrupted at any time by the SoftDevice (for a short time each time).&lt;br /&gt;Does this make sense?&amp;nbsp;&lt;/p&gt;
[quote user="panda_noob_2000"]I am very new to this so am still very unfamiliar with how the device reacts to signals.[/quote]
&lt;p&gt;This is good for me to know so I can be more thorough in my explanations, great! &lt;br /&gt;Please do not hesitate to let me know if any parts of my answer should be unclear :)&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 DK is missing 40% of advertising packets</title><link>https://devzone.nordicsemi.com/thread/318708?ContentTypeID=1</link><pubDate>Tue, 06 Jul 2021 00:27:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67bece02-cb37-45d0-b666-c0151dc812c3</guid><dc:creator>panda_noob_2000</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/76796/nrf52-dk-is-missing-40-of-advertising-packets/318695#318695"]It would be very helpful to see a sniffer trace of the on-air BLE traffic for both scenarios - one in which it successfully picks it up, and one of where the packets are dropped.[/quote]
&lt;p&gt;I&amp;#39;ll try to implement the sniffer when I get home.&amp;nbsp;&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/76796/nrf52-dk-is-missing-40-of-advertising-packets/318695#318695"]I still also would like to hear how you measured that 60% of the packets were dropped.[/quote]
&lt;p&gt;In the code, I check the MAC address and if it is the door sensor, I flash an LED. With the NRF52 DK, the LED flashed 60% of the time the door sensor sent a message. With the Particle device, the LED flashed 100% of the time the door sensor sent a message. I know the door sensor sends a message because there is a signal LED. With the NRF52 DK, I have also tried using print statements instead of an LED flash to indicate a message received, and the results also indicated that 40% of the packets were dropped.&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/76796/nrf52-dk-is-missing-40-of-advertising-packets/318695#318695"]If every advertising packet that is picked up if forwarded to the application[/quote]
&lt;p&gt;My impression was that the BLE callback function ( on_ble_evt() ) was the first piece of code run when the NRF picks up a Bluetooth signal, and that a new thread running this function was created whenever a bluetooth signal was encountered. What is the application? Is it the code I am programming? Is there other code run on the NRF that I don&amp;#39;t have access to that runs first?&lt;/p&gt;
&lt;p&gt;I am very new to this so am still very unfamiliar with how the device reacts to signals.&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;
&lt;p&gt;Maria&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 DK is missing 40% of advertising packets</title><link>https://devzone.nordicsemi.com/thread/318695?ContentTypeID=1</link><pubDate>Mon, 05 Jul 2021 19:25:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82886ab1-25a6-4eb8-8c33-27ce953d0fb5</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again Maria,&lt;/p&gt;
[quote user="panda_noob_2000"]apologies for the late reply,[/quote]
&lt;p&gt;No need to apologize - we continue this whenever you have the chance.&lt;/p&gt;
[quote user="panda_noob_2000"]I tested the door sensor with a different piece of hardware (the Argon device by Particle, programmed using the Particle BLE library) with otherwise the same setup and it worked flawlessly. My understanding is that the Particle device also uses a Nordic BLE chip, leading me to believe that it is the Nordic BLE callback function that is dropping the advertising packets.[/quote]
&lt;p&gt;That certainly narrows it down more, thank you for the update.&lt;br /&gt;Could it be an option to use &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.0.2%2Flib_ble_scan.html&amp;amp;anchor=scan_filters"&gt;the Filter functionality of the BLE Scanning library&lt;/a&gt;&amp;nbsp;to filter the Advertising packets, instead of the current application-layer filter?&lt;br /&gt;Filtering on Device address directly or device name, for instance?&lt;br /&gt;If every advertising packet that is picked up if forwarded to the application I suppose this might cause a congestion in which following advertising packets might be lost.&lt;br /&gt;&lt;br /&gt;Please also see my previous comments with remarks about the sniffer tool and its usefulness in this particular situation.&lt;br /&gt;It would be very helpful to see a sniffer trace of the on-air BLE traffic for both scenarios - one in which it successfully picks it up, and one of where the packets are dropped.&lt;br /&gt;I still also would like to hear how you measured that 60% of the packets were dropped.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 DK is missing 40% of advertising packets</title><link>https://devzone.nordicsemi.com/thread/318692?ContentTypeID=1</link><pubDate>Mon, 05 Jul 2021 18:28:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec11f8ba-6044-419c-a5b8-8e068d2ce0f5</guid><dc:creator>panda_noob_2000</dc:creator><description>&lt;p&gt;Hello again and apologies for the late reply,&lt;/p&gt;
&lt;p&gt;I tested the door sensor with a different piece of hardware (the Argon device by Particle, programmed using the Particle BLE library) with otherwise the same setup and it worked flawlessly. My understanding is that the Particle device also uses a Nordic BLE chip, leading me to believe that it is the Nordic BLE callback function that is dropping the advertising packets.&lt;/p&gt;
&lt;p&gt;I would greatly appreciate your thoughts on this.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Maria&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 DK is missing 40% of advertising packets</title><link>https://devzone.nordicsemi.com/thread/317647?ContentTypeID=1</link><pubDate>Tue, 29 Jun 2021 09:24:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fced61f0-c8a2-4a05-ada2-396fb4311d47</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again Maria,&lt;/p&gt;
[quote user="panda_noob_2000"]Thank you for your thorough reply![/quote]
&lt;p&gt;No problem at all, I am happy to help!&lt;/p&gt;
[quote user="panda_noob_2000"]The two devices are positioned roughly 5cm from each other with no obstructions between them. I am in an apartment building - not sure if that qualifies as a noisy environment. Should I try testing in a field or something?[/quote]
&lt;p&gt;No, then this should be no problem at all. The communication shouldn&amp;#39;t see much disruption over a 5 cm direct line. An apartment building could definitely be considered a noisy environment, but it should not cause you to drop 40 % of advertising packets nevertheless. I think we should look at how the 40% advertising packet loss is measured.&lt;/p&gt;
[quote user="panda_noob_2000"]The sensor I am reading from is a door sensor: it is unable to enter into a connection and advertises data when the door opens/closes. I can verify that it is advertising as there is a status LED.[/quote]
&lt;p&gt;Hmm, is the blinking of the status LED the only indication that it is advertising? Did you design the firmware for this lock yourself - do you know the advertising interval and duration, for instance? Could it be that the LED blinking is not corresponding to advertising directly, but rather that it is blinking at a standard frequency whenever it is in the advertising state?&lt;br /&gt;This is a great opportunity for the sniffer tool, since we then may know exactly what is happening on air when this happens.&lt;/p&gt;
[quote user="panda_noob_2000"]I&amp;#39;ll download the NRF Sniffer tool and see if I can get any more insight from that![/quote]
&lt;p&gt;Great! Please do not hesitate to ask if you should encounter any issues or questions with the sniffer tool. It might seem daunting to familiarize with in the beginning since the learning curve is so steep, but luckily it does not take too long to get up to speed with - and once you are all future BLE debugging will be easier! :)&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 DK is missing 40% of advertising packets</title><link>https://devzone.nordicsemi.com/thread/317548?ContentTypeID=1</link><pubDate>Mon, 28 Jun 2021 16:20:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0b2535b-2ecd-4cfb-a327-0610708d43bc</guid><dc:creator>panda_noob_2000</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you for your thorough reply!&lt;/p&gt;
&lt;p&gt;The two devices are positioned roughly 5cm from each other with no obstructions between them. I am in an apartment building - not sure if that qualifies as a noisy environment. Should I try testing in a field or something? The sensor I am reading from is a door sensor: it is unable to enter into a connection and advertises data when the door opens/closes. I can verify that it is advertising as there is a status LED.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll download the NRF Sniffer tool and see if I can get any more insight from that!&lt;/p&gt;
&lt;p&gt;Thank you again,&lt;/p&gt;
&lt;p&gt;Maria&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 DK is missing 40% of advertising packets</title><link>https://devzone.nordicsemi.com/thread/317414?ContentTypeID=1</link><pubDate>Mon, 28 Jun 2021 09:11:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3fb152c-ac6b-4b34-a0c7-3b5adad993ec</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]It works wonderfully... 60% of the time. The packets it&amp;#39;s dropping seem to be random. I do not know what could be causing this. I tried commenting out everything else in the function, but this did not help anything at all.[/quote]
&lt;p&gt;There could be many reasons why you are not seeing all the advertisements on the other side of your link. For example, one of the three advertisement channels can be completely engulfed in the noise from a WiFi network, or the route of your packets may be blocked by dense obstructions, etc.&lt;br /&gt;How are the two devices positioned in relation to each other? What is the distance between them, and do they have line of sight?&lt;br /&gt;Does this testing happen in a noisy environment?&lt;br /&gt;Advertising packets can often be lost or corrupted along the way. If you need to transfer data without loss you will need to enter into a connection, to be able to ensure that all packets are successfully received on the other side of the link.&lt;br /&gt;How are you measuring how many packets the peripheral is sending?&lt;br /&gt;&lt;br /&gt;Are you familiar with &lt;a href="https://www.nordicsemi.com/Products/Development-tools/nrf-sniffer-for-bluetooth-le"&gt;the nRF Sniffer tool&lt;/a&gt;? It is a powerful tool to wield when developing with BLE, since it allows you to monitor the on-air BLE traffic. This could be helpful to take a look at in this case, to get a better overview of what is happening on the air. Please keep in mind that the Sniffer only reports on the packets that it successfully is able to intercepts, so it may loose the same amount of packets as the central, if placed with a similar position and environment.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>