<?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>Issue with UART RX data transmission at high baud rates</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/99588/issue-with-uart-rx-data-transmission-at-high-baud-rates</link><description>I am facing an issue with UART communication at high baud rates. The transmission of data from the transmitting device (TX) to the receiving device (RX) works fine, but when the baud rate is increased beyond a certain threshold, I observe that the RX</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 24 May 2023 16:05:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/99588/issue-with-uart-rx-data-transmission-at-high-baud-rates" /><item><title>RE: Issue with UART RX data transmission at high baud rates</title><link>https://devzone.nordicsemi.com/thread/427305?ContentTypeID=1</link><pubDate>Wed, 24 May 2023 16:05:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db1213e8-2022-4fde-88fa-dc7d24d4317c</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Where are you freeing the RX buffer? If you do not free the RX buffers fast enough, libUARTE will eventually not have any new buffers to assign to the UARTE peripheral, preventing it from receiving more data. If you have a very high baudrate and do lots of processing on the incoming data before the buffer can be freed, you should consider increasing the number of or size of buffers for libUARTE (see&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/group__nrf__libuarte__async.html#ga9dd1619dcfe11f532ed96e37ebd2aca4"&gt;NRF_LIBUARTE_ASYNC_DEFINE&lt;/a&gt;&lt;span&gt;()).&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with UART RX data transmission at high baud rates</title><link>https://devzone.nordicsemi.com/thread/427301?ContentTypeID=1</link><pubDate>Wed, 24 May 2023 15:57:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c457bbe6-9929-46a1-aec6-87aa017aa402</guid><dc:creator>mayanktiwari</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;ret_code_t uartInit(nrf_uarte_baudrate_t baud_rate)
{
ret_code_t err_code = NRF_SUCCESS;

if (uartAlreadyInit == 0) {
nrf_libuarte_async_config_t config;
config.tx_pin = BG_TX_PIN;
config.rx_pin = BG_RX_PIN;
config.baudrate = baud_rate;
config.parity = NRF_UARTE_PARITY_EXCLUDED;
config.hwfc = NRF_UARTE_HWFC_DISABLED;
config.timeout_us = 100000;
config.int_prio = APP_IRQ_PRIORITY_LOW;

err_code = nrf_libuarte_async_init(&amp;amp;libuarte, &amp;amp;config, uart_event_handler, (void *)&amp;amp;libuarte);
nrf_libuarte_async_enable(&amp;amp;libuarte);
uartAlreadyInit = 1;
}

return err_code;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with UART RX data transmission at high baud rates</title><link>https://devzone.nordicsemi.com/thread/427298?ContentTypeID=1</link><pubDate>Wed, 24 May 2023 15:54:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d832c78-f661-460f-acd5-452fd8e45e3c</guid><dc:creator>mayanktiwari</dc:creator><description>&lt;p&gt;Issue facing in Reading data from BG95 at all baud rates &lt;br /&gt;&lt;br /&gt;1. At 115200 baud rate, Tx is fine but at Rx 15+ packets found corrupted out of 140 packets &lt;br /&gt;2. At 460800 baud rate, Tx is fine but at Rx 56+ packets corrupted out of 140 Packets &lt;br /&gt;3. At 921600 baud rate, Tx is fine but at Rx corruption of data is higher, command response&amp;rsquo;s are getting corrupted&lt;br /&gt;&lt;br /&gt;&lt;span&gt;libUARTE Integartion:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void uart_event_handler(void * context, nrf_libuarte_async_evt_t * p_evt)
{
    nrf_libuarte_async_t * p_libuarte = (nrf_libuarte_async_t *)context;
    ret_code_t ret;

    switch (p_evt-&amp;gt;type)
    {
        case NRF_LIBUARTE_ASYNC_EVT_RX_DATA:
            uart_rx_done = true;
            if (p_evt-&amp;gt;data.rxtx.length &amp;lt;= sizeof(data_array)) {
                memset(data_array, 0x00, sizeof(data_array));
                memcpy(data_array, p_evt-&amp;gt;data.rxtx.p_data, p_evt-&amp;gt;data.rxtx.length);
                data_len = p_evt-&amp;gt;data.rxtx.length;
            }
            //print(LL_INFO, &amp;quot;len:%d - data: %s\n&amp;quot;, p_evt-&amp;gt;data.rxtx.length, data_array);
            break;
        case NRF_LIBUARTE_ASYNC_EVT_TX_DONE:
            //NRF_LOG_RAW_INFO(&amp;quot;Tx!\n&amp;quot;);
                /*nrf_libuarte_async_rx_free(p_libuarte, p_evt-&amp;gt;data.rxtx.p_data, p_evt-&amp;gt;data.rxtx.length);
                if (!nrf_queue_is_empty(&amp;amp;m_buf_queue))
                {
                    buffer_t buf;
                    ret = nrf_queue_pop(&amp;amp;m_buf_queue, &amp;amp;buf);
                    APP_ERROR_CHECK(ret);
                    UNUSED_RETURN_VALUE(nrf_libuarte_async_tx(p_libuarte, buf.p_data, buf.length));
                }*/
            break;
         default:
            print(LL_INFO, &amp;quot;\nUE:%d\n\n&amp;quot;, (int)p_evt-&amp;gt;type);
            break;
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with UART RX data transmission at high baud rates</title><link>https://devzone.nordicsemi.com/thread/427017?ContentTypeID=1</link><pubDate>Tue, 23 May 2023 15:55:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd2160f5-88ef-4674-8f0b-cfe10681d4a7</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Please post more details about how you configured libUARTE, and what exact issues you are currently experiencing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with UART RX data transmission at high baud rates</title><link>https://devzone.nordicsemi.com/thread/427016?ContentTypeID=1</link><pubDate>Tue, 23 May 2023 15:49:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c083957-a352-4053-b0a9-db00a11d314a</guid><dc:creator>mayanktiwari</dc:creator><description>&lt;p&gt;Hi after Implementing this lib still facing the same Issue&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with UART RX data transmission at high baud rates</title><link>https://devzone.nordicsemi.com/thread/425133?ContentTypeID=1</link><pubDate>Thu, 11 May 2023 13:51:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd4e7f23-2fd5-46e6-bb48-5ab49ebf836c</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;See the&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/libuarte_example.html"&gt;Libuarte Example&lt;/a&gt;. I also created an example showing how it can be used in a BLE example in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/71665/nrf-52832-uart-high-speed-communication/294686#294686"&gt;this post&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with UART RX data transmission at high baud rates</title><link>https://devzone.nordicsemi.com/thread/425127?ContentTypeID=1</link><pubDate>Thu, 11 May 2023 13:43:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42df3782-5adb-4fe0-9545-158f6f69ee88</guid><dc:creator>mayanktiwari</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt; Thank you for your response. I appreciate your suggestion to use libUARTE library. I will definitely look into it and see if it can help me resolve my issue. &lt;br /&gt;&lt;br /&gt;Could you also please provide me with some guidance on how to integrate this library into my project? Any code examples or tutorials would be greatly appreciated. &lt;br /&gt;&lt;br /&gt;Thank you again for your help and support.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with UART RX data transmission at high baud rates</title><link>https://devzone.nordicsemi.com/thread/424918?ContentTypeID=1</link><pubDate>Wed, 10 May 2023 14:19:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0da65369-a953-40ce-a7f8-10a3f6d0e014</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It is more interesting to see how you start the UART RX than how you initialized the driver. If you call&amp;nbsp;&lt;span&gt;nrf_drv_uart_rx() with a low value in the length parameter, you will struggle to handle the interrupts&amp;nbsp;fast enough to provide a new buffer to store the received data, when HW flow control is disabled. The UARTE HW has a RX FIFO, but this can only hold 4 bytes.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If your connected device cannot support HW flow control pins, I would recommend you to consider using the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_libuarte.html"&gt;libUARTE library&lt;/a&gt; in your application. This handles multiple RX buffers for you at a configurable length, along with RX timeouts for notifying application of received data before the&amp;nbsp;whole&amp;nbsp;buffer have been filled.&amp;nbsp;The nRF52840 can support up to 65535 byte receptions directly to RAM when using the UARTE peripheral with EasyDMA.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Jørgen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with UART RX data transmission at high baud rates</title><link>https://devzone.nordicsemi.com/thread/424850?ContentTypeID=1</link><pubDate>Wed, 10 May 2023 12:33:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd59a2d8-8e98-44ed-a99d-a4f0acfa6998</guid><dc:creator>JoEi</dc:creator><description>&lt;p&gt;Hi mayanktiwari,&lt;/p&gt;
&lt;p&gt;as far as I know the BG95 doesn&amp;#39;t support baud rates higher than 921600.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Anyway did you check the signal with an oscilloscope or a logic analyzer?&lt;br /&gt;Also the nRFs&amp;nbsp;baud rates aren&amp;#39;t that accurate. Check&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Fuart.html&amp;amp;cp=5_0_0_5_32_9_22&amp;amp;anchor=register.BAUDRATE"&gt;nRF52840 Baud Rate&lt;/a&gt;&amp;nbsp;to see the actual baud rates.&lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;Johannes&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>