<?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>Recieving data with libuarte</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68986/recieving-data-with-libuarte</link><description>Hi, 
 I am going to transmit and receive data with libuarte. I read the libuarte example, but I am not quite sure my understanding of the data transfer process is correct. 
 In my opinion, it looks like &amp;quot;nrf_libuarte_async_tx&amp;quot; can do both transmitting</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 08 Dec 2020 08:04:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68986/recieving-data-with-libuarte" /><item><title>RE: Recieving data with libuarte</title><link>https://devzone.nordicsemi.com/thread/283708?ContentTypeID=1</link><pubDate>Tue, 08 Dec 2020 08:04:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec7609f5-45a1-49ff-8348-812a1507682c</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="Leogean"]Thanks for your detailed explanation. So in my handler, because I do not want to send the received data back to the transmitter, the &amp;quot;nrf_uarte_async_tx&amp;quot; function is not necessary. Also, because I process the received data immediately, the queue functions are also not necessary. Am I right? [/quote]
&lt;p&gt;&amp;nbsp;Yes , your understanding is correct.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Leogean"]Ah, the data type of the received data is &amp;quot;uint8_t*&amp;quot;, I have just realized that, sorry.[/quote]
&lt;p&gt;&amp;nbsp;No worries. Good luck with your project.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Recieving data with libuarte</title><link>https://devzone.nordicsemi.com/thread/283690?ContentTypeID=1</link><pubDate>Tue, 08 Dec 2020 04:33:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1db0550a-dc32-4103-a543-2f6ffd4c2a9e</guid><dc:creator>Leogean</dc:creator><description>&lt;p&gt;Ah, the data type of the received data is &amp;quot;uint8_t*&amp;quot;, I have just realized that, sorry.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Recieving data with libuarte</title><link>https://devzone.nordicsemi.com/thread/283455?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2020 04:50:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41650d9b-b48f-4b92-8849-65ef9d3173a9</guid><dc:creator>Leogean</dc:creator><description>&lt;p&gt;Thanks for your detailed explanation. So in my handler, because I do not want to send the received data back to the transmitter, the &amp;quot;nrf_uarte_async_tx&amp;quot; function is not necessary. Also, because I process the received data immediately, the queue functions are also not necessary. Am I right? I have one last question. I guess the data I receive is &amp;quot;p_evt-&amp;gt;data.rxtx.p_data&amp;quot;. Is the data type of it is &amp;quot;char*&amp;quot;, so that I can directly set &amp;quot;rxdata = &lt;span&gt;p_evt-&amp;gt;data.rxtx.p_data&lt;/span&gt;&amp;quot;&amp;nbsp; (which rxdata is &amp;quot;char*&amp;quot;), and process it?&lt;/p&gt;
&lt;p&gt;Thanks again for the help you provide.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Recieving data with libuarte</title><link>https://devzone.nordicsemi.com/thread/283241?ContentTypeID=1</link><pubDate>Fri, 04 Dec 2020 07:42:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4eca50ec-1521-483b-a02f-fe0330aa5cc0</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="Leogean"] In my uarte handler, do you mean if I only want to process the received data, line 12 is actually not necessary? Or the queue push is also not necessary and I only need to start from line 27 to check if there is data in the rx buffer and process it?[/quote]
&lt;p&gt;What I mean to say is that when processing&amp;nbsp;NRF_LIBUARTE_ASYNC_EVT_RX_DATA event, you are pushing the received data to the end of the queue using nrf_queue_push. And at line 27, you are checking if the queue is empty. The queue will never be empty at this instance, since you just pushed the received data to the queue. And you pop the queue immediately.&lt;/p&gt;
&lt;p&gt;I do not think you need to push and pop the data to the queue at this instance. The reference code that you took from SDK\examples\peripheral\libuarte shows you a a loop back data through uarte. So the processing of uart_event_handle in that example is not something you would like to use as it is.&lt;/p&gt;
&lt;p&gt;In your case, you do not need to use nrf_queue_xxx at all, since you are processing the incoming data immediately.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Recieving data with libuarte</title><link>https://devzone.nordicsemi.com/thread/283169?ContentTypeID=1</link><pubDate>Thu, 03 Dec 2020 16:09:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05a5e46a-a6c7-4de8-ad3f-97bb46fd73c4</guid><dc:creator>Leogean</dc:creator><description>&lt;p&gt;Thanks for your reply, the information is very helpful. In my uarte handler, do you mean if I only want to process the received data, line 12 is actually not necessary? Or the queue push is also not necessary and I only need to start from line 27 to check if there is data in the rx buffer and process it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Recieving data with libuarte</title><link>https://devzone.nordicsemi.com/thread/282990?ContentTypeID=1</link><pubDate>Thu, 03 Dec 2020 08:41:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:767c4d3f-52f1-4e44-880b-2ef310183b99</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Leogean,&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;nrf_libuarte_async_enable is the API that enables and starts the receiver and most likely you should start this along with the tx by calling&amp;nbsp;&lt;/span&gt;&lt;span&gt;nrf_libuarte_async_tx, which will work only with the transmitter.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;span&gt;In your&amp;nbsp;&lt;/span&gt;&lt;/span&gt;uart_event_handler. When you get an event that there is a new RX_DATA available, you are starting the next transaction of the TX and also checking to see if there is any data in the buffer queue (which most likely there will as you are processing EVT_RX_DATA).&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;It looks like your state machine does not depend on the EVT_TX_DONE. This could work as long as you are sure that the peer will transmit data so that your application will process it and kick the next TX transaction.&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>