<?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>What exactly does the nrf_serial_flush?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/76887/what-exactly-does-the-nrf_serial_flush</link><description>Hello, 
 I&amp;#39;m doing a project with Zigbee using the nRF52840 and I want to read some sensors that talk via UART. 
 I have ported with success the nrf_uart example but after discovering that this library doesn&amp;#39;t have support for multiple UART instances</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 09 Jul 2021 12:04:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/76887/what-exactly-does-the-nrf_serial_flush" /><item><title>RE: What exactly does the nrf_serial_flush?</title><link>https://devzone.nordicsemi.com/thread/319360?ContentTypeID=1</link><pubDate>Fri, 09 Jul 2021 12:04:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d78d60fa-85e5-4f16-bbb6-a0eb6d3f443a</guid><dc:creator>Fernando Fontes</dc:creator><description>&lt;p&gt;Ok, thanks for the support. Great help :).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What exactly does the nrf_serial_flush?</title><link>https://devzone.nordicsemi.com/thread/319354?ContentTypeID=1</link><pubDate>Fri, 09 Jul 2021 11:55:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6169eada-a634-4303-957f-bd882289b62e</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="Fernando Fontes"]How is handled the reception in this implementation? Is it by interrupts? I know that there is an event handler putting the RX data into a buffer, but is this module still using easyDMA?[/quote]
