<?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>Do i need to wary about HW UART buffer when using UART driver library ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/31057/do-i-need-to-wary-about-hw-uart-buffer-when-using-uart-driver-library</link><description>I am using nrf_drv_uart library. 
 UART communication is set in non-blocing mode, and transfer od data is relised with nrf_drv_uart_rx and nrf_drv_uart_tx functions. 
 I am using: uint8_t[100] rx_buffer = {0}; for data reception. But, problem is that</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 15 Mar 2018 08:17:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/31057/do-i-need-to-wary-about-hw-uart-buffer-when-using-uart-driver-library" /><item><title>RE: Do i need to wary about HW UART buffer when using UART driver library ?</title><link>https://devzone.nordicsemi.com/thread/124507?ContentTypeID=1</link><pubDate>Thu, 15 Mar 2018 08:17:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5fbd1212-5049-494b-a841-58ffbe5c11c4</guid><dc:creator>KoFuKu</dc:creator><description>&lt;p&gt;Thank you for quick response. This is exactly what i needed to hear. &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Do i need to wary about HW UART buffer when using UART driver library ?</title><link>https://devzone.nordicsemi.com/thread/124498?ContentTypeID=1</link><pubDate>Thu, 15 Mar 2018 07:53:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d5931ca-97d5-4963-b0ee-8f4f6f665ffe</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Upvoted, 10 points for your calm explanation.&lt;/p&gt;
&lt;p&gt;Sorry, as you said, we were going in wrong direction. And thanks for bringing me back : )&lt;/p&gt;
&lt;p&gt;here is no direct way to flush the RX hardware fifo. But you can try something I mentioned in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/6369/flush-uart/22185#22185"&gt;this &lt;/a&gt;post which helped few.&lt;/p&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;p&gt;You can manually read the RXD register 6 times to force clear the fifo (irrespective of the how many bytes were received).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Do i need to wary about HW UART buffer when using UART driver library ?</title><link>https://devzone.nordicsemi.com/thread/124414?ContentTypeID=1</link><pubDate>Wed, 14 Mar 2018 14:58:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:046c7c7b-cdf6-4576-8835-e9f056840a37</guid><dc:creator>KoFuKu</dc:creator><description>&lt;p&gt;Than you #Aryan for your response, but i think&amp;nbsp;that we are going in the wrong direction here. Maybe my question is not good. I have working firmware with APP_UART module, but i first tried NRF_DRV_UART library (as you can see in my code) and did not have much success with it (the reason is explained in the question).&lt;/p&gt;
&lt;p&gt;I just want to know if it is requested of me to manually clear hardware UART buffer when using UART driver library, and if i do how do i flush it, because i did not find any function for than in library.&lt;/p&gt;
&lt;p&gt;One more time i do not looking for solution(debugging that piece of code) i just want to know a &amp;quot;big picture&amp;quot;, concept if you will, of how driver function works.&lt;/p&gt;
&lt;p&gt;And this buffer thing is what&amp;nbsp;causes confusion.&lt;/p&gt;
&lt;p&gt;As i can see, everybody is staying away of this library, there is no good examples and everybody are using APP_UART module and APP_UART_FIFO.&lt;/p&gt;
&lt;p&gt;So, the answer can be as simple as &amp;quot;No&amp;quot; or &amp;quot;Yes, here you go a function that does that&amp;quot;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Do i need to wary about HW UART buffer when using UART driver library ?</title><link>https://devzone.nordicsemi.com/thread/124409?ContentTypeID=1</link><pubDate>Wed, 14 Mar 2018 14:50:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac8eb29a-7fbb-4f85-8352-7419d43f74ac</guid><dc:creator>KoFuKu</dc:creator><description>&lt;p&gt;But i do not use APP_UART_FIFO.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void uart_co2_bsl_config(void)
{ 
    nrf_drv_uart_config_t config;
    config.pselrxd = UART_RX;
    config.pseltxd = UART_TX;
    config.pselrts = RTS_PIN_NUMBER;
    config.pselcts = CTS_PIN_NUMBER;
    config.baudrate = NRF_UART_BAUDRATE_115200
    config.hwfc = NRF_UART_HWFC_DISABLED;
    config.parity = NRF_UART_PARITY_EXCLUDED;
    config.interrupt_priority = APP_IRQ_PRIORITY_LOWEST;
    config.p_context = NULL;
    
    APP_ERROR_CHECK(nrf_drv_uart_init(&amp;amp;config, uart_handler));
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Do i need to wary about HW UART buffer when using UART driver library ?</title><link>https://devzone.nordicsemi.com/thread/124387?ContentTypeID=1</link><pubDate>Wed, 14 Mar 2018 13:53:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0eee8e7-1f59-4f38-8379-e21b4dd4b6fe</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Then you still have configuration for buffers like below&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define UART_TX_BUF_SIZE 256                         /**&amp;lt; UART TX buffer size. */
#define UART_RX_BUF_SIZE 1                           /**&amp;lt; UART RX buffer size. */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;used in&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    APP_UART_FIFO_INIT(&amp;amp;comm_params,
                         UART_RX_BUF_SIZE,
                         UART_TX_BUF_SIZE,
                         uart_error_handle,
                         APP_IRQ_PRIORITY_LOW,
                         err_code);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You need to increase the RX buffer size if you are receiving data faster than your device can process.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Do i need to wary about HW UART buffer when using UART driver library ?</title><link>https://devzone.nordicsemi.com/thread/123798?ContentTypeID=1</link><pubDate>Sun, 11 Mar 2018 13:25:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2dd6b476-dbc9-46ce-9d86-f414a45c59ea</guid><dc:creator>KoFuKu</dc:creator><description>&lt;p&gt;I am using SDKv11, nRF51422 chip and Keil_v5.21 IDE.&lt;/p&gt;
&lt;p&gt;SDK11 does not support sdk_config.h files, instead it is using nrf_drv_config.h files.&lt;/p&gt;
&lt;p&gt;Part of the nrf_drv_config.h file regarding UART:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* UART */

#define UART0_ENABLED 1

#if (UART0_ENABLED == 1)
#define UART0_CONFIG_HWFC         NRF_UART_HWFC_DISABLED
#define UART0_CONFIG_PARITY       NRF_UART_PARITY_EXCLUDED
#define UART0_CONFIG_BAUDRATE     NRF_UART_BAUDRATE_115200
#define UART0_CONFIG_PSEL_TXD 9
#define UART0_CONFIG_PSEL_RXD 11
#define UART0_CONFIG_PSEL_CTS 10
#define UART0_CONFIG_PSEL_RTS 8
#define UART0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
#ifdef NRF52
#define UART0_CONFIG_USE_EASY_DMA false
//Compile time flag
#define UART_EASY_DMA_SUPPORT     1
#define UART_LEGACY_SUPPORT       1
#endif //NRF52
#endif&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Do i need to wary about HW UART buffer when using UART driver library ?</title><link>https://devzone.nordicsemi.com/thread/123797?ContentTypeID=1</link><pubDate>Sun, 11 Mar 2018 13:12:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c379775d-6ad7-49b1-8764-28cb56d0b594</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Which SDK are you using? you also need to set the buffer sizes for the library in sdk_config.h file&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>