<?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>direct access of Rx Data in asynchron UART</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111826/direct-access-of-rx-data-in-asynchron-uart</link><description>Hi 
 I&amp;#39;m using asynchron UART. 
 For example, I defined idle time to 20us. 
 It works without any problem. 
 #define RECEIVE_TIMEOUT 20 
 static uint8_t rx_buf[512]; 
 
 ret = uart_rx_enable ( uart , rx_buf , sizeof ( rx_buf ), RECEIVE_TIMEOUT ); 
 
</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 17 Jun 2024 09:16:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111826/direct-access-of-rx-data-in-asynchron-uart" /><item><title>RE: direct access of Rx Data in asynchron UART</title><link>https://devzone.nordicsemi.com/thread/489038?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2024 09:16:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb23823a-1d82-47bf-9edc-48a61bb1f906</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;Did you read the UARTE behavior when stopping the RX?&amp;nbsp;&lt;/p&gt;
[quote userid="2115" url="~/f/nordic-q-a/111826/direct-access-of-rx-data-in-asynchron-uart/487501"]&lt;p&gt;The reason why it takes longer when you&amp;#39;re actively receiving data is due to how the hardware peripheral works:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf52840/page/uarte.html#ariaid-title4"&gt;https://docs.nordicsemi.com/bundle/ps_nrf52840/page/uarte.html#ariaid-title4&lt;/a&gt;&lt;/p&gt;[/quote]
&lt;p&gt;&lt;/p&gt;
[quote userid="116449" url="~/f/nordic-q-a/111826/direct-access-of-rx-data-in-asynchron-uart/489029"]&lt;p&gt;- I have to read DMA from UART Rx every 1ms.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Problem is if I use asynch, the Call Back Event occurs after the idle time expires.&lt;/p&gt;[/quote]
&lt;p&gt;You can potentially be blocked by higher priority threads, thus this might be skewed in time.&lt;/p&gt;
[quote userid="116449" url="~/f/nordic-q-a/111826/direct-access-of-rx-data-in-asynchron-uart/489029"]Problem is if I use asynch, the Call Back Event occurs after the idle time expires.[/quote]
&lt;p&gt;This is also expected, as a reception is timed out after 1 ms, and if there&amp;#39;s more bytes; the above linked UARTE behavior will also skew your timing.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If I&amp;#39;ve understood you correctly; It sounds like you need to do polling per-byte, not&amp;nbsp;use the async UART library functionality, as you want to fetch each byte as quick as possible for processing.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;H&amp;aring;kon&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: direct access of Rx Data in asynchron UART</title><link>https://devzone.nordicsemi.com/thread/489029?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2024 08:50:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d04d860f-1ccc-47e9-b9a1-983747d405c2</guid><dc:creator>Hyun-Young</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I think, you don&amp;#39;t understand what I want to do.&lt;/p&gt;
&lt;p&gt;What I want to just do:&lt;/p&gt;
&lt;p&gt;- I have to read DMA from UART Rx every 1ms.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Problem is if I use asynch, the Call Back Event occurs after the idle time expires.&lt;/p&gt;
&lt;p&gt;It can be less than 1ms or more than 1ms.&lt;/p&gt;
&lt;p&gt;Is there any function just like &amp;quot;dma_get_data(UART)&amp;quot;?&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: direct access of Rx Data in asynchron UART</title><link>https://devzone.nordicsemi.com/thread/487891?ContentTypeID=1</link><pubDate>Fri, 07 Jun 2024 11:55:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b4f4722-dc22-422b-b7a6-8ff9516b2825</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Could you explain in detail what you&amp;#39;re trying to achieve?&lt;/p&gt;
&lt;p&gt;The behavior, in terms of event process, of the uart async API is described in the docs here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.zephyrproject.org/latest/hardware/peripherals/uart.html#asynchronous-api"&gt;https://docs.zephyrproject.org/latest/hardware/peripherals/uart.html#asynchronous-api&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do I understand correctly when you always want to return every &amp;#39;n&amp;#39; ms? If yes, is there a specific reason why?&lt;/p&gt;
&lt;p&gt;Normally, one would run the serial communication in a dedicated thread, which then yields for the remainder of the system, and combined with a signalling/k_poll functionality; you can share the communicated data on-demand between threads/functions.&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: direct access of Rx Data in asynchron UART</title><link>https://devzone.nordicsemi.com/thread/487830?ContentTypeID=1</link><pubDate>Fri, 07 Jun 2024 06:46:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a3eb541-2f05-4394-82a6-d49f7b11c9b8</guid><dc:creator>Hyun-Young</dc:creator><description>&lt;p&gt;Do you mean, I can call &amp;quot;uart_rx_enable(..)&amp;quot; every 1 ms? Doesn&amp;#39;t it disturb the running receive buffer? I thought, I may call uart_r_enable() either at beginning or after uart_rx_disable().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: direct access of Rx Data in asynchron UART</title><link>https://devzone.nordicsemi.com/thread/487501?ContentTypeID=1</link><pubDate>Wed, 05 Jun 2024 11:54:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af17b277-253b-4659-9723-9e06b82c70c1</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]If the message is too long, it takes some time to get event &amp;quot;UART_RX_RDY&amp;quot;.[/quote]
&lt;p&gt;The reason why it takes longer when you&amp;#39;re actively receiving data is due to how the hardware peripheral works:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf52840/page/uarte.html#ariaid-title4"&gt;https://docs.nordicsemi.com/bundle/ps_nrf52840/page/uarte.html#ariaid-title4&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]&lt;div&gt;&lt;span&gt;In that thread, I want to check Rx-Data for example every 1ms.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;How can I get the data and length every 1ms ?&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Zephyr offers just one trigger &amp;quot;idle time&amp;quot;.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Is there any other trigger for example (every &amp;nbsp;X ms)?&lt;/span&gt;&lt;/div&gt;[/quote]
&lt;p&gt;You can run the uart_rx_enable in a dedicated thread, with a timeout of 1 ms for instance. Or am I misunderstanding your scenario here?&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>