&lt;p&gt;&amp;nbsp;Yes, it is interrupt based which is handled in nrfx_uarte.c/nrfx_uart.c. If EasyDMA is used or not depends on what you have set in&amp;nbsp;nRF5_SDK_17.0.2_d674dde\integration\nrfx\legacy\apply_old_config.h&amp;nbsp;NRFX_UARTE_ENABLED which inturn depends on your settings in sdk_config.h.&amp;nbsp; &amp;nbsp;Just set UARTX_ENABLED and&amp;nbsp;UART_EASY_DMA_SUPPORT to 1 in sdk_config.h and&amp;nbsp;you will see that easydma will be used though the hal driver nrfx_uarte.c&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What exactly does the nrf_serial_flush?</title><link>https://devzone.nordicsemi.com/thread/319332?ContentTypeID=1</link><pubDate>Fri, 09 Jul 2021 11:03:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:480c6eb5-3cfe-4041-a0ee-37d3280dc3cb</guid><dc:creator>Fernando Fontes</dc:creator><description>&lt;p&gt;Well, I switched to the app_uart_fifo implementation. It&amp;#39;s a lot more stable than the nrf_serial. Libuarte&amp;nbsp;would be my next option. But since app_uart_fifo seems to be stable I will stick with this one.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However, I&amp;#39;ve just finished the implementation a few minutes ago. It would be great if you could explain a few things about app_uart_fifo implementation.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How is handled the reception in this implementation? Is it by interrupts? I know that there is an event handler putting the RX data into a buffer, but is this module still using easyDMA?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What exactly does the nrf_serial_flush?</title><link>https://devzone.nordicsemi.com/thread/319329?ContentTypeID=1</link><pubDate>Fri, 09 Jul 2021 10:46:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3c64d81-b716-4a9a-a2e8-83a076930beb</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="Fernando Fontes"] I&amp;#39;m starting to think that this is somehow a priority-related issue... Is that possible? How are the DMA to RAM transfers being handled? Do I need to change the priority values?[/quote]
&lt;p&gt;&amp;nbsp;The priority of ISR handling becomes very important if you are not using HW flow control.&amp;nbsp;But with this, i would still expect to see overrun errors and not framing errors.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Fernando Fontes"]One of the tasks that I&amp;#39;m running in parallel is a Zigbee application and I noticed that with that task off, the framing errors are very low.[/quote]
&lt;p&gt;I cannot put my head around this behavior. Are you seeing less errors per average transaction or are you seeing less errors per average time? Because if it is the second, I could understand as Zigbee task and stack taking more time to process its data and giving UART ISR less time to process its data.&lt;/p&gt;
[quote user="Fernando Fontes"]Yes, I have both 32Mhz and 32.768kHz external clocks. I tried to call the&amp;nbsp;&lt;span&gt;nrf_drv_clock_hfclk_request&lt;/span&gt;[/quote]
&lt;p&gt;nrf_serial is somewhat less preffered library over libuarte and is also a reason we removed it from latest SDKs. Can you please try to move to libuarte? I know that this sounds like work, but there could be only two possibilities to explore. One is clock inaccuracies and the other is possible nrf_serial bug. I know that the libuarte is very stable so atleast we can exclude one suspecting direction.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What exactly does the nrf_serial_flush?</title><link>https://devzone.nordicsemi.com/thread/319085?ContentTypeID=1</link><pubDate>Thu, 08 Jul 2021 08:08:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2fc2edb4-aa2f-4a21-b262-c7da0f9e6dc9</guid><dc:creator>Fernando Fontes</dc:creator><description>&lt;p&gt;Yes, I have both 32Mhz and 32.768kHz external clocks. I tried to call the&amp;nbsp;&lt;span&gt;nrf_drv_clock_hfclk_request and the behavior is still the same. One of the tasks that I&amp;#39;m running in parallel is a Zigbee application and I noticed that with that task off, the framing errors are very low. So, I did a quick search to see if the easyDMA of UART1 is using repeated addresses but I guess no. I&amp;#39;m starting to think that this is somehow a priority-related issue... Is that possible? How are the DMA to RAM transfers being handled? Do I need to change the priority values?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What exactly does the nrf_serial_flush?</title><link>https://devzone.nordicsemi.com/thread/319065?ContentTypeID=1</link><pubDate>Thu, 08 Jul 2021 07:03:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ff55603-e76d-497d-a14d-36b98511e509</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Do you have XO HFCLK on your board? If so you should also call&amp;nbsp;nrf_drv_clock_hfclk_request to be able to explicitly start the crystal. If you have not done this, then most probably you are using internal RC HFCLK which is less accurate and would explain why you get framing errors so often.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What exactly does the nrf_serial_flush?</title><link>https://devzone.nordicsemi.com/thread/318835?ContentTypeID=1</link><pubDate>Tue, 06 Jul 2021 15:08:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:234616bc-3b69-4fda-b222-92f75fcd5463</guid><dc:creator>Fernando Fontes</dc:creator><description>&lt;p&gt;I&amp;#39;m only running the&amp;nbsp;&lt;code&gt;ret_code_t err_code = nrf_drv_clock_init();&amp;nbsp;&lt;span&gt;to initialize the clock.&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;span&gt;I noticed that this function is a legacy one, could it be the reason? Should I waste some time trying to change these functions?&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What exactly does the nrf_serial_flush?</title><link>https://devzone.nordicsemi.com/thread/318728?ContentTypeID=1</link><pubDate>Tue, 06 Jul 2021 07:38:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4bcb49ac-36ab-4b3b-89bc-c29c70cbbf9a</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I do not think that the framing error is due to the FreeRTOs+UART combo. Framing errors normally happen due to clock accuracy differences on both ends of UART. Please check the HFCLK clock accuracy (more specifically clock that effects the UART baudrate accuracy) on both ends to see if both nRF UART and the peer UART&amp;#39;s clocks are drifting away with time?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If it was FreeRTOS+UART combo that causes the problem, I would expect it to be OVERRUN error and not FRAMING error.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;FreeRTOS port we have does not touch any HFCLK and does not touch any peripheral (other than RTC) registers for the RTOS/Kernel to work. So I would not suspect the combo right away.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What exactly does the nrf_serial_flush?</title><link>https://devzone.nordicsemi.com/thread/318681?ContentTypeID=1</link><pubDate>Mon, 05 Jul 2021 15:42:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59fc0411-c2cd-424d-9ae0-0043a65189a8</guid><dc:creator>Fernando Fontes</dc:creator><description>&lt;p&gt;Just tested and it is indeed a frame error. I added an event handler for the NRF_SERIAL_EVENT_DRV_ERR, and now, every time I get this framing error I&amp;#39;m un-initializing and initializing again the serial module. This kinda solves my problem, but I&amp;#39;m constantly receiving framing errors and losing messages. Why these framing errors are happening so often? I&amp;#39;m using FreeRtos... I read some threads with related issues when using the UART with the freeRtos...&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What exactly does the nrf_serial_flush?</title><link>https://devzone.nordicsemi.com/thread/318598?ContentTypeID=1</link><pubDate>Mon, 05 Jul 2021 10:26:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d05e3ebe-a05c-4f62-9ab5-af0b9c627769</guid><dc:creator>Fernando Fontes</dc:creator><description>&lt;p&gt;The NODEB will only reply to NODEA upon receiving the terminator character (&amp;#39;\r&amp;#39;) so I don&amp;#39;t think&amp;nbsp;so. But I will add a small delay to eliminate this possibility.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not handling overflow and framing errors. When does the overflow occur?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;#define SERIAL_FIFO_TX_SIZE 100&lt;br /&gt;#define SERIAL_FIFO_RX_SIZE 100&lt;/p&gt;
&lt;p&gt;#define SERIAL_BUFF_TX_SIZE 1&lt;br /&gt;#define SERIAL_BUFF_RX_SIZE 1&lt;/p&gt;
&lt;p&gt;Those are my defines, so in theory, since the FIFO size is always bigger than the data sent from both nodes, the overflow shouldn&amp;#39;t occur right? But even if I decided to go with a smaller FIFO, since I&amp;#39;m lopping the nrf_serial_read function, that shouldn&amp;#39;t also be a problem, since the FIFO is always being clear out?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What I&amp;#39;m doing before transmitting is&amp;nbsp;clearing&amp;nbsp;both transmit and receive buffers, so that messages pendent to send or to receive don&amp;#39;t interfere in the new transmissions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What exactly does the nrf_serial_flush?</title><link>https://devzone.nordicsemi.com/thread/318582?ContentTypeID=1</link><pubDate>Mon, 05 Jul 2021 09:26:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb1d8662-6593-4e12-a5a3-a68d7a103cb0</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="Fernando Fontes"]&lt;p&gt;With the&amp;nbsp;&lt;span&gt;NODEB&lt;/span&gt;&amp;nbsp;turned off, the&amp;nbsp;&lt;span&gt;NODEA&lt;/span&gt; is able to tranmitt forever without any problems (allways this data: 0x01 0x30 0x30 0x02 0x53 0x31 0x03 0x45 0x41 0x0d : 10bytes at 9600 bps).&lt;/p&gt;
&lt;p&gt;With the&amp;nbsp;&lt;span&gt;NODEB&lt;/span&gt; turned on and responding after receiving the sent command, the&amp;nbsp;&lt;span&gt;NODEA&lt;/span&gt; after a while starts to send corrupted data and stops receiving the response from the&amp;nbsp;&lt;span&gt;NODEB (data:&amp;nbsp;0x01&amp;nbsp;0xc0&amp;nbsp;0x02&amp;nbsp;0x4a&amp;nbsp;0x0a&amp;nbsp;0x45 0x90&amp;nbsp;0xf8,&amp;nbsp;0x01&amp;nbsp;0xc0&amp;nbsp;0x02&amp;nbsp;0x2a&amp;nbsp;0x1a&amp;nbsp;0x45&amp;nbsp;0x90&amp;nbsp;0xf8 , ..&lt;/span&gt;.)&lt;/p&gt;[/quote]
&lt;p&gt;Sounds like NODEA starts to misbehave both in transmit and receive when NODEB starts to send data. While you are waiting for the flush to happen, it is possible that the NODEB sends too much data that it might cause an overflow error in NODEA while waiting for the TX flush to happen?&amp;nbsp; How is your application handling errors like overflow and framing errors? What is the size of the nrf_serial RX and TX buffers?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What exactly does the nrf_serial_flush?</title><link>https://devzone.nordicsemi.com/thread/318413?ContentTypeID=1</link><pubDate>Fri, 02 Jul 2021 11:20:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88b58f99-cad6-4369-bf53-39aa9abb9794</guid><dc:creator>Fernando Fontes</dc:creator><description>&lt;p&gt;Hmm, this is quite odd.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Let me explain my setup. I have MAX485 IC connected which will translate incoming messages to serial UART. Well RS485 handles both transmitted messages and received messages on the same line. So, I need to toggle a PIN to enter in transmit mode (which will then ignore the incoming data) and then toggle it again to quickly enter in receive mode.&lt;/p&gt;
&lt;p&gt;This is already done thanks to your first explanation. Something like:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Switch to transmit mode 
TOGGLE_TO_TRANSMIT_MODE;
// start writting to the FIFO
ret = nrf_serial_write(&amp;amp;serial1_uarte,
                buffer,
                buffer_size,
                &amp;amp;p_written,
                NRF_SERIAL_MAX_TIMEOUT);
