<?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 RX timing with external device</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/119014/uart-rx-timing-with-external-device</link><description>Hello, 
 I wanted to reach out about the issue I&amp;#39;ve been running into regarding the UART Async API. I am having trouble narrowing down what the cause could be. 
 I am using an nRF9161 DK and the v2.9 SDK. The communication below is using UART2. 
 Right</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 20 Feb 2025 23:42:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/119014/uart-rx-timing-with-external-device" /><item><title>RE: UART RX timing with external device</title><link>https://devzone.nordicsemi.com/thread/523973?ContentTypeID=1</link><pubDate>Thu, 20 Feb 2025 23:42:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd97bc6e-ff8f-4479-a2e6-44516c291d81</guid><dc:creator>jmerri95</dc:creator><description>&lt;p&gt;Thank you Kenneth,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am traveling for the next week, once i am back i will give this a try.&lt;/p&gt;
&lt;p&gt;Thank you again for your help,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Jack&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART RX timing with external device</title><link>https://devzone.nordicsemi.com/thread/523958?ContentTypeID=1</link><pubDate>Thu, 20 Feb 2025 18:12:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc19333f-a6db-4471-9fed-14494b1eb3db</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi Jack,&lt;/p&gt;
&lt;p&gt;I think it would help if you could toggle a pin on&amp;nbsp;UART_RX_STOPPED, and at the same time perform a logic analyzer trace, so we can see the last 3-4bytes that triggered the issue when the pin toggles. I suspect that would help a lot to understand the issue.&lt;/p&gt;
&lt;p&gt;Can I assume you have used the samples/peripheral/lpuart example as guide here, and you for instance are 100% sure you are double buffering by providing a buffer every time on&amp;nbsp;UART_RX_BUF_REQUEST event?&lt;/p&gt;
&lt;p&gt;Also it would be interesting to understand what buffer size and numbers of buffers you have provided, ref the lpuart example:&lt;/p&gt;
&lt;p&gt;#define BUF_SIZE 64&lt;br /&gt;static K_MEM_SLAB_DEFINE(uart_slab, BUF_SIZE, 3, 4);&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know the baudrate here or the amount of data, but if you have very high baudrate (e.g. 115200 or more) I would consider increasing &lt;span&gt;BUF_SIZE&amp;nbsp;&amp;nbsp;&lt;/span&gt;by 2x every time the baudrate doubles.&lt;/p&gt;
&lt;p&gt;I would expect the default value of 10000us for the timeout to be a good value.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART RX timing with external device</title><link>https://devzone.nordicsemi.com/thread/523754?ContentTypeID=1</link><pubDate>Wed, 19 Feb 2025 16:03:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0c092d4-6465-4570-a714-7e425378dc99</guid><dc:creator>jmerri95</dc:creator><description>&lt;p&gt;Hi Kenneth,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you for the details. I dug into the UART_RX_STOPPED condition and it looks like there are two errors. One being a &lt;span&gt;UART_BREAK,&amp;nbsp;&lt;/span&gt;and the second being a&amp;nbsp;&lt;span&gt;UART_ERROR_FRAMING&lt;/span&gt;.&amp;nbsp;They are both present in a single RX event.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I turned on the HFCLK, but it looks like the issue is still present. I am guessing the serial break condition and the framing condition are closely tied.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There is an idle line delay (minimum 2 bytes) from the manufacture of the external keypad. Do you have any suggestions on dealing with the serial break condition?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Jack&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART RX timing with external device</title><link>https://devzone.nordicsemi.com/thread/523548?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2025 14:45:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:edc671a2-2715-4c85-8799-9e1f35784f80</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Try to find out what caused the&amp;nbsp;&lt;span&gt;UART_RX_STOPPED conditions by checking the&amp;nbsp;uart_rx_stop_reason.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I suspect that it&amp;#39;s a mismatch in the baudrate and that is causing e.g. framing error. If that is the case, then I suspect the main cause may be that you have not started the external high frequency clock.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But you can try to increase the buffers to see if that helps, and make sure you are double buffering by calling uart_rx_buf_rsp() while current buffer is being filled up, see existing examples on how to do this. From the link I shared it says for instance:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt; * If uart_rx_buf_rsp is not called before current buffer&lt;br /&gt; * is filled up, receiving will stop.&lt;br /&gt; */&lt;br /&gt; UART_RX_BUF_REQUEST,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kenneth&lt;/span&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: UART RX timing with external device</title><link>https://devzone.nordicsemi.com/thread/523527?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2025 13:56:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c47a0e5-3a99-431b-aa66-b042676f3223</guid><dc:creator>jmerri95</dc:creator><description>&lt;p&gt;Hi Kenneth,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you for getting back to me. There are three scenarios that happen:&lt;/p&gt;
&lt;p&gt;First, TX data is sent and RX data comes back in full (roughly 45 bytes).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Second, TX data is sent and no data comes back&amp;nbsp;&lt;span&gt;UART_RX_RDY&amp;nbsp;is not triggered.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Third, TX data is sent and partial data comes back&amp;nbsp;UART_RX_RDY&amp;nbsp;is triggered.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In all of these scenarios the&amp;nbsp;UART_RX_STOPPED&amp;nbsp;condition happens. Based on the RX timeout there are more or less of the&amp;nbsp;UART_RX_STOPPED&amp;nbsp;condition.&amp;nbsp; The optimal RX timeout (for this application) seems to be 1500 - 2500 ms.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I have a meeting with the manufacturer of the external device later this week. They might be able to give some clues as well. I am also going to test the interrupt API to see what findings i get there.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Jack&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART RX timing with external device</title><link>https://devzone.nordicsemi.com/thread/523269?ContentTypeID=1</link><pubDate>Mon, 17 Feb 2025 13:10:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d8fe43a-f377-4e86-802f-522c7495ae21</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Can you just go over once the description of receiving from the uart.h driver if some may apply in your case?&lt;br /&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.7.99-ncs2/include/zephyr/drivers/uart.h#L163"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v3.7.99-ncs2/include/zephyr/drivers/uart.h#L163&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For instance I want to check if it&amp;#39;s possible you have a UART_RX_STOPPED condition due to:&lt;br /&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.7.99-ncs2/include/zephyr/drivers/uart.h#L44"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v3.7.99-ncs2/include/zephyr/drivers/uart.h#L44&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In such case you should for instance start to receive again, or handle it in some other way depending on what you want.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>