<?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>printf with UART - blocking way?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/29026/printf-with-uart---blocking-way</link><description>Hello, 
 I used the uart example to print text over serial communication from the SDK v11. 
 The problem is when I write lot of text consecutively, I don&amp;#39;t receive all data on the terminal.
(It clearly appears when I change the UART_TX_BUF_SIZE to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 08 Jan 2019 12:45:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/29026/printf-with-uart---blocking-way" /><item><title>RE: printf with UART - blocking way?</title><link>https://devzone.nordicsemi.com/thread/164521?ContentTypeID=1</link><pubDate>Tue, 08 Jan 2019 12:45:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:955f14a9-6a65-4490-89b7-f11a8893305b</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Happy to help Mathias, best of luck with your project &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: printf with UART - blocking way?</title><link>https://devzone.nordicsemi.com/thread/164209?ContentTypeID=1</link><pubDate>Mon, 07 Jan 2019 10:29:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:593391e3-0b7a-4963-860a-537476ba1591</guid><dc:creator>Mathias</dc:creator><description>&lt;p&gt;Ok, got it! Thanks so much for replying Torbj&amp;oslash;rn!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: printf with UART - blocking way?</title><link>https://devzone.nordicsemi.com/thread/162051?ContentTypeID=1</link><pubDate>Mon, 17 Dec 2018 11:55:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1164f0ab-8edd-4c55-ac8e-099299e4e558</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Mathias&lt;/p&gt;
&lt;p&gt;When you run the code from interrupt context you will block the UART interrupts, which prevents the UART driver from working properly to empty the UART buffers.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;An alternative workaround to this is to make sure the&amp;nbsp;UART interrupts run at a higher interrupt priority (lower pri number) than the interrupt context you are currently in.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: printf with UART - blocking way?</title><link>https://devzone.nordicsemi.com/thread/161074?ContentTypeID=1</link><pubDate>Mon, 10 Dec 2018 17:25:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29fb9d3d-60d7-4a7f-87e5-75e827643970</guid><dc:creator>Mathias</dc:creator><description>&lt;p&gt;Hi Torbj&amp;oslash;rn,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m wondering why the code gets stuck when used in the interrupt context? Why does this code only work in the main context and not in interrupt context?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Mathias&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: printf with UART - blocking way?</title><link>https://devzone.nordicsemi.com/thread/147324?ContentTypeID=1</link><pubDate>Wed, 05 Sep 2018 09:13:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14d4ef13-9bf1-4bb3-b3d8-1f0ad1af115a</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Andre&lt;/p&gt;
&lt;p&gt;I just tested this myself, and as long as I make sure to run the while loop in&amp;nbsp;the main (thread) context it works fine.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If I run the while loop in an interrupt context it will not work, and the code will get stuck in the while loop as described by Globuloz.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you confirm whether or not the code runs in main context?&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: printf with UART - blocking way?</title><link>https://devzone.nordicsemi.com/thread/146766?ContentTypeID=1</link><pubDate>Fri, 31 Aug 2018 12:31:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f5c04d7-927b-4374-aa50-097fd800106b</guid><dc:creator>studzinski</dc:creator><description>&lt;p&gt;We are still waiting for a fix&amp;nbsp; &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: printf with UART - blocking way?</title><link>https://devzone.nordicsemi.com/thread/114867?ContentTypeID=1</link><pubDate>Mon, 22 Jan 2018 12:34:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7a9f13e-938d-4670-af75-5582c45af423</guid><dc:creator>studzinski</dc:creator><description>&lt;p&gt;nRF51, SDK11. UART fifo init. I resolved this problem with estimated delay (vs. message size&amp;amp;baudrate) and larger FIFO size (515 bytes). Unfortunately I have already removed this control sequence.
Obviously no event has fired when FIFO was empty. The event handler was well initiated in uart_init function. I will reestablish sequences &amp;amp; zip the project soon...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: printf with UART - blocking way?</title><link>https://devzone.nordicsemi.com/thread/114869?ContentTypeID=1</link><pubDate>Mon, 22 Jan 2018 11:34:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cddad990-3a44-47b6-92c0-1da20b18beeb</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Which SDK version are you using?&lt;/p&gt;
&lt;p&gt;Could you zip your project and share it, so I can have a look at the code?&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: printf with UART - blocking way?</title><link>https://devzone.nordicsemi.com/thread/114868?ContentTypeID=1</link><pubDate>Sun, 21 Jan 2018 14:19:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:756e3cdc-40ef-4d25-9c1d-8188f206194f</guid><dc:creator>studzinski</dc:creator><description>&lt;p&gt;I confirm. This loop never ends. Unfortunately, it seems that this event never files in case of UART fifo initialisation. Cannot find a workarond since months!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: printf with UART - blocking way?</title><link>https://devzone.nordicsemi.com/thread/114866?ContentTypeID=1</link><pubDate>Tue, 03 May 2016 11:52:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1706d043-2e7c-4247-bd1c-8565a03daccf</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Can you attach the code so I can have a look at it?
If yes, please just zip your project and attach it to the case.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: printf with UART - blocking way?</title><link>https://devzone.nordicsemi.com/thread/114865?ContentTypeID=1</link><pubDate>Mon, 02 May 2016 16:06:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:174288d8-4c45-44bd-b3f8-0488d457b7da</guid><dc:creator>Globuloz</dc:creator><description>&lt;p&gt;Thank you for reply!   I&amp;#39;ve tested the code and it seems that it is an infinite loop.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: printf with UART - blocking way?</title><link>https://devzone.nordicsemi.com/thread/114864?ContentTypeID=1</link><pubDate>Mon, 02 May 2016 11:48:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0dafa177-a6a9-4bde-a3db-cc52140cc70b</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;The app_uart library returns an event when the TX buffer is empty, and you can wait for this event to make the library appear blocking:&lt;/p&gt;
&lt;p&gt;Pseudo code:&lt;/p&gt;
&lt;p&gt;// Declare variable&lt;br /&gt;
static volatile bool uart_tx_in_progress = false;&lt;/p&gt;
&lt;p&gt;// Write to the uart&lt;br /&gt;
uart_tx_in_progress = true;&lt;br /&gt;
app_uart_put(...);&lt;br /&gt;
while(uart_tx_in_progress);&lt;/p&gt;
&lt;p&gt;// Excerpt from UART event handler&lt;br /&gt;
if(p_event-&amp;gt;evt_type == APP_UART_TX_EMPTY)&lt;br /&gt;
{&lt;br /&gt;
uart_tx_in_progress = false;&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;Regards
Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>