<?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>No UART irq for several ms after regular BLE radio activity</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/36223/no-uart-irq-for-several-ms-after-regular-ble-radio-activity</link><description>-Using SoftDevice S110 8.0.0 for the nRF51822_xxAA. 
 -UART0 running on 19k2 without flow control (only rx/tx) and using irq priority APP_IRQ_PRIORITY_LOW (=3) 
 -Using the Radio Timeslot functionality while also fulfilling the peripheral role 
 When</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 05 Sep 2018 08:05:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/36223/no-uart-irq-for-several-ms-after-regular-ble-radio-activity" /><item><title>RE: No UART irq for several ms after regular BLE radio activity</title><link>https://devzone.nordicsemi.com/thread/147298?ContentTypeID=1</link><pubDate>Wed, 05 Sep 2018 08:05:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84227352-065a-422e-a5d2-1471b327860e</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;No worries.&lt;/p&gt;
&lt;p&gt;Yes, it affects the S132 Softdevices too.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No UART irq for several ms after regular BLE radio activity</title><link>https://devzone.nordicsemi.com/thread/147285?ContentTypeID=1</link><pubDate>Wed, 05 Sep 2018 07:37:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:531b5549-b3fd-4c3c-9586-060778127c07</guid><dc:creator>mkuiken</dc:creator><description>&lt;p&gt;Hi Martin,&lt;/p&gt;
&lt;p&gt;Sorry for not getting back to you sooner. Holiday and some personal stuff kept me out of the office for some time.&lt;/p&gt;
&lt;p&gt;I will see if I can easily change the code to use the normal requests. I&amp;#39;ll get back to you on that.&lt;/p&gt;
&lt;p&gt;Also, is it clear if this issue is also affecting the S132 softdevice (used with the nRF52832)?&lt;/p&gt;
&lt;p&gt;/Martijn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No UART irq for several ms after regular BLE radio activity</title><link>https://devzone.nordicsemi.com/thread/141511?ContentTypeID=1</link><pubDate>Thu, 26 Jul 2018 12:10:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5aaeb535-7a5c-490e-930c-a58aad4e2da6</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;That is interesting. This is what the Softdevice team suggests:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;For the S110 with only a slave link running, I would guess that a safe value could be timeslot_event_length * 2 + 7.5 ms (&amp;lt;- slave max event length).&amp;nbsp;Maybe give it some extra headroom. I think increasing the interrupt priority of the UART0 interrupt would be a better solution.&amp;nbsp;The problem could be avoided entirely by using normal requests instead.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No UART irq for several ms after regular BLE radio activity</title><link>https://devzone.nordicsemi.com/thread/140407?ContentTypeID=1</link><pubDate>Tue, 17 Jul 2018 14:01:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d4fb19e3-8966-44c8-95fb-c879571e68da</guid><dc:creator>mkuiken</dc:creator><description>&lt;p&gt;Hi Martin,&lt;/p&gt;
&lt;p&gt;This is definitely making a difference! The timeout value was set to 50ms and I have now increased it by a factor 6 (300ms) and the UART errors are a lot less. They&amp;#39;re still there but definitely an improvement.&lt;/p&gt;
&lt;p&gt;From these first tests I would say that this is same issue as for the S140 then. Can you elaborate a bit on this recently discovered bug? Is there a minimal timeout value to use which can prevent this bug from happening? Or are there other workarounds? Is this bug also existing for the S132/nRF52832?&lt;/p&gt;
&lt;p&gt;/Martijn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No UART irq for several ms after regular BLE radio activity</title><link>https://devzone.nordicsemi.com/thread/140372?ContentTypeID=1</link><pubDate>Tue, 17 Jul 2018 11:03:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0ac9fa2-38a2-496c-8118-3085fa8e18ed</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I was made aware of a recently discovered bug in the timeslot API today. The bug was discovered using S140 and nRF52840 though, but the symptoms and circumstances look similar. Are you using the timeslot API to perform &amp;quot;earliest possible&amp;quot; requests? Can you try to increase the timeout on the timeslot request and see if that has an effect?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;PS: I&amp;#39;ll be on holiday until next Tuesday. As it is holiday season in Norway it is not certain that any of my colleagues will have time to pick up the case in the meantime.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No UART irq for several ms after regular BLE radio activity</title><link>https://devzone.nordicsemi.com/thread/140077?ContentTypeID=1</link><pubDate>Fri, 13 Jul 2018 13:58:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b22f2b8d-0aa2-4de4-b35e-20c152f61fe5</guid><dc:creator>mkuiken</dc:creator><description>[quote userid="3500" url="~/f/nordic-q-a/36223/no-uart-irq-for-several-ms-after-regular-ble-radio-activity/140047"]Ok, so BLE and&amp;nbsp;timeslot doesn&amp;#39;t work, but either one by itself works?[/quote]
&lt;p&gt;Well not exactly. BLE and timeslot perfectly work together radio wise. It&amp;#39;s just that when both are active/functional I get UART errors as soon as the BLE connection becomes active.&lt;span class="mceItem mceNonEditable mceQuote" id="mceQuote2"&gt;...&lt;/span&gt;&lt;/p&gt;
[quote userid="3500" url="~/f/nordic-q-a/36223/no-uart-irq-for-several-ms-after-regular-ble-radio-activity/140047"]Are you handling this?[/quote]
&lt;p&gt;Yup. Right after the softdevice is enabled I configure the Radio Notification. Also, this notifcation I only implemented to debug the UART error. It&amp;#39;s not used for the timeslot functionality or anything. And I will remove it as soon as the UART problem is fixed.&lt;/p&gt;
[quote userid="3500" url="~/f/nordic-q-a/36223/no-uart-irq-for-several-ms-after-regular-ble-radio-activity/140047"]So there are more handlers to check?[/quote]
&lt;p&gt;Not really. It was just a way to say I&amp;#39;m out of options what else to check :-)&lt;/p&gt;
[quote userid="3500" url="~/f/nordic-q-a/36223/no-uart-irq-for-several-ms-after-regular-ble-radio-activity/140047"]Could this be a pointer towards an event handler taking care of received data?[/quote]
&lt;p&gt;Well I checked the events I get from the softdevice via&amp;nbsp;&lt;span&gt;SD_EVT_IRQn/SWI2_IRQn and the&amp;nbsp;sd_evt_get() function. The time it takes to handle those events/received data from the softdevice is not the reason for blocking the UART IRQ. I made a screenshot:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " height="321" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/0564.screenshot_5F00_uart_5F00_error_5F00_evt_5F00_timing.PNG" width="549" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;You can see that when the UART interrupts are missed, the system is not in the SWI2_IRQn ISR to handle the ble events.&lt;/p&gt;
[quote userid="3500" url="~/f/nordic-q-a/36223/no-uart-irq-for-several-ms-after-regular-ble-radio-activity/140047"]Have you tried to reduce the baud rate?[/quote]
&lt;p&gt;No I haven&amp;#39;t. I&amp;#39;m not sure this would be a feasible solution since it would mean I also have to lower the baudrate of the device on the remote side of the UART. To overcome the UART problem by lowering the UART baudrate would mean I have to buffer those 13 ms in the 6 bytes FIFO receiver buffer. That would be a really low baudrate of ~460 bytes/sec :-(&lt;/p&gt;
[quote userid="3500" url="~/f/nordic-q-a/36223/no-uart-irq-for-several-ms-after-regular-ble-radio-activity/140047"] but at least you can get the current level by doing something similar[/quote]
&lt;p&gt;I will check to see if that can help me ...&lt;/p&gt;
[quote userid="3500" url="~/f/nordic-q-a/36223/no-uart-irq-for-several-ms-after-regular-ble-radio-activity/140047"]you will not get a 100 %&amp;nbsp;reliable UART transfer without flow control when using BLE at the same time[/quote]
&lt;p&gt;I understand what you&amp;#39;re saying and I agree there are limits to what to expect from a UART without flowcontrol. That being said, I don&amp;#39;t think the baudrate&amp;nbsp;I&amp;#39;m using, is pushing the system to the limit as can also be seen in the screenshot above. The system doesn&amp;#39;t seemed to be more &amp;quot;stressed&amp;quot; the moment interrupts are missed&lt;/p&gt;
[quote userid="3500" url="~/f/nordic-q-a/36223/no-uart-irq-for-several-ms-after-regular-ble-radio-activity/140047"]Any chance it would be possible to upgrade to nRF52?[/quote]
&lt;p&gt;Actually I have this system running on nRF52 as well, with the same uart implementation etc. No problem there. Because of the already established user base (nRF51 products), I&amp;#39;m making it run on nRF51 as well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No UART irq for several ms after regular BLE radio activity</title><link>https://devzone.nordicsemi.com/thread/140047?ContentTypeID=1</link><pubDate>Fri, 13 Jul 2018 10:24:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c9ca059-fd3f-4f26-b8d6-396cddba6b5f</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Ok, so BLE and&amp;nbsp;timeslot doesn&amp;#39;t work, but either one by itself works?&lt;/p&gt;
&lt;p&gt;I read through the radio notification chapter&amp;nbsp;i the Softdevice Specification again, and since I&amp;#39;m under the impression that you turn on and off the timeslot API dynamically at run-time I took notice of this quote:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-fe1e0c1da42e455892295f9c8b519489/pastedimage1531474508778v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Are you handling this?&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;So far all event handlers I&amp;#39;ve checked&lt;br /&gt;&lt;/strong&gt;&lt;/em&gt;So there are more handlers to check?&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;The moment the UART interrupts are blocked, always seems to coincides with the radio deactivating (and each time it was after&amp;nbsp;regular BLE traffic, not timeslot traffic)&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;Could this be a pointer towards an event handler taking care of received data?&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Is it possible to retrieve the &amp;quot;previous&amp;quot; priority level somehow?&amp;nbsp;&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;Not sure about the privious level, but at least you can get the current level by doing something similar to what is being discussed here:&amp;nbsp;&lt;a href="https://community.arm.com/processors/f/discussions/5387/get-current-active-interrupt-priority"&gt;https://community.arm.com/processors/f/discussions/5387/get-current-active-interrupt-priority&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Or are there possibly some other hooks in the soft device&amp;nbsp;&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;Unfortunately the Softdevice is Nordic&amp;#39;s proprietary black box, and there aren&amp;#39;t many ways to peek inside it. But you can assume that all Softdevice generated events forwarded to your application is running in priority 2 as illustrated &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s130.sds/dita/softdevices/s130/processor_avail_interrupt_latency/exception_mgmt_sd.html?cp=3_7_2_0_15_1"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Have you tried to reduce the baud rate?&lt;/p&gt;
&lt;p&gt;What SDK are you using&amp;nbsp;and are you using our UART drivers?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The bottom line is that,&amp;nbsp;because of the asynchronous nature of UART and BLE, you will not get a 100 %&amp;nbsp;reliable UART transfer without flow control when using BLE at the same time. And using the timeslot API and proprietary radio protocol on top of that again certainly won&amp;#39;t make it better.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Any chance it would be possible to upgrade to nRF52? It has a much more advanced UART capable of writing data directly to RAM while the CPU is busy or sleeping.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No UART irq for several ms after regular BLE radio activity</title><link>https://devzone.nordicsemi.com/thread/139826?ContentTypeID=1</link><pubDate>Thu, 12 Jul 2018 07:22:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44d50997-9dca-47fe-888b-ff22e2b8b5b6</guid><dc:creator>mkuiken</dc:creator><description>&lt;p&gt;Hi Martin, thanks for your reply.&lt;/p&gt;
&lt;p&gt;In my implementation the use of the timeslot functionality can be activated and deactivated when the device is up and running. When it is deactivated (or when the device boots with timeslot functionality deactivated), the UART errors do not occur. But as soon as the timeslot functionality is activated the UART errors occur when a BLE connection is set up. However I&amp;#39;ve not seen the UART error when actually being &lt;em&gt;&lt;strong&gt;in&lt;/strong&gt; &lt;/em&gt;a timeslot.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve been trying to find if any of the event handlers is consuming excessive time but unfortunately this hasn&amp;#39;t resulted in a suspect. So far all event handlers I&amp;#39;ve checked use their normal timing and shouldn&amp;#39;t be the reason the UART is not serviced anymore. The moment the UART interrupts are blocked, always seems to coincides with the radio deactivating (and each time it was after&amp;nbsp;regular BLE traffic, not timeslot traffic).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The common factor I guess is the radio; issue only occurs when timeslot functionality is active (though not actually being in a timeslot), issue occurs after radio activity. Hence my remark about &amp;quot;what could be the relation to the Radio Timeslot...&amp;quot;.&lt;/p&gt;
&lt;p&gt;Is it possible to retrieve the &amp;quot;previous&amp;quot; priority level somehow? If so I was thinking about running a TIMER on priority 1 and then logging the priority level the system was in prior to the TIMER IRQ. Then I would at least see what priority level was active when the UART is not serviced (being either an event handler running on priority 3 or the soft device running in priority level 2).&lt;/p&gt;
&lt;p&gt;Or are there possibly some other hooks in the soft device I can use to get information on the priority level the system is in?&lt;/p&gt;
&lt;p&gt;/Martijn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: No UART irq for several ms after regular BLE radio activity</title><link>https://devzone.nordicsemi.com/thread/139583?ContentTypeID=1</link><pubDate>Tue, 10 Jul 2018 13:33:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2bcf35cd-0467-4cf4-bc55-c8bfbc3061a3</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
[quote user=""]-Is it normal for the softdevice to block the UART interrupt (with low prio) for several milliseconds? This seems very long to me?[/quote]
&lt;p&gt;Yes, it is normal for the Softdevice to block other interrupts, but maybe not for&amp;nbsp;13 milliseconds. It depends on your application. As you can see &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s130.sds/dita/softdevices/s130/processor_avail_interrupt_latency/exception_mgmt_sd.html?cp=3_7_2_0_15_1"&gt;here&lt;/a&gt;, the Softdevice uses interrupt priority 0 (highest) for timing critical &amp;quot;under-the-hood&amp;quot; stuff. It uses priority 2 for less critical stuff though, like forwarding events to your application when you receive data for example.&amp;nbsp;So if you have implemented time consuming code inside such event handlers, it might be that you are blocking other things running at lower interrupt priorities. When you change UART priority to 1, it means that it gets higher priority than all the Softdevice events which is probably why it works better. Maybe you can try to toggle some GPIOs inside suspicious Softdevice event handler functions&amp;nbsp;and see if you can find the sinner.&amp;nbsp;&lt;/p&gt;
[quote user=""]Futhermore, even though the timeslot is not active at the moment the overrun error occurs, the problem is non-existent when the Radio Timeslot functionality is not used (not initialized/started).[/quote]
&lt;p&gt;Can you elaborate on this? Have you been using the timeslot API, but uninitialized it? Or do you mean if you remove everything related to the timeslot API and proprietary radio from your application entirely?&lt;/p&gt;
[quote user=""]-What could be the relation to the Radio Timeslot (maybe some left over, not re-initialized radio setting?)?[/quote]
&lt;p&gt;Not sure if it is relevant here, but the radio timeslot API also works in high priority interrupts that will block your UART as you can see here:&amp;nbsp;&lt;a title="Radio Timeslot API processor usage patterns" href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s130.sds/dita/softdevices/s130/processor_avail_interrupt_latency/tsl_usage_patterns.html?cp=3_7_2_0_15_2_1"&gt;Radio Timeslot API processor usage patterns&lt;/a&gt;&lt;/p&gt;
[quote user=""]Using UART flow control is not an option in this scenario.[/quote]
&lt;p&gt;That is unfortunate. Using BLE and UART on the nRF51 with 19k2 baud rate and no flow control is risky.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;PS: It is holiday season in Norway these days&amp;nbsp;and the response time might be slower than usual.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Martin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>