<?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>Stuck waiting for UART event (pstorage)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/26696/stuck-waiting-for-uart-event-pstorage</link><description>I am developing firmware using S132 (SDK 11) for a custom board. 
 After performing Pstorage Update, if I do not wait for the callback from pstorage before continuing execution of firmware, then the firmware seems to stop executing for some reason which</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 10 Nov 2017 01:35:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/26696/stuck-waiting-for-uart-event-pstorage" /><item><title>RE: Stuck waiting for UART event (pstorage)</title><link>https://devzone.nordicsemi.com/thread/104992?ContentTypeID=1</link><pubDate>Fri, 10 Nov 2017 01:35:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8945d3d2-5093-4c0f-a729-5c53ccb7a573</guid><dc:creator>Marco</dc:creator><description>&lt;p&gt;Actually the previous solution generated the issue that often some letters were repeated twice in a row (even in situations when there was no problem in transmitting before). By doing additional tests, I came up with the following updated code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void simple_uart_put(uint8_t cr)
{
	int loop_cnt = 0;
    NRF_UART0-&amp;gt;TXD = (uint8_t)cr;

    while (NRF_UART0-&amp;gt;EVENTS_TXDRDY != 1)
    {
        // Wait for TXD data to be sent.

    	if (loop_cnt++ &amp;gt; 1000)
		{
			if(NRF_UART0-&amp;gt;EVENTS_ERROR)
			{
				if ((NRF_UART0-&amp;gt;TASKS_STARTTX != 1) &amp;amp;&amp;amp; (NRF_UART0-&amp;gt;TASKS_SUSPEND != 1))
				{
					NRF_UART0-&amp;gt;TASKS_STARTTX = 1;
					return;
				}
			}    
			loop_cnt = 0;
		}
    }

    NRF_UART0-&amp;gt;EVENTS_TXDRDY = 0;
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>