<?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>nrfx_uarte_rx Bytes disappearing</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/59475/nrfx_uarte_rx-bytes-disappearing</link><description>Softdevice 6.1.1 
 SDK 15.3 
 We have been using the nrfx_uart driver but realized we need to have multiple instances on our new hardware so have changed to using nrfx_uarte driver and now we are losing bytes when Receiving. 
 Our UART messaging protocol</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 30 Mar 2020 08:40:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/59475/nrfx_uarte_rx-bytes-disappearing" /><item><title>RE: nrfx_uarte_rx Bytes disappearing</title><link>https://devzone.nordicsemi.com/thread/242315?ContentTypeID=1</link><pubDate>Mon, 30 Mar 2020 08:40:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be5f889f-a136-459f-a036-7a4cf531571f</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi David,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please make sure you configured the GPIO pins with correct configuration (input : RXD, CTS; output, no pull: TXD, RTS). This is done automatically in the nrf_uarte driver.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How did you define the RTS and CTS on the peers&amp;nbsp; ? Note that they have to be inverted on the peers. So the RTS on one side have to connect to CTS on the other side and vice versa.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_uarte_rx Bytes disappearing</title><link>https://devzone.nordicsemi.com/thread/242274?ContentTypeID=1</link><pubDate>Mon, 30 Mar 2020 03:43:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c68216a-3436-40be-b48d-385752e2154c</guid><dc:creator>David</dc:creator><description>&lt;p&gt;I have decided to use HWFC, and that seems to work.. However i can only get it working on a Devkit talking over USB to my PC..&lt;/p&gt;
&lt;p&gt;When i try and use it with a PCB i have that has 2 NRF52840 chips connected together it does not work.. Is there any sort of &amp;quot;initialization&amp;quot; needed for HWFC to work? Do i need to do anything special with the RTS and CTS pins, other than hook them up?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;David Hutchinson&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_uarte_rx Bytes disappearing</title><link>https://devzone.nordicsemi.com/thread/241771?ContentTypeID=1</link><pubDate>Thu, 26 Mar 2020 10:16:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8fb8d2de-d5aa-4330-9673-782f742242ec</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi David,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You are using the EasyDMA with just 1 byte. And without the HWFC the UART buffer&amp;nbsp;is capable of receiving 4 more bytes before it&amp;#39;s overflowed.&amp;nbsp;What I suspect is that the CPU was too slow and didn&amp;#39;t setup the buffer for the payload fast enough. Do you have any activity that can cause a long latency ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Which baudrate are you using ? Could you try to reduce the baudrate to check if the size of the message can be longer before it overrun ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;nrfx_uarte_rx() supports double buffer. What you can do is to call&amp;nbsp;nrfx_uarte_rx() twice to setup 2 buffer areas in RAM. If you can move the Length byte to the first byte and the TYPE byte to the second, then you can prepare the second buffer for the payload when you receive the length. (check the description of the nrfx_uarte_rx)&lt;/p&gt;
&lt;p&gt;But the better solution is to use libuart, You can setup a very large buffer and can have a timeout. This way you wouldn&amp;#39;t have any problem if the CPU being hang for a long period.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_uarte_rx Bytes disappearing</title><link>https://devzone.nordicsemi.com/thread/241702?ContentTypeID=1</link><pubDate>Thu, 26 Mar 2020 02:22:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6877cedc-8c04-4769-a364-71f6deb4b49b</guid><dc:creator>David</dc:creator><description>&lt;p&gt;Not using HWFC&lt;/p&gt;
&lt;p&gt;I Realized i am getting an Overrun error.&lt;/p&gt;
&lt;p&gt;this is very easy to replicate:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;

static void uart_event_handler(nrfx_uarte_event_t const * p_event, void * p_context){
    switch (p_event-&amp;gt;type) {
	case NRFX_UARTE_EVT_RX_DONE: {
			err = nrfx_uarte_rx(inst, buffer, 1);
		}break;
	default:
		return;
	}
}


void init(){
    nrfx_uarte_config_t uart_config = NRFX_UARTE_DEFAULT_CONFIG;

	uart_config.p_context = instance;
	uart_config.pselcts =   pins.cts;
	uart_config.pselrts =   pins.rts; 
	uart_config.pselrxd =   pins.rxd; 
	uart_config.pseltxd =   pins.txd; 

	err = nrfx_uarte_init(inst, &amp;amp;uart_config, uart_event_handler);
	
	//start by just trying to received 1 byte (the type)
	err = nrfx_uarte_rx(inst, buffer, 1);
	
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;then send more than 8 bytes over a Terminal from PC and this will cause an overrun error.. it only happens when sending 8 bytes or more.. i find that sending 7 or &amp;lt; its fine...&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;David Hutchinson&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_uarte_rx Bytes disappearing</title><link>https://devzone.nordicsemi.com/thread/241645?ContentTypeID=1</link><pubDate>Wed, 25 Mar 2020 16:09:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f4284f9-0a5f-4388-83ae-820cbc11ccc8</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi David,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you show your full code ? Could you describe the exact issue you are observing ? Did you use HWFC ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Both nrfx_uart and nrfx_uarte support multiple instances. The main difference here is that the nrfx_uart uses the legacy UART when the nrfx_uarte uses the UART with EasyDMA. UART with EasyDMA can access the memory without the CPU involved.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Please note that in SDK v16 we provided an advanced UARTE library (which provide flexible RX mode with timeout). Have a look &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/lib_libuarte.html?cp=7_1_3_27"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>