<?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>nRF9160 UART: Loosing data when RxData is split into 2 buffers (Async API)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/72651/nrf9160-uart-loosing-data-when-rxdata-is-split-into-2-buffers-async-api</link><description>Hello everyone, 
 
 I am currently using the Nordic-Thingy-91 to test the nRF9160. Now I am trying to receive Data from the UART interface using the &amp;quot;UART Async API&amp;quot;. 
 
 I am switching between three 64 bytes buffers to ensure continuous reception of</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 13 Dec 2023 17:29:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/72651/nrf9160-uart-loosing-data-when-rxdata-is-split-into-2-buffers-async-api" /><item><title>RE: nRF9160 UART: Loosing data when RxData is split into 2 buffers (Async API)</title><link>https://devzone.nordicsemi.com/thread/460206?ContentTypeID=1</link><pubDate>Wed, 13 Dec 2023 17:29:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5253f2db-5d06-4902-a811-f6a59d14638d</guid><dc:creator>nefen</dc:creator><description>&lt;p&gt;I had the same issue with nrf52832.&lt;/p&gt;
&lt;p&gt;I used two buffers for swapping.&lt;/p&gt;
&lt;p&gt;I had 2 buffers of size 4 and I was expecting a message with 6 bytes.&lt;/p&gt;
&lt;p&gt;After the buffer was full I received the first&amp;nbsp;4 bytes (as expected) and the buffer was full.&lt;/p&gt;
&lt;p&gt;I got the&amp;nbsp;UART_RX_BUF_RELEASED and&amp;nbsp;UART_RX_BUF_REQUEST&amp;nbsp;and handling the last event I swapped the buffers.&lt;/p&gt;
&lt;p&gt;Then I got the&amp;nbsp;&lt;span&gt;UART_RX_RDY, but&lt;/span&gt;&amp;nbsp;instead of receiving the 2 remaining bytes, I received only one.&lt;/p&gt;
&lt;p&gt;The 6th byte wasn&amp;#39;t lost. It just didn&amp;#39;t raise the&amp;nbsp;UART_RX_RDY event.&lt;/p&gt;
&lt;p&gt;After I requested the next bunch of 6 bytes, the first byte that arrived was the one missing from the previous message. Nothing was lost, but I couldn&amp;#39;t find any way to overcome this bug, as I had to initiate the next exchange of data to get the last bytes from the previous...&lt;/p&gt;
&lt;p&gt;The problem has been solved after including in prj.conf the following (as&lt;a href="https://devzone.nordicsemi.com/members/hkn"&gt;Håkon Alseth&lt;/a&gt;&amp;nbsp;suggested):&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_UART_0_NRF_HW_ASYNC&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_UART_0_NRF_HW_ASYNC_TIMER&lt;/span&gt;&lt;span&gt;=1&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;#CONFIG_NRFX_TIMER=y (this was not accepted for nrf52832, it was by default activated and I had no access)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;CONFIG_NRFX_TIMER1&lt;/span&gt;&lt;span&gt;=y&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;I post this just to thank &lt;a href="https://devzone.nordicsemi.com/members/wastefan"&gt;WaStefan&lt;/a&gt;&amp;nbsp;and &lt;a href="https://devzone.nordicsemi.com/members/hkn"&gt;Håkon Alseth&lt;/a&gt;&amp;nbsp;!&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;And, for anyone else that runs on the same issue.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 UART: Loosing data when RxData is split into 2 buffers (Async API)</title><link>https://devzone.nordicsemi.com/thread/300383?ContentTypeID=1</link><pubDate>Wed, 17 Mar 2021 12:19:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e7f8737-bd36-4a53-a4b5-b6ab1b725548</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="WaStefan"]&lt;p&gt;&lt;span&gt;Thank you very much, it builds now with &lt;/span&gt;&lt;span&gt;this configuration.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Everything works now, when using Hardware RX byte counting. I don&amp;#39;t loose any bytes.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you again for your help!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I will use this configuration from now on.&lt;/span&gt;&lt;/p&gt;[/quote]
&lt;p&gt;This is great to hear! I&amp;#39;m happy to help and glad to hear that the issue has disappeared!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 UART: Loosing data when RxData is split into 2 buffers (Async API)</title><link>https://devzone.nordicsemi.com/thread/300379?ContentTypeID=1</link><pubDate>Wed, 17 Mar 2021 12:11:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:11563ba0-4e66-41a9-bb3f-ecc2a69203a7</guid><dc:creator>WaStefan</dc:creator><description>&lt;p&gt;Hello H&lt;span&gt;&amp;aring;kon,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you very much, it builds now with &lt;/span&gt;&lt;span&gt;this configuration.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Everything works now, when using Hardware RX byte counting. I don&amp;#39;t loose any bytes.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you again for your help!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I will use this configuration from now on.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 UART: Loosing data when RxData is split into 2 buffers (Async API)</title><link>https://devzone.nordicsemi.com/thread/300368?ContentTypeID=1</link><pubDate>Wed, 17 Mar 2021 11:34:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fcfedfad-5c0c-4526-a5ec-9187f7021fdc</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="WaStefan"]&lt;div&gt;&lt;span style="font-size:inherit;"&gt;&lt;strong&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;CONFIG_UART_0_NRF_HW_ASYNC=y&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;to my prj.conf file, but I can&amp;#39;t build my application anymore.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;In Kconfig.nrfx it says that Hardware RX byte counting requires a timer instance and one PPI channel.&amp;nbsp;&lt;br /&gt;What do I have to do, to properly enable this feature?&lt;/span&gt;&lt;/div&gt;[/quote]
&lt;p&gt;Try setting this in your prj.conf to get it to build properly:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Async
CONFIG_UART_0_ASYNC=y
CONFIG_UART_0_NRF_HW_ASYNC=y
CONFIG_UART_0_NRF_HW_ASYNC_TIMER=1
CONFIG_NRFX_TIMER=y
CONFIG_NRFX_TIMER1=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 UART: Loosing data when RxData is split into 2 buffers (Async API)</title><link>https://devzone.nordicsemi.com/thread/300295?ContentTypeID=1</link><pubDate>Wed, 17 Mar 2021 08:09:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49275a82-e2cb-4fe5-b3c9-b502c7149b76</guid><dc:creator>WaStefan</dc:creator><description>&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;I have seen the option of using hardware rx counting with the UART_0_NRF_HW_ASYNC kconfig option. How do I use this properly?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;I tried to just add&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span style="font-size:inherit;"&gt;&lt;strong&gt;&lt;span style="font-family:arial, helvetica, sans-serif;"&gt;CONFIG_UART_0_NRF_HW_ASYNC=y&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;to my prj.conf file, but I can&amp;#39;t build my application anymore.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;In Kconfig.nrfx it says that Hardware RX byte counting requires a timer instance and one PPI channel.&amp;nbsp;&lt;br /&gt;What do I have to do, to properly enable this feature?&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 UART: Loosing data when RxData is split into 2 buffers (Async API)</title><link>https://devzone.nordicsemi.com/thread/300290?ContentTypeID=1</link><pubDate>Wed, 17 Mar 2021 07:44:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:126c3cbc-41b3-4a92-a699-a9e780de00cd</guid><dc:creator>WaStefan</dc:creator><description>&lt;p&gt;With the changes to&amp;nbsp;the code in &lt;em&gt;uart_nrfx_uarte.c&lt;/em&gt;&amp;nbsp;according to the PR, the UART driver doesn&amp;#39;t really work anymore.&lt;/p&gt;
&lt;p&gt;I only get a RX_RDY event when the first buffer is full and not as I want for every data paket I receive.&lt;/p&gt;
&lt;p&gt;Right after the first RX_RDY event I get a second RX_RDY event for the second buffer, but it says this second buffer is also full, which is not true.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 UART: Loosing data when RxData is split into 2 buffers (Async API)</title><link>https://devzone.nordicsemi.com/thread/300156?ContentTypeID=1</link><pubDate>Tue, 16 Mar 2021 13:38:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17e93d37-53ec-4a7a-8ac2-8ccf4c60f845</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am having issues reproducing your behavior consistently at my end. after extending the rx-timeout window; the issue went away at my end.&lt;/p&gt;
&lt;p&gt;The issue you&amp;#39;re seeing more consistently might be related to this one:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/pull/25975"&gt;https://github.com/zephyrproject-rtos/zephyr/pull/25975&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;which has the corresponding issue report:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/issues/33280"&gt;https://github.com/zephyrproject-rtos/zephyr/issues/33280&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try the proposed fix in the PR, and see if this has an impact on your end?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 UART: Loosing data when RxData is split into 2 buffers (Async API)</title><link>https://devzone.nordicsemi.com/thread/299646?ContentTypeID=1</link><pubDate>Mon, 15 Mar 2021 07:39:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6060cbf2-3c4f-44d0-98dd-cba485ac2cf4</guid><dc:creator>WaStefan</dc:creator><description>&lt;p&gt;Hi Hakon,&lt;/p&gt;
&lt;p&gt;I tried it with 10ms, 50ms and 100ms now, but still the same behaviour...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 UART: Loosing data when RxData is split into 2 buffers (Async API)</title><link>https://devzone.nordicsemi.com/thread/299522?ContentTypeID=1</link><pubDate>Fri, 12 Mar 2021 15:19:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38d5471a-767d-432b-b83b-4b4e840dd280</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try increasing the timeout here?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ret = uart_rx_enable(uart_dev, rx_buf0, 64, 10);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;For instance to 50 ms.&lt;/p&gt;
&lt;p&gt;I suspect that the PC sends with a small delay between each byte, causing the timeout to occur.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 UART: Loosing data when RxData is split into 2 buffers (Async API)</title><link>https://devzone.nordicsemi.com/thread/299393?ContentTypeID=1</link><pubDate>Fri, 12 Mar 2021 08:06:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82afce6d-315a-4e45-b225-154197b8b480</guid><dc:creator>WaStefan</dc:creator><description>&lt;p&gt;Yes I am sure. I know that I have sent &amp;quot;abcdefghi\r&amp;quot; and you can see in the memory window that &amp;quot;abcd&amp;quot; is in buffer0 and &amp;quot;efghi\r&amp;quot; is in buffer1.&lt;br /&gt;Also the buffers are initialized with Zeros and this was the first time receiving in those buffers, so there is no &amp;quot;old data&amp;quot; in the buffers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 UART: Loosing data when RxData is split into 2 buffers (Async API)</title><link>https://devzone.nordicsemi.com/thread/299389?ContentTypeID=1</link><pubDate>Fri, 12 Mar 2021 08:00:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc3d27a0-efd1-4e49-88de-adcaaba07054</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]So all the data is received and correctly stored in the memory, but the second RX_RDY event for the second buffer only gives me 1 byte, even though there are more…[/quote]
&lt;p&gt;Are you sure that this is &amp;quot;new&amp;quot; data, and not the old value&amp;nbsp;of the buffer?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>