// check if we write all the buffer data
if ( (p_written != buffer_size) || (ret != NRF_SUCCESS) ) {
    retval = pdFAIL;
}
// block until successfully transmit all the data
while ( nrf_serial_flush(&amp;amp;serial1_uarte, 0) != NRF_SUCCESS );
// Go back again to receive mode
TOGGLE_TO_RECEIVE_MODE;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then, I switch to a polling state where I check for data until receiving a terminator character or timeout. Something like:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;// try to read from serial until receiving the terminator or timeout
while( ((xTaskGetTickCount() - ticks) &amp;lt; timeout_ms) &amp;amp;&amp;amp;  (c != terminator) ) {
    // read in non-blocking mode
    ret = nrf_serial_read(&amp;amp;serial1_uarte, &amp;amp;c, sizeof(c), NULL, 0);
    // byte received?
    if (ret == NRF_SUCCESS) {
        if ( buffer_size &amp;gt; *read_bytes ) {
            buffer[*read_bytes] = c; // save this character
            *read_bytes = *read_bytes + 1; // increment
        } else {
            return pdFAIL; // max buffer size received
        }
    } 
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So, I did a bit more testing and I experienced the following:&lt;/p&gt;
&lt;p&gt;Nomenclature:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;gt; NODEA: NRF52840 DK&lt;/p&gt;
&lt;p&gt;&amp;gt; NODEB: Generic UART handler device&lt;/p&gt;
&lt;p&gt;With the&amp;nbsp;&lt;span&gt;NODEB&lt;/span&gt;&amp;nbsp;turned off, the&amp;nbsp;&lt;span&gt;NODEA&lt;/span&gt; is able to tranmitt forever without any problems (allways this data: 0x01 0x30 0x30 0x02 0x53 0x31 0x03 0x45 0x41 0x0d : 10bytes at 9600 bps).&lt;/p&gt;
&lt;p&gt;With the&amp;nbsp;&lt;span&gt;NODEB&lt;/span&gt; turned on and responding after receiving the sent command, the&amp;nbsp;&lt;span&gt;NODEA&lt;/span&gt; after a while starts to send corrupted data and stops receiving the response from the&amp;nbsp;&lt;span&gt;NODEB (data:&amp;nbsp;0x01&amp;nbsp;0xc0&amp;nbsp;0x02&amp;nbsp;0x4a&amp;nbsp;0x0a&amp;nbsp;0x45 0x90&amp;nbsp;0xf8,&amp;nbsp;0x01&amp;nbsp;0xc0&amp;nbsp;0x02&amp;nbsp;0x2a&amp;nbsp;0x1a&amp;nbsp;0x45&amp;nbsp;0x90&amp;nbsp;0xf8 , ..&lt;/span&gt;.)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What exactly does the nrf_serial_flush?</title><link>https://devzone.nordicsemi.com/thread/318326?ContentTypeID=1</link><pubDate>Fri, 02 Jul 2021 04:43:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d3136b7-3b7b-49c1-9fab-f9c33ec9b095</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hmm, seems like the nRF UART and the peer UART lost sync. This normally happens at high baudrates mostly when not using hardware flow control and when there are framing or overrun errors and it depends on how your application has handled it. Overrun error might be less harmful if your application is prepared and designed to tell the peer to retransmit it. But framing errors are a bit tricky as you might have to let the peer trasnmit the whole sequence of chars even after the framing error, reset nRF UART peripheral and then ask the peer to retransmit the whole sequence again to reestablish the sync.&lt;/p&gt;
&lt;p&gt;Easier would be to tone down the baudrate a bit and if possible use hardware flow control.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What exactly does the nrf_serial_flush?</title><link>https://devzone.nordicsemi.com/thread/318284?ContentTypeID=1</link><pubDate>Thu, 01 Jul 2021 15:40:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8215a63a-1abd-4157-9484-6ade66429074</guid><dc:creator>Fernando Fontes</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
&lt;p&gt;Thank you very much for your explanation. It seems to work. However, now I&amp;#39;m having a strange behavior on the serial communication.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Everything is working for a while and suddenly I start to receive strange characters on the serial port and the&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;nrf_serial_read function stops working.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Increasing the FIFO size seems to improve, but does not fixes the issue... Do you have any idea of what could be the reason? I&amp;#39;m handling the serial port on a task (using freertos) and I understand that it could happen to lose some characters if the FIFO overruns, but why stop receiving at all? And what is the reason for the strange characters on the serial TX port?&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Do you have any idea of a possible reason for that? Maybe I should give up on using DMA ...&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Fernando&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What exactly does the nrf_serial_flush?</title><link>https://devzone.nordicsemi.com/thread/317796?ContentTypeID=1</link><pubDate>Tue, 29 Jun 2021 19:19:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1437b45b-8c8d-472d-aec8-08b4985a5bbb</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user=""]Everything is working, but I&amp;#39;m lacking some understandings regarding for instance the&amp;nbsp;nrf_serial_flush() function. What is the purpose of this function?[/quote]
&lt;p&gt;&amp;nbsp;I understand that the name is a bit confusing to what this function actually does. When you define the instance for nrf_serial using NRF_SERIAL_CONFIG_DEF you have a _sleep variable which is the function pointer for the application-specific sleep function.&lt;/p&gt;
&lt;p&gt;nrf_serial_flush only keeping calling this sleep function until the serial queue is being handled in the background (in the uart interrupt) or the timeout happens. It does not brute force a flush as the name suggests.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]I want to be able to toggle a GPIO pin after the transmission done, like having a transmission done pin. How can I do that? [/quote]
&lt;p&gt;&amp;nbsp;nrf_serial_flush is a synchronous cal which does not return with NRF_SUCCESS until the transmit queue is empty. So you can check the return value of nrf_serial_flush and toggle the pin.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>