<?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>How to disable and enable UART at runtime?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/55675/how-to-disable-and-enable-uart-at-runtime</link><description>I want to disable and enable UART at runtime. I don&amp;#39;t use DMA and interrupt. 
 I read this thread. https://devzone.nordicsemi.com/f/nordic-q-a/52496/nrf9160-uart-pull-up-and-power-consumption/216096#216096 
 I tried this code but doesn&amp;#39;t work. Any help</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 07 Jan 2020 14:30:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/55675/how-to-disable-and-enable-uart-at-runtime" /><item><title>RE: How to disable and enable UART at runtime?</title><link>https://devzone.nordicsemi.com/thread/227929?ContentTypeID=1</link><pubDate>Tue, 07 Jan 2020 14:30:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4aaaead7-28b6-40cb-b3d9-9876616ade46</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hi Yusuke,&lt;/p&gt;
&lt;p&gt;Wouldn&amp;#39;t it make more sense to have the two lines at the end of disable_uart?&lt;/p&gt;
&lt;p&gt;e.g.&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;void disable_uart(){	
	NRF_UARTE3-&amp;gt;TASKS_STOPRX=1;
	while(NRF_UARTE3-&amp;gt;EVENTS_RXTO == 0);
	NRF_UARTE3-&amp;gt;EVENTS_RXTO = 0;

	NRF_UARTE3-&amp;gt;TASKS_STOPTX = 1;
	while(NRF_UARTE3-&amp;gt;EVENTS_TXSTOPPED == 0);
	NRF_UARTE3-&amp;gt;EVENTS_TXSTOPPED = 0;

	NRF_UARTE3-&amp;gt;ENABLE = 0;
	NRF_UARTE3-&amp;gt;PSEL.TXD = 0xFFFFFFFF;
    NRF_P0_NS-&amp;gt;OUTCLR = (1 &amp;lt;&amp;lt; TXD_PIN); // TXD_PIN = 24
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Martin L.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable and enable UART at runtime?</title><link>https://devzone.nordicsemi.com/thread/226539?ContentTypeID=1</link><pubDate>Fri, 20 Dec 2019 11:45:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e6abea4-41ac-4acb-b4ea-3b87f48c0bf9</guid><dc:creator>Yusuke</dc:creator><description>&lt;p&gt;This works out.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void enable_uart(){
	NRF_UARTE3-&amp;gt;ENABLE = 8;
	NRF_UARTE3-&amp;gt;TASKS_STARTTX = 1;
	NRF_UARTE3-&amp;gt;TASKS_STARTRX = 1;
}

void disable_uart(){	
	NRF_UARTE3-&amp;gt;TASKS_STOPRX=1;
	while(NRF_UARTE3-&amp;gt;EVENTS_RXTO == 0);
	NRF_UARTE3-&amp;gt;EVENTS_RXTO = 0;

	NRF_UARTE3-&amp;gt;TASKS_STOPTX = 1;
	while(NRF_UARTE3-&amp;gt;EVENTS_TXSTOPPED == 0);
	NRF_UARTE3-&amp;gt;EVENTS_TXSTOPPED = 0;

	NRF_UARTE3-&amp;gt;ENABLE = 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;However, when I add these lines to the above disable_uart, it fails. Why?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    NRF_UARTE3-&amp;gt;PSEL.TXD = 0xFFFFFFFF;
    NRF_P0_NS-&amp;gt;OUTCLR = (1 &amp;lt;&amp;lt; TXD_PIN); // TXD_PIN = 24&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable and enable UART at runtime?</title><link>https://devzone.nordicsemi.com/thread/226119?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 11:26:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c080f8e2-4b29-4654-b47e-b88cc1e42364</guid><dc:creator>Martin Lesund</dc:creator><description>&lt;p&gt;Hi Yusuke,&lt;/p&gt;
&lt;p&gt;Have you tried one of the other UARTS instead, like in the thread you linked to?&lt;br /&gt;&lt;br /&gt;Do you have a logic analyzer to actually connect to the pins appointed to the UART pins?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>