<?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>Check UART transmit complete in nRF52832</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/44934/check-uart-transmit-complete-in-nrf52832</link><description>Hi, 
 I use &amp;quot;printf&amp;quot; or &amp;quot;app_uart_put&amp;quot; function to print message to UART., how can I check &amp;quot;all of the data had been transmit out complete&amp;quot;? 
 
 Thank you, 
 Chianglin</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 20 Mar 2019 07:34:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/44934/check-uart-transmit-complete-in-nrf52832" /><item><title>RE: Check UART transmit complete in nRF52832</title><link>https://devzone.nordicsemi.com/thread/177219?ContentTypeID=1</link><pubDate>Wed, 20 Mar 2019 07:34:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4823944-e2da-47c3-868e-94a31cd9b655</guid><dc:creator>chianglin</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I had complete the implement of RS485 interface.&lt;/p&gt;
&lt;p&gt;Thank you for your support.&lt;/p&gt;
&lt;p&gt;Chianglin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Check UART transmit complete in nRF52832</title><link>https://devzone.nordicsemi.com/thread/176909?ContentTypeID=1</link><pubDate>Tue, 19 Mar 2019 09:16:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2b3c655-334c-43a9-874e-41d5b13beaa6</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Yes, you do.&lt;/p&gt;
&lt;p&gt;If you look at the implementation in the library (app_uart_fifo.c), you can see that the whenever a&amp;nbsp;NRF_DRV_UART_EVT_TX_DONE event is received from the driver (indicating that a byte have been successfully transmitted) it will pull a new byte from the FIFO and transmit this, &lt;strong&gt;&lt;em&gt;or&lt;/em&gt; &lt;/strong&gt;send the&amp;nbsp;APP_UART_TX_EMPTY event if no more bytes are present in the FIFO:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;case NRF_DRV_UART_EVT_TX_DONE:
    // Get next byte from FIFO.
    if (app_fifo_get(&amp;amp;m_tx_fifo, tx_buffer) == NRF_SUCCESS)
    {
        (void)nrf_drv_uart_tx(&amp;amp;app_uart_inst, tx_buffer, 1);
    }
    else
    {
        // Last byte from FIFO transmitted, notify the application.
        app_uart_event.evt_type = APP_UART_TX_EMPTY;
        m_event_handler(&amp;amp;app_uart_event);
    }&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Check UART transmit complete in nRF52832</title><link>https://devzone.nordicsemi.com/thread/176810?ContentTypeID=1</link><pubDate>Mon, 18 Mar 2019 17:37:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09a6b707-b93a-4e5a-9c3e-f36dc0a353f4</guid><dc:creator>awneil</dc:creator><description>[quote userid="14926" url="~/f/nordic-q-a/44934/check-uart-transmit-complete-in-nrf52832/176746"]you will get a&amp;nbsp;&lt;span&gt;APP_UART_TX_EMPTY&amp;nbsp;event when all bytes have been transmitted.&lt;/span&gt;[/quote]
&lt;p&gt;Do you?&lt;/p&gt;
&lt;p&gt;Or do you get that event when the last byte has been taken out of the FIFO, and loaded into the UART for transmission?&lt;/p&gt;
&lt;p&gt;For turning round a half-duplex line (such as &lt;a href="https://devzone.nordicsemi.com/members/chianglin"&gt;chianglin&lt;/a&gt;&amp;#39;s RS485), you need to know the actual end of transmission - ie, when the final stop bit has left the shift register ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Check UART transmit complete in nRF52832</title><link>https://devzone.nordicsemi.com/thread/176746?ContentTypeID=1</link><pubDate>Mon, 18 Mar 2019 14:05:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:726d1da6-26c6-4afe-a1d6-cdba628cee93</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Like I wrote in my previous answer, you will get a&amp;nbsp;&lt;span&gt;APP_UART_TX_EMPTY&amp;nbsp;event when all bytes have been transmitted. You can set a flag in the event handler when you receive this event, and use this flag to no the switching between TX and RX.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Check UART transmit complete in nRF52832</title><link>https://devzone.nordicsemi.com/thread/176738?ContentTypeID=1</link><pubDate>Mon, 18 Mar 2019 13:50:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f7792b1-950d-43f2-86f6-1ad91786a48d</guid><dc:creator>chianglin</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;J&amp;oslash;rgen,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you for your explain.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Actually, I use UART interface to send / receive RS485 data.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Because RS485 is working in half duplex transceiver mode.&amp;nbsp;&amp;nbsp; I need to know UART is complete send all data and switch to receive mode, so Nordic can receive data&amp;nbsp; from RS485 mode.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Would you please tell me how can I do this job?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Chianglin&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Check UART transmit complete in nRF52832</title><link>https://devzone.nordicsemi.com/thread/176714?ContentTypeID=1</link><pubDate>Mon, 18 Mar 2019 13:06:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:801eccdb-bf34-4679-87f7-7d4a0ec540dc</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;When you call printf, all chars in the string will be put into the app_uart FIFO by multiple calls to &lt;span&gt;app_uart_put(),&amp;nbsp;&lt;/span&gt;and the library will start processing the FIFO. Then printf returns, all chars have been put into the FIFO. Whenever all bytes have been transmitted and the app_uart FIFO is empty, you will receive a&amp;nbsp;APP_UART_TX_EMPTY event in the event handler. If you have added more bytes to the FIFO in the meantime, you will not receive an event until these bytes have been transmitted as well. There is no other functionality in the library to know when a transfer is completed.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>