<?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>Interaction between softdevice and UART on nRF52820</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/82340/interaction-between-softdevice-and-uart-on-nrf52820</link><description>Hi guys, 
 I have noticed that there is a problem with losing bytes at high baud rates on UART. Is there a limit to how high the baud rate can be when using a softdevice? I use the following things: - nRF52820 SoC - Example project: ble_app_uart_c (modified</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 03 Dec 2021 11:18:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/82340/interaction-between-softdevice-and-uart-on-nrf52820" /><item><title>RE: Interaction between softdevice and UART on nRF52820</title><link>https://devzone.nordicsemi.com/thread/341842?ContentTypeID=1</link><pubDate>Fri, 03 Dec 2021 11:18:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87bca4a9-194d-4bc9-92b5-e477de5623a9</guid><dc:creator>Louis_263</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;/p&gt;
&lt;p&gt;thank you very much for your answer.&lt;/p&gt;
[quote userid="2111" url="~/f/nordic-q-a/82340/interaction-between-softdevice-and-uart-on-nrf52820/341814#341814"]1. Enable&amp;nbsp;hardware flow control&amp;nbsp;when init&amp;nbsp;UART, e.g. use&amp;nbsp;APP_UART_FLOW_CONTROL_ENABLED instead of&amp;nbsp;APP_UART_FLOW_CONTROL_DISABLED.[/quote]
&lt;p&gt;I&amp;#39;ve been thinking about that, too. But then we would have to make changes in the hardware design (we have only used UART_TX and UART_RX so far), so I was looking for another alternative. But maybe this will be possible in the future.&lt;/p&gt;
[quote userid="2111" url="~/f/nordic-q-a/82340/interaction-between-softdevice-and-uart-on-nrf52820/341814#341814"]3. Are you sure the problem is that the UART are not able to catch up? Or can it be that the BLE link are not able to handle the data throughtput, e.g. check if&amp;nbsp;ble_nus_c_string_send() may be returning&amp;nbsp;NRF_ERROR_RESOURCES, which means that the BLE link is not able to handle the data throughput.[/quote]
&lt;p&gt;I converted the project ble_app_uart_c to a BLE scanner, which only takes the information from BLE devices nearby and sends it via UART to another microcontroller. I removed most of the functions, only the adv_report parser and the scan functions are still needed. I do not connect to any BLE device.&lt;/p&gt;
&lt;p&gt;If a package gets lost with all the data from nearby BLE devices, it&amp;#39;s not so tragic. However, I sometimes send short commands from the other microcontroller to the nRF SoC and there are sometimes errors in the UART communication, which I have analyzed with NRF_LOG_INFO. The bytes are in any case all on the UART-line (checked with logic analyzer) but the nRF SoC does not pick them all up (despite UART Fifo). That&amp;#39;s why I suspected that my baudrate is too high and due to interruptions by the softdevice not all bytes are recorded.&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;However, I have now thought of another solution. If I want to send a command from the other microcontroller to the nRF chip, I first pull a GPIO pin to ground, which triggers an interrupt in the nRF. In the interrupt routine I disable the softdevice for a short time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Interaction between softdevice and UART on nRF52820</title><link>https://devzone.nordicsemi.com/thread/341814?ContentTypeID=1</link><pubDate>Fri, 03 Dec 2021 09:42:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6f67871-4706-4fea-bc62-8348eaf73817</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The softdevice will during BLE event have some processing that may delay application interrupts, but whether this is enough to lose bytes I am a bit unsure of.&lt;/p&gt;
&lt;p&gt;My suggestions:&lt;/p&gt;
&lt;p&gt;1. Enable&amp;nbsp;hardware flow control&amp;nbsp;when init&amp;nbsp;UART, e.g. use&amp;nbsp;APP_UART_FLOW_CONTROL_ENABLED instead of&amp;nbsp;APP_UART_FLOW_CONTROL_DISABLED.&lt;/p&gt;
&lt;p&gt;2. Configure the UART to have higher interrupt priority, e.g. use&amp;nbsp;APP_IRQ_PRIORITY_HIGHEST instead of&amp;nbsp;APP_IRQ_PRIORITY_LOWEST. Note that this means you can&amp;#39;t call softdevice api directly from the&amp;nbsp;uart_event_handle(), and instead for instance set a flag to ensure you call&amp;nbsp;ble_nus_c_string_send() from main() context instead.&lt;/p&gt;
&lt;p&gt;3. Are you sure the problem is that the UART are not able to catch up? Or can it be that the BLE link are not able to handle the data throughtput, e.g. check if&amp;nbsp;ble_nus_c_string_send() may be returning&amp;nbsp;NRF_ERROR_RESOURCES, which means that the BLE link is not able to handle the data throughput.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>