<?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>UARTE: Why does the ENDRX value not change from zero once the MAXCNT number of bytes have been received?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/48165/uarte-why-does-the-endrx-value-not-change-from-zero-once-the-maxcnt-number-of-bytes-have-been-received</link><description>Folks, 
 Been struggling for a couple of days with a comms issue that I assumed were at the other end of my system, but am starting to think it&amp;#39;s at the nRF52 UART end and I do not understand how this thing works. I suspect I don&amp;#39;t understand this bizarre</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 09 Apr 2020 20:11:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/48165/uarte-why-does-the-endrx-value-not-change-from-zero-once-the-maxcnt-number-of-bytes-have-been-received" /><item><title>RE: UARTE: Why does the ENDRX value not change from zero once the MAXCNT number of bytes have been received?</title><link>https://devzone.nordicsemi.com/thread/244190?ContentTypeID=1</link><pubDate>Thu, 09 Apr 2020 20:11:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7edcd475-7e6a-4997-a592-2454fe7d0f55</guid><dc:creator>Andres</dc:creator><description>&lt;p&gt;DiBosco,&lt;/p&gt;
&lt;p&gt;I have run into the same issue that you describe. Your post has been very helpful to confirm what I have noticed.&lt;/p&gt;
&lt;p&gt;I totally agree with you that the design of the UARTE, with &amp;quot;Easy-DMA&amp;quot; is defective.&lt;/p&gt;
&lt;p&gt;What bothers me is not that there is a problem with the UARTE, but that Nordic does not document this behavior in the errata sheet or in the data sheet or some other logical place. It is up to us (the programmers) to waste enormous time and effort only to discover that things do not work as expected.&lt;/p&gt;
&lt;p&gt;Hopefully, Nordic will have some mercy on us and add examples, notes and limitations to the documentation.&lt;/p&gt;
&lt;p&gt;And now back to work with the UARTE and its &amp;quot;Easy-DMA&amp;quot; &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f61e.svg" title="Disappointed"&gt;&amp;#x1f61e;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UARTE: Why does the ENDRX value not change from zero once the MAXCNT number of bytes have been received?</title><link>https://devzone.nordicsemi.com/thread/192333?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 11:47:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e5e594c-2320-4cf0-a73a-8d9f6513107b</guid><dc:creator>DiBosco</dc:creator><description>&lt;p&gt;Actually, I think it&amp;#39;s worse than I thought. I think that the RXD amount does not change until the requisite number of bytes as set in the RXD.MAXCOUNT is received.Originally I thought I could see that this value was changing because I had set the value so low. &lt;/p&gt;
&lt;p&gt;If you have variable amounts coming in the only sensible way is to set the DMA to receive one byte and continually retrigger.&lt;/p&gt;
&lt;p&gt;Whoever designed this UART needs to have a word with themself.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UARTE: Why does the ENDRX value not change from zero once the MAXCNT number of bytes have been received?</title><link>https://devzone.nordicsemi.com/thread/192308?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 09:52:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8923365a-8d52-4e12-b6a7-e271909a108b</guid><dc:creator>DiBosco</dc:creator><description>&lt;p&gt;Hey Simon,&lt;/p&gt;
&lt;p&gt;I think the problem is that there is a load of existing code in the demo that deals with the UART and it has been interfering with my code. I thought I was only calling the existing UART init, but the interrupt handling functions are interfering with my code, I thought all my interrupts were disabled, but it&amp;#39;s not the case. &lt;/p&gt;
&lt;p&gt;The code is pretty dense and I suspect it&amp;#39;s like the STM/Atmel dev kit example code in that it&amp;#39;s set up to work on multiple kits and so is pretty obfuscated. I need to completely rethink how serial code is received, because this is not like anormal UART.&lt;/p&gt;
&lt;p&gt;Thanks a lot for the help.&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: UARTE: Why does the ENDRX value not change from zero once the MAXCNT number of bytes have been received?</title><link>https://devzone.nordicsemi.com/thread/192222?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 07:20:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:436d3f30-6063-437f-974e-afb6c152832f</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;The RXD.AMOUNT will count the number of bytes received in the last transaction, so I believe this value will &amp;quot;reset&amp;quot; between each transaction, as it will only count the bytes in the latest one. Please check out the&amp;nbsp; &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.2.0%2Fgroup__nrf__uarte__hal.html&amp;amp;resultof=%22%6e%72%66%5f%75%61%72%74%65%5f%72%78%5f%61%6d%6f%75%6e%74%5f%67%65%74%22%20"&gt;nrf_uarte_rx_amount_get &lt;/a&gt;function for more information.&lt;/p&gt;
&lt;p&gt;The PPI is a &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fppi.html&amp;amp;resultof=%22%50%50%49%22%20%22%70%70%69%22%20"&gt;Programmable Peripheral Interconnect&lt;/a&gt;, please read more on the Infocenter.&lt;/p&gt;
&lt;p&gt;Best regards and sorry for the delayed reply,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UARTE: Why does the ENDRX value not change from zero once the MAXCNT number of bytes have been received?</title><link>https://devzone.nordicsemi.com/thread/192093?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2019 13:10:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c45c3b51-e035-4249-bbf2-a97fcb5fef11</guid><dc:creator>DiBosco</dc:creator><description>&lt;p&gt;Bump. Can anyone tell me how the RXD.AMOUNT value is reset to zero please? &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UARTE: Why does the ENDRX value not change from zero once the MAXCNT number of bytes have been received?</title><link>https://devzone.nordicsemi.com/thread/191573?ContentTypeID=1</link><pubDate>Fri, 07 Jun 2019 09:27:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5f489ca-82c2-4d9d-876a-0d5ebed76a00</guid><dc:creator>DiBosco</dc:creator><description>&lt;p&gt;Ah, so I &lt;em&gt;was&lt;/em&gt; expecting it to work like a normal UART and it doesn&amp;#39;t. Fab.&lt;/p&gt;
&lt;p&gt;There is a way, surely, to count how many bytes have been received by looking at the RXD.AMOUNT? What I don&amp;#39;t get is how you reset that value.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BTW, what&amp;#39;s a PPI?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UARTE: Why does the ENDRX value not change from zero once the MAXCNT number of bytes have been received?</title><link>https://devzone.nordicsemi.com/thread/191568?ContentTypeID=1</link><pubDate>Fri, 07 Jun 2019 09:22:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:efc081d5-b0b9-4a23-a684-b5683a88e256</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;There is no way to check how many bytes have been received thus it is not easy to write a robust UARTE driver. Hence Nordic has implemented library called: `LibUARTE`.&lt;/p&gt;
&lt;p&gt;It is using timer and PPI to calculate how many bytes you have in the buffer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UARTE: Why does the ENDRX value not change from zero once the MAXCNT number of bytes have been received?</title><link>https://devzone.nordicsemi.com/thread/191564?ContentTypeID=1</link><pubDate>Fri, 07 Jun 2019 09:16:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f39e8011-8e03-4129-9722-8266efef5a3b</guid><dc:creator>DiBosco</dc:creator><description>&lt;p&gt;Hi Jakub,&lt;/p&gt;
&lt;p&gt;So are you saying that there is no way to automatically flag the UART has a received X bytes? You have to manually change another bit for the end of receive flag to be set?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UARTE: Why does the ENDRX value not change from zero once the MAXCNT number of bytes have been received?</title><link>https://devzone.nordicsemi.com/thread/191467?ContentTypeID=1</link><pubDate>Thu, 06 Jun 2019 20:48:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0e3587c-7512-461f-9698-1444c1ddb907</guid><dc:creator>Jakub Rzeszutko</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Value of&amp;nbsp;&lt;span&gt;ENDRX&amp;nbsp;&lt;/span&gt;will be updated once you will stop the receiver.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UARTE: Why does the ENDRX value not change from zero once the MAXCNT number of bytes have been received?</title><link>https://devzone.nordicsemi.com/thread/191366?ContentTypeID=1</link><pubDate>Thu, 06 Jun 2019 12:45:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74066d92-fc54-45e0-96f4-88f0f95d3586</guid><dc:creator>DiBosco</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;The problem is that ENDRX does not change from 0 to non-zero when the requisite number of bytes have been received by the UART. I would expect that when you set up the DMA to receive three bytes the ENDRX signal would change from non zero. To one I&amp;#39;d assume, but whatever, it never changes from zero.&lt;/p&gt;
&lt;p&gt;I have to confess I do not get this FLUSH signal at all. I suspect I think the UART should work in a traditional UART way and it&amp;#39;s a bit funky, with me just not able to understand it at all. I&amp;#39;ve read through the data sheet multiple times and I still don&amp;#39;t get it.&lt;/p&gt;
&lt;p&gt;I&amp;#39;d already seen that post you&amp;#39;ve linked to and was still as mystified after reading it over and over.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m clearly missing something fundamental here.&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s start with this:&lt;/p&gt;
&lt;p&gt;If I set this:&lt;/p&gt;
&lt;p&gt;NRF_UARTE0-&amp;gt;RXD.MAXCNT = 5;&lt;/p&gt;
&lt;p&gt;Should&lt;/p&gt;
&lt;p&gt;NRF_UARTE0-&amp;gt;EVENTS_ENDRX&lt;/p&gt;
&lt;p&gt;Be set to a non-zero value when five bytes have come in over the UART?&lt;/p&gt;
&lt;p&gt;If my understanding is correct, what could I be doing that means it doesn&amp;#39;t happen?&lt;/p&gt;
&lt;p&gt;If I misunderstand something, how do we get a notification that the number of bytes received by the UART is the value set in NRF_UARTE0-&amp;gt;RXD.MAXCNT?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also, you say:&lt;/p&gt;
&lt;p&gt;&amp;quot;What do you mean by this?&amp;quot;&lt;/p&gt;
&lt;p&gt;What I mean is that if I stop the debugger I can clearly see that the data that has been sent from the computer to the nRF is in memory. So, even if I set NRF_UARTE0-&amp;gt;RXD.MAXCNT to five, if the computer sends twenty bytes out, I get twenty bytes in my receive buffer, but I never get a notification that I have received the number of bytes in RXD.MAXCNT. ie EVENTS_ENDRX never changes value.&lt;/p&gt;
&lt;p&gt;Thanks :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UARTE: Why does the ENDRX value not change from zero once the MAXCNT number of bytes have been received?</title><link>https://devzone.nordicsemi.com/thread/191344?ContentTypeID=1</link><pubDate>Thu, 06 Jun 2019 12:02:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be37262b-a80c-4f95-bdf8-c28714470fbe</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
[quote user=""]If I poll for activity simply on the EVENTS_RXDRDY I am 100% definitely getting all the data being sent into the nRF correctly.[/quote]
&lt;p&gt;What do you mean by this? Do you not receive the data without the END_RX event? As stated in the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fuarte.html&amp;amp;resultof=%22%75%61%72%74%65%22%20%22%75%61%72%74%22%20"&gt;Infocenter&lt;/a&gt;&amp;#39;s reception chapter: &amp;quot;&lt;span&gt;The UARTE will generate the ENDRX event after completing the FLUSHRX task even if the RX FIFO was empty or if the RX buffer does not get filled up.&amp;quot; So is the FLUSHRX task being done in your application? That should cause the ENDRX event to trigger.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you want a better understanding of these functions overall, &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/13633/uarte-stoprx-on-exact-byte"&gt;this case&lt;/a&gt; has a very in-depth discussion on the various UARTE functions, ENDRX included.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If this isn&amp;#39;t of help, I am sorry, but I am not entirely sure what exactly your problem is, so, please describe what exactly is not working.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Simon&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>