<?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>Async reads from UART do not return partial data</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/39377/async-reads-from-uart-do-not-return-partial-data</link><description>SDK version 15.2.0 (latest at the moment of writing). I am having trouble reading from UART in &amp;gt; 1 byte chunks where exact length is not known upfront. 
 The problem is, UART driver will not return partial result even after explicit abort (which i invoke</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 29 Mar 2019 10:18:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/39377/async-reads-from-uart-do-not-return-partial-data" /><item><title>RE: Async reads from UART do not return partial data</title><link>https://devzone.nordicsemi.com/thread/179178?ContentTypeID=1</link><pubDate>Fri, 29 Mar 2019 10:18:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a236db6d-1ddf-493a-9526-541fd073bb9c</guid><dc:creator>Bart Cerneels</dc:creator><description>&lt;p&gt;We have a copy of the SDK in a git repo and when I replaced nrfx I turned that directory into a submodule.&lt;/p&gt;
&lt;p&gt;So here is the exact commit we are using:&lt;/p&gt;
&lt;p&gt;d4ebe15f58de1442e3eed93b40d13930e7785903 nRF5_SDK_15.2.0_9412b96/modules/nrfx (v1.3.1)&lt;/p&gt;
&lt;p&gt;It&amp;#39;s from the&amp;nbsp;&lt;a href="https://github.com/NordicSemiconductor/nrfx"&gt;repo&amp;nbsp;&lt;/a&gt;&lt;span&gt;&lt;a href="https://github.com/NordicSemiconductor/nrfx"&gt;git@github.com:NordicSemiconductor/nrfx.git&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I would also request from Nordic to public their SDK on &lt;a href="https://github.com/NordicSemiconductor"&gt;github&lt;/a&gt; like their other tools. This make it easy for us to use git submodule to include an exact version of the SDK in our codebase.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Async reads from UART do not return partial data</title><link>https://devzone.nordicsemi.com/thread/178537?ContentTypeID=1</link><pubDate>Wed, 27 Mar 2019 05:37:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1602baa9-b31e-4fa8-b461-a15563c52de9</guid><dc:creator>Avanti</dc:creator><description>&lt;p&gt;Hi, Can you point me to the NRFX module on github which is working?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Async reads from UART do not return partial data</title><link>https://devzone.nordicsemi.com/thread/176511?ContentTypeID=1</link><pubDate>Fri, 15 Mar 2019 17:17:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6fe1d103-b91c-47c2-8c59-542f34a5a716</guid><dc:creator>eric-appion</dc:creator><description>&lt;p&gt;OK, will try that. Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Async reads from UART do not return partial data</title><link>https://devzone.nordicsemi.com/thread/175837?ContentTypeID=1</link><pubDate>Wed, 13 Mar 2019 08:30:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52f0233a-065a-42cb-a946-cb6bbf216696</guid><dc:creator>Bart Cerneels</dc:creator><description>&lt;p&gt;Yes, it&amp;#39;s working.&lt;/p&gt;
&lt;p&gt;We just ended up replacing the NRFX module with the latest release from github.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Async reads from UART do not return partial data</title><link>https://devzone.nordicsemi.com/thread/175780?ContentTypeID=1</link><pubDate>Tue, 12 Mar 2019 19:22:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4faaf46-dc83-4998-b3b8-bde54f9eaebd</guid><dc:creator>eric-appion</dc:creator><description>&lt;p&gt;I&amp;#39;ve just run into the same problem. I want to use double-buffering to avoid dropping received characters when receiving at a high bit rate (921600 bps) without hardware flow control, and I&amp;#39;m calling nrfx_uarte_rx_abort() periodically to get any characters at the trailing end of a receive that don&amp;#39;t fill the buffer, and I don&amp;#39;t get the documented&amp;nbsp;NRFX_UARTE_EVT_RX_DONE event.&lt;/p&gt;
&lt;p&gt;Has anyone come up with a patch to the nrfx_uarte driver to get this working?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Async reads from UART do not return partial data</title><link>https://devzone.nordicsemi.com/thread/158208?ContentTypeID=1</link><pubDate>Tue, 20 Nov 2018 14:13:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:908066b6-2f4f-4f52-99a7-3debba0e28b1</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for reporting. I have found what seems to be a dormant internal bug report related to the issue. I&amp;#39;ll try to revive it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Async reads from UART do not return partial data</title><link>https://devzone.nordicsemi.com/thread/157955?ContentTypeID=1</link><pubDate>Mon, 19 Nov 2018 12:53:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:555682ff-94d8-4b63-b5c2-f585f1e0466a</guid><dc:creator>Bart Cerneels</dc:creator><description>&lt;p&gt;I&amp;#39;m in a similar situation trying to use UARTE on nrf52840.&lt;br /&gt;I updated NRFX to the latest v1.3.1 tag but still don&amp;#39;t get an RX_DONE event after&amp;nbsp;&lt;span&gt;nrfx_uarte_rx_abort(). In fact, stepping through the driver it&amp;#39;s not even getting&amp;nbsp;&lt;/span&gt;NRF_UARTE_EVENT_ENDRX.&lt;/p&gt;
&lt;p&gt;This could be another bug or the result of nrfx_uarte not having good documentation, including an example.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Async reads from UART do not return partial data</title><link>https://devzone.nordicsemi.com/thread/157662?ContentTypeID=1</link><pubDate>Fri, 16 Nov 2018 09:00:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b91e97a-0256-4703-abf0-e78cce06c231</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Can you please try the nrfx_uarte drivers found &lt;a href="https://github.com/NordicSemiconductor/nrfx/tree/master/drivers/src"&gt;here&lt;/a&gt;? They are part of nrfx and they made some changes related to double buffering and RXTO in &lt;a href="https://github.com/NordicSemiconductor/nrfx/blob/master/CHANGELOG.md"&gt;v1.2.0&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Async reads from UART do not return partial data</title><link>https://devzone.nordicsemi.com/thread/154928?ContentTypeID=1</link><pubDate>Mon, 29 Oct 2018 16:24:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:daf868a2-9cca-43a3-977c-4fe1caab9142</guid><dc:creator>rojer</dc:creator><description>&lt;p&gt;hi Martin&lt;/p&gt;
&lt;p&gt;well, wrt the way hardware functions, i guess that&amp;#39;s fair enough.&lt;/p&gt;
&lt;p&gt;my intention is to get whatever data has been received and process it.&lt;/p&gt;
&lt;p&gt;let&amp;#39;s go back to the description of&amp;nbsp;&lt;span&gt;nrfx_uarte_rx_abort(():&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;317 /**&lt;/span&gt;&lt;br /&gt;&lt;span&gt;318 * @brief Function for aborting any ongoing reception.&lt;/span&gt;&lt;br /&gt;&lt;span&gt;319 * @note @ref NRFX_UARTE_EVT_RX_DONE event will be generated in non-blocking mode.&lt;/span&gt;&lt;br /&gt;&lt;span&gt;320 * It will contain number of bytes received until abort was called. The event&lt;/span&gt;&lt;br /&gt;&lt;span&gt;321 * handler will be called from UARTE interrupt context.&lt;/span&gt;&lt;br /&gt;&lt;span&gt;322 *&lt;/span&gt;&lt;br /&gt;&lt;span&gt;323 * @param[in] p_instance Pointer to the driver instance structure.&lt;/span&gt;&lt;br /&gt;&lt;span&gt;324 */&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;currently, this does not happen when double buffering is used - RX_DONE driver-level event does not get raised. so we still have a driver-level bug.&lt;/p&gt;
&lt;p&gt;in the end, i don&amp;#39;t care that much whether internally it is&amp;nbsp;precipitated by RXTO or ENDRX, but i need RX_DONE with the data accumulated in UART buffer so far.&lt;/p&gt;
&lt;p&gt;looking inside the driver, and given the hardware behavior, it seems that&amp;nbsp;my first suggestion of removing the check will work just fine in both cases, double-buffered and not. but as i said, ultimately&amp;nbsp;i only care about the outcome - receiving RX_DONE with partial data when receive is double-buffered.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Async reads from UART do not return partial data</title><link>https://devzone.nordicsemi.com/thread/154926?ContentTypeID=1</link><pubDate>Mon, 29 Oct 2018 16:11:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:141b326e-6492-4165-916f-addc146d8ad1</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I talked to one of the architects behind the UARTE module and he said this is intended behavior. The spec says that:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;quot;The UARTE will make sure that an impending ENDRX event will be generated &lt;em&gt;before the RXTO event is generated&lt;/em&gt;.&amp;quot;&lt;/p&gt;
&lt;p&gt;If you enable the ENDRX_STARTRX shortcut it will ensure that a new RX starts immediately after the ENDRX event, &lt;em&gt;before the RXTO event is triggered&lt;/em&gt;. The shortcut is then effectively resetting all the internal logic and timers in the UART module which hence disregards pending RXTO events. After the RX is started again it is as if the STOPRX task was never triggered.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure where this leaves us though. I&amp;#39;m not sure I completely understand your problem and how it all connects yet.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Async reads from UART do not return partial data</title><link>https://devzone.nordicsemi.com/thread/153674?ContentTypeID=1</link><pubDate>Fri, 19 Oct 2018 14:29:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:788c8dac-72a7-4b17-baee-8a5c1f78be95</guid><dc:creator>rojer</dc:creator><description>&lt;p&gt;thanks, Martin&lt;/p&gt;
&lt;p&gt;for now i just don&amp;#39;t use double buffering in my&amp;nbsp;app code and seem to be getting away with it fine, but it would&amp;nbsp;be desirable (the hardware doesn&amp;#39;t have flow control pins, unfortunately).&lt;/p&gt;
&lt;p&gt;irrespective of RXTO behavior, i&amp;nbsp;don&amp;#39;t see any particular reason not to return partial data to the user, so juts removing that condition would deal with the issue as far as i&amp;#39;m concerned.&lt;/p&gt;
&lt;p&gt;i also happened to notice that the manual very clearly says that one needs to flush the fifo first before the transfer is really done, but i don&amp;#39;t see driver doing that. i haven&amp;#39;t seen any data loss though, so maybe it&amp;#39;s fine.&lt;/p&gt;
&lt;p&gt;anyway, awaiting you response on this issue. thanks for looking into it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Async reads from UART do not return partial data</title><link>https://devzone.nordicsemi.com/thread/153670?ContentTypeID=1</link><pubDate>Fri, 19 Oct 2018 14:19:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3fc14e19-ad3d-4bbc-97d9-d177d96c1cfc</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Sorry for the late response. I have done some further digging and consulted SDK driver team, and regarding your first point; it turns out that &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/16320/nrf_drv_uart-rxto"&gt;you are not the first to report this&lt;/a&gt;. I also found some internal bug reports, but the guy responsible for them doesn&amp;#39;t work for Nordic anymore and it seems like the report was forgotten about. I&amp;#39;ll have to look further into this next week.&lt;/p&gt;
&lt;p&gt;Regarding your last point the SDK team says that RXTO is enabled in the init and disabled in the uninit functions. So that means that RXTO interrupt should be enabled until the developer explicitly calls the uninit function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Async reads from UART do not return partial data</title><link>https://devzone.nordicsemi.com/thread/152751?ContentTypeID=1</link><pubDate>Sat, 13 Oct 2018 10:52:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:904711eb-c178-4762-8d54-f5c062f14075</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;How to properly post source code:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/3225.Nordic-Insert-Code.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Async reads from UART do not return partial data</title><link>https://devzone.nordicsemi.com/thread/152739?ContentTypeID=1</link><pubDate>Fri, 12 Oct 2018 18:16:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea31d32b-0ba1-41b2-bab1-8f6bdd9bc08f</guid><dc:creator>rojer</dc:creator><description>&lt;p&gt;Ok, i experimented some more and it seem that RXTO is not raised at all if RXD is double-buffered, i.e. if&amp;nbsp;transfer is aborted while there&amp;nbsp;is second buffer available and the ENDRX-&amp;gt;STARTRX short is enabled (which driver does).&lt;/p&gt;
&lt;p&gt;here&amp;#39;s what i did. at the top of&amp;nbsp;uarte_irq_handler, i added this:&lt;/p&gt;
&lt;p&gt;if (nrf_uarte_event_check(p_uarte, NRF_UARTE_EVENT_RXTO)) {&lt;br /&gt;&amp;nbsp; bsp_board_led_on(1);&lt;br /&gt; }&lt;br /&gt; if (nrf_uarte_event_check(p_uarte, NRF_UARTE_EVENT_ENDRX)) {&lt;br /&gt;&amp;nbsp; bsp_board_led_on(3);&lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;when i only configure single buffer and do a short transfer, i get both leds to light up. when i configure second buffer, only LED4 light ups and RXTO is never triggered.&lt;/p&gt;
&lt;p&gt;the manual doesn&amp;#39;t mention anything about RXTO and double buffering interaction, so i suppose it should be the same. this smells like a silicon bug, actually&lt;/p&gt;
&lt;p&gt;also, here, at the end of nrfx_uarte_rx, when interrupts are enabled for the async case:&lt;/p&gt;
&lt;p&gt;438 {&lt;br /&gt;439 nrf_uarte_int_enable(p_instance-&amp;gt;p_reg, NRF_UARTE_INT_ERROR_MASK |&lt;br /&gt;440 NRF_UARTE_INT_ENDRX_MASK);&lt;br /&gt;441 }&lt;/p&gt;
&lt;p&gt;isn&amp;#39;t&amp;nbsp;&lt;span&gt;NRF_UARTE_INT_RXTO_MASK supposed to be there as well?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Async reads from UART do not return partial data</title><link>https://devzone.nordicsemi.com/thread/152732?ContentTypeID=1</link><pubDate>Fri, 12 Oct 2018 15:20:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf6dc4e3-2882-434e-ba57-5e2c5a87c226</guid><dc:creator>rojer</dc:creator><description>&lt;p&gt;what you say makes sense, but i also&amp;nbsp;wasn&amp;#39;t just browsing around the driver code to find this.&lt;/p&gt;
&lt;p&gt;i definitely was not getting partial RX_DONE events until i identified and disabled that check.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Async reads from UART do not return partial data</title><link>https://devzone.nordicsemi.com/thread/152730?ContentTypeID=1</link><pubDate>Fri, 12 Oct 2018 15:15:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b1aa454-1830-4b4c-8c83-476ac45a39a1</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure if I agree. If you look at&amp;nbsp;&lt;span&gt;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/uarte.html?cp=2_1_0_34_3#concept_uzb_p2m_wr"&gt;Figure 4. UARTE reception with forced stop via STOPRX&lt;/a&gt;&amp;nbsp;you can see that you should get an RXTO event after you trigger&amp;nbsp;the STOPRX task (which is what happens when you call&amp;nbsp;nrfx_uarte_rx_abort()). If you look in the nrfx_uarte drivers you can see that this event calls the RX DONE event:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// nrfx_uart.c line 549:
if (nrf_uarte_event_check(p_uarte, NRF_UARTE_EVENT_RXTO))
{
    nrf_uarte_event_clear(p_uarte, NRF_UARTE_EVENT_RXTO);
    if (p_cb-&amp;gt;rx_buffer_length)
    {
        p_cb-&amp;gt;rx_buffer_length = 0;
        rx_done_event(p_cb, nrf_uarte_rx_amount_get(p_uarte), p_cb-&amp;gt;p_rx_buffer);
    }
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;As far as I understand, this event should provide you with the bytes received up until abort was called.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>