<?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>nRF_LOG UART draws ~300uA</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/24397/nrf_log-uart-draws-300ua</link><description>Hello All, 
 I&amp;#39;m trying to get my application based on a nRF52832 to use as less power as possible and I&amp;#39;ve noticed that when the nRF_LOG UART is enabled it draws around 300 micro amps in SYSTEM ON with sd_app_evt_wait(). When I disable the nRF_LOG UART</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 18 Aug 2017 07:53:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/24397/nrf_log-uart-draws-300ua" /><item><title>RE: nRF_LOG UART draws ~300uA</title><link>https://devzone.nordicsemi.com/thread/96075?ContentTypeID=1</link><pubDate>Fri, 18 Aug 2017 07:53:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9bf84b8-b4c6-4271-acbd-63b3f24c728a</guid><dc:creator>Radiohead</dc:creator><description>&lt;p&gt;Thank you for your reply Stian. However this fix isn&amp;#39;t working for me with SDK13.1.0. I&amp;#39;ve tried with both NRF_UART0-&amp;gt;TASKS_STOPTX and the m_uart variable in the uart_event_handler within nrf_log_backend_serial.c as shown below:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; #if (NRF_LOG_BACKEND_SERIAL_USES_UART)
static void uart_event_handler(nrf_drv_uart_event_t * p_event, void * p_context)
{
    // Dummy handler since is_busy feature is used for determining readiness.
    if (p_event-&amp;gt;type == NRF_DRV_UART_EVT_RX_DONE)
    {
        m_rx_done = true;
    }
		
		if (p_event-&amp;gt;type == NRF_DRV_UART_EVT_TX_DONE)
		{
			//NRF_UART0-&amp;gt;TASKS_STOPTX = 1;
			//m_uart.reg.p_uart-&amp;gt;TASKS_STOPTX = 1;		
		}
}
#endif //NRF_LOG_BACKEND_SERIAL_USES_UART
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;While debugging the event is called and the TASK_STOPTX is executed, but power consumption remains ~300uA. When I disable the NRF_LOG_BACKEND_SERIAL_USES_UART, the power consumption drop to a few uA.&lt;/p&gt;
&lt;p&gt;My while loop is as following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    while (true)
{	
				/* Handle the Application statemachine each time the nRF52832 wakes-up. */
				ApplicationStatemachine();
			
				// When the NRF LOG has been processed, go to a low power mode to conserve energy. The nRF will wake up on interrupt of anything; RTC, timers, SPI transfers, etc.
				if (NRF_LOG_PROCESS() == false)
    {
      power_manage();
    }		
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF_LOG UART draws ~300uA</title><link>https://devzone.nordicsemi.com/thread/96074?ContentTypeID=1</link><pubDate>Thu, 17 Aug 2017 18:27:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f9d5ba6-2cd2-454f-a8c6-805276ec58e0</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;The UART it self does not draw 300uA while it&amp;#39;s not in TX/RX mode. So, this seems to be an issue with how the log module works together with the nrf_drv_uart driver.&lt;/p&gt;
&lt;p&gt;I noticed that the &lt;code&gt;TASKS_STOPTX&lt;/code&gt; task is never called after the logging module is finished transmitting the buffer. I tried adding the following code to the &lt;code&gt;uart_event_handler()&lt;/code&gt; in &lt;strong&gt;nrf_log_backend_serial.c&lt;/strong&gt;, and the current was reduced to normal idle current:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if (p_event-&amp;gt;type == NRF_DRV_UART_EVT_TX_DONE)
{
    NRF_UART0-&amp;gt;TASKS_STOPTX = 1;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I have not tested this thoroughly, but it seems to work, so you can try it as well. I will report the issue internally so it will be fixed in future SDK releases. I tried this on SDK 13.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>