<?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>UART hardware flow control with interrupts</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/87289/uart-hardware-flow-control-with-interrupts</link><description>Hello, 
 I have an application where I send the data I receive over UART, directly to a phone connected with BLE. However, the BLE connection is often not fast enough to send the large quantities of data I receive on my UART lines. This results in buffers</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 06 May 2022 09:26:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/87289/uart-hardware-flow-control-with-interrupts" /><item><title>RE: UART hardware flow control with interrupts</title><link>https://devzone.nordicsemi.com/thread/366648?ContentTypeID=1</link><pubDate>Fri, 06 May 2022 09:26:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7d85615-3c01-47c7-bea6-dff0440f1c2e</guid><dc:creator>bram12345</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;From what you&amp;#39;ve mentioned and what is written in the documentation you linked I have figured out a way to accomplish what I need. The documentation states: &amp;quot;&lt;span&gt;&lt;em&gt;The RTS signal will also be deactivated when the receiver is stopped through the STOPRX task&amp;quot;.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;The driver has the function &amp;quot;&lt;em&gt;nrfx_uart_rx_disable&amp;quot;&amp;nbsp;&lt;/em&gt;to trigger this STOPRX task. The documentation also states here that: &amp;quot;&lt;em&gt;the UART is able to receive four to five additional bytes if they are sent in succession immediately after the RTS signal has been deactivated.&amp;quot;&amp;nbsp;&lt;/em&gt;This is not a problem when you trigger&amp;nbsp;the STOPRX task&amp;nbsp;when the buffer is not completely full yet.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;To enable it again after the buffer is sufficiently empty, the driver contains the function &amp;quot;nrfx_uart_rx_enable&amp;quot;.&amp;nbsp;Then, to enable the interrupts again, you will have to call &amp;quot;&lt;em&gt;nrfx_uart_rx&amp;quot;&amp;nbsp;&lt;/em&gt;once (or twice when you are using a double buffer). Don&amp;#39;t assert on NRF_SUCCESS, as the result could be NRF_ERROR_BUSY when the buffers both still contain data.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;So in my case with a double buffer:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Disable UART rx, deactivates RTS signal
nrfx_uart_rx_disable(&amp;amp;m_uartInstance);


// Enable UART rx, activates RTS signal
nrfx_uart_rx_enable(&amp;amp;m_uartInstance);

nrfx_uart_rx(&amp;amp;m_uartInstance, pByte1, 1);
nrfx_uart_rx(&amp;amp;m_uartInstance, pByte2, 1);
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks for your help!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART hardware flow control with interrupts</title><link>https://devzone.nordicsemi.com/thread/364961?ContentTypeID=1</link><pubDate>Tue, 26 Apr 2022 12:52:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7208d4cd-22f6-41f7-86cf-1100a6d2777c</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;From the description in the documentation on &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fuarte.html&amp;amp;anchor=concept_a54_2gm_wr"&gt;Transmission in the UARTE/UART peripheral in our PS&lt;/a&gt;. &amp;quot;&lt;span&gt;&lt;em&gt;If HW flow control is enabled the RTS signal will be deactivated when the receiver is stopped via the STOPRX task or when the UARTE is only able to receive four more bytes in its internal RX FIFO&lt;/em&gt;.&amp;quot; The RTS should toggle when you have received too much data for the nRF to be able to handle. I assume what&amp;#39;s happening is that the UART is interrupted before this RTS is toggled, causing this overflow. Unless the interrupts that are causing these issues can be set to a lower priority than the UART peripheral I think you might need to toggle the RTS whenever an interrupt is triggered yourself.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Simon&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>