<?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>Sporadic Notification Bursts</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/45376/sporadic-notification-bursts</link><description>Hi everybody, 
 we have a remote control based on the nRF52832 and are experiencing a wierd issue with notifications. 
 We are using a custom 6 byte payload keymap characteristic in a custom service, that uses notifications to send keypresses to the host</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 11 Apr 2019 07:40:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/45376/sporadic-notification-bursts" /><item><title>RE: Sporadic Notification Bursts</title><link>https://devzone.nordicsemi.com/thread/181471?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2019 07:40:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59c8dcb6-ae8f-417e-b8aa-e4dd1064849f</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Jann,&lt;/p&gt;
&lt;p&gt;That is good news.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Yes. I believe this bug has been present in some SDK versions, but a bit difficult to remember exactly which. I believe it came, was fixed, and came back again at some point before being fixed again ...&lt;/p&gt;
&lt;p&gt;Let me know if it doesn&amp;#39;t solve the issue.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sporadic Notification Bursts</title><link>https://devzone.nordicsemi.com/thread/181286?ContentTypeID=1</link><pubDate>Wed, 10 Apr 2019 10:52:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:335d1038-0b03-4a56-a7bf-81b76d3096e3</guid><dc:creator>Jann</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;not a problem, I&amp;#39;ve been on vacation the last week and just got back into the office today myself - hence my late reply.&lt;/p&gt;
&lt;p&gt;Yes, there is only the battery measurement timer running permanently, all other timers are stopped in idle mode.&lt;/p&gt;
&lt;p&gt;Thank you for the hint with the app_timer bug. I&amp;#39;ve now added a continuous idle timer at 0x7fff00 ticks and so far the issue has not occurred again in&amp;nbsp;the test setup. If this does the trick here I&amp;#39;ll add the timer to our main project and see if that fixes the issue for good. I&amp;#39;ll let you know how it went!&lt;/p&gt;
&lt;p&gt;Thank you &amp;amp; best wishes,&lt;/p&gt;
&lt;p&gt;Jann&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sporadic Notification Bursts</title><link>https://devzone.nordicsemi.com/thread/179513?ContentTypeID=1</link><pubDate>Mon, 01 Apr 2019 13:00:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eca5164e-f972-4a2a-9e64-f78569b79911</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Jann,&lt;/p&gt;
&lt;p&gt;Sorry for the late reply. I was out of office on Friday.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am having some issues replicating the issue. I did manage to reproduce it a couple of times with the project that you sent me last week, but not with the new&amp;nbsp; one.&lt;/p&gt;
&lt;p&gt;However, I recall that there was a bug in the app_timer at some point in time. I remembered it when you said &amp;quot;the timeout function is called endlessly&amp;quot;. I will look for more details regarding this bug, but can you check one thing for me:&lt;/p&gt;
&lt;p&gt;I see that you have (by default) only one app_timer running while you are not pressing any buttons, which is the battery timer, is that correct?&lt;/p&gt;
&lt;p&gt;The bug was present while there only was one active timer, which had a long timeout (longer than half of the app_timer maximum count value, that is 24 bits = 0xFFFFFF = 16 777 215.&lt;/p&gt;
&lt;p&gt;I believe the app_timer is capable of having timeouts longer thant he maximum count value (it wraps around a couple of times if it needs to), but the bug is related to the fact that there is only one active timer with a timeout of over half of this.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So, to work around this, you have two options. Either, you can increase the prescaler for the app_timer, so that the&amp;nbsp;BATTERY_LEVEL_MEAS_INTERVAL will be less than 0xFFFFFF/2, or you can create a dummy app_timer instance. A timer that times out every minute or so, that doesn&amp;#39;t do anything. It just has an empty timeout handler.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Can you test this for me, and see if that solves the issue?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sporadic Notification Bursts</title><link>https://devzone.nordicsemi.com/thread/179266?ContentTypeID=1</link><pubDate>Fri, 29 Mar 2019 14:18:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f4c858a-397d-4342-b1db-93398d3c3ab4</guid><dc:creator>Jann</dc:creator><description>&lt;p&gt;I&amp;#39;ve now switched the app timer to the scheduler based version and here it gets kind of interesting: Normally this works without problems, but when the issue occurs, the timeout function is called endlessly (with the non-scheduler approach the timeout callback is called a few times and then stops on its own, presumably when the queue is full). Eventually triggering a timer start or stop by pressing a button stops it, but not always.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Suffice to say I am pretty confused by now :)&lt;/p&gt;
&lt;p&gt;&amp;euro;: So it&amp;#39;s not the queue being filled up. Turned scheduler off again, built the demo with the profiler on and printed the app timer queue utilization with every timeout and it never rises over 3. Also built the app timer with the keep rtc active flag, but no dice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sporadic Notification Bursts</title><link>https://devzone.nordicsemi.com/thread/179057?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2019 18:13:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23e2cc56-ef57-4f8c-bd0b-991554407583</guid><dc:creator>Jann</dc:creator><description>&lt;p&gt;Hmm nope, switching to a single shot timer doesn&amp;#39;t help. As soon as I start the 100ms timer it just keeps firing away. Even force-stopping it before restarting (in single shot mode) doesn&amp;#39;t help.. As if the timer op queue was all filled up with calls to the repeat function..&lt;/p&gt;
&lt;p&gt;&amp;euro;: I&amp;#39;ve now added an output of app_timer_cnt_get every time the repeat timer&amp;nbsp;callback is executed and I see that once the issue occurs the time between the calls drop from the requested 100ms to ~2ms. Also it does not seem to be wraparound related, as it started at a count of about 0x00fc0000 and went on well past the overflow upto about 0x00050700. Next wraparound didnt show the issue at all.&lt;/p&gt;
&lt;p&gt;I tried decoupling the TX from the timer interrupt by just setting a flag and evaluating that in the main loop, but with 2ms between calls that of course didnt help.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sporadic Notification Bursts</title><link>https://devzone.nordicsemi.com/thread/179051?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2019 17:43:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e458687-e2b3-4a69-b907-c06bc717943e</guid><dc:creator>Jann</dc:creator><description>&lt;p&gt;Hello Edvin,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve attached the demo project with enabled log for you.&lt;/p&gt;
&lt;p&gt;There is a log_info call on every button press, release and repeat, as well as in the called&amp;nbsp;rcu_update_keys function that takes care of transmission. Interestingly if a burst occurs the log shows a single button down and release event, but a multitude of repeats and transmissions are logged. It seems as if the repeat app timer goes berserk. Judging from the time it takes until the issue occurs it might be coming from the RTC overflow. And since we used&amp;nbsp;app timer routines for guarding off the hvx call that explains why it didn&amp;#39;t work out either.&lt;/p&gt;
&lt;p&gt;Are there any additional precautions to take with repeated app timers? Should we rather use single shot timers and restart them inside the handler? Or is it recommended to use the app timer in scheduler mode?&lt;/p&gt;
&lt;p&gt;Thank you &amp;amp; kind regards,&lt;/p&gt;
&lt;p&gt;Jann&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/demo_2D00_minimal_2D00_log.zip"&gt;devzone.nordicsemi.com/.../demo_2D00_minimal_2D00_log.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sporadic Notification Bursts</title><link>https://devzone.nordicsemi.com/thread/178995?ContentTypeID=1</link><pubDate>Thu, 28 Mar 2019 14:54:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cfee84ec-8c04-4e5c-bbbb-b9b3864564e0</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Jann,&lt;/p&gt;
&lt;p&gt;I see, and thank you for the pcapng file.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do you have a project that has logging enabled&amp;nbsp;that also replicate this issue?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sporadic Notification Bursts</title><link>https://devzone.nordicsemi.com/thread/178743?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2019 15:11:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c34d651f-e813-4bf5-8916-6e39053d5ba1</guid><dc:creator>Jann</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;thank you for your reply!&lt;/p&gt;
&lt;p&gt;Sure, I attached a trace for you. It was made with the PCA10040 demo, connected to an Android Smartphone with nRF Connect (just filtered out empty PDUs). The screenshot is from the actual remote control, the demo is just an approximation to replicate the behavior. The Demo outputs bitmaps at 100ms interval until the button is released, then instantly a single empty bitmap, the remote is a few ms different in regards of timing. The huge amount of notifications directly following each other with &amp;quot;more data&amp;quot; set to true in the screenshot however are the problem I am talking about. More data is only supposed to be able to be true rarely on a release code when button release and the scheduled 100ms retransmission happen to overlap.&lt;/p&gt;
&lt;p&gt;In the pcapng file you can see that after setup the first notifications up to number 137 are ok, there are a few set bitmasks as long as&amp;nbsp;a button is held, then an empty one. Then the board is just left alone for a few minutes until at no 142 a button is pressed again and a notification burst is sent. The empty release code notification is also lost here. Starting a no 200 notifications work properly again.&lt;/p&gt;
&lt;p&gt;Thank you &amp;amp; best regards,&lt;/p&gt;
&lt;p&gt;Jann&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/pca10040remote_2D00_filt.pcapng"&gt;devzone.nordicsemi.com/.../pca10040remote_2D00_filt.pcapng&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sporadic Notification Bursts</title><link>https://devzone.nordicsemi.com/thread/178712?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2019 14:12:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2311d543-1197-4dc2-851f-665a4633faa4</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Jann,&lt;/p&gt;
&lt;p&gt;Is it possible to send the .pcapng sniffertrace?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Is the project suppose to send continuous notifications as long as you hold a button? Because it does that, but not at the rate that it does in your screenshot.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I tried to replicate the issue using SDK14.2.0, S132 v5.1.0 andGNU Tools ARM Embedded 5.4 2016q2, but I have not been able to reproduce what you report. Is there any tricks? Any particular pattern I need to do to reproduce it? What do you connect to? nRF Connect? On Mobile or Desktop?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""]This not an issue of our code calling the sd_ble_gatts_hvx funtion too often[/quote]
&lt;p&gt;We will see :)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>