<?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>High Current Consumption when UART is configured with disable-rx flag and zephyr,pm-device-runtime-auto</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/122982/high-current-consumption-when-uart-is-configured-with-disable-rx-flag-and-zephyr-pm-device-runtime-auto</link><description>Hello, 
 We are currently using the nrf52840 for development using Zephyr v3.7.99-ncs1 . 
 We want to use the UART in low power mode and therefore, we have used the zephyr,pm-device-runtime-auto flag in the DTS uart configuration. Also, we want to have</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 22 Jul 2025 14:46:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/122982/high-current-consumption-when-uart-is-configured-with-disable-rx-flag-and-zephyr-pm-device-runtime-auto" /><item><title>RE: High Current Consumption when UART is configured with disable-rx flag and zephyr,pm-device-runtime-auto</title><link>https://devzone.nordicsemi.com/thread/543227?ContentTypeID=1</link><pubDate>Tue, 22 Jul 2025 14:46:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aeec5d86-e9dc-4757-8d34-0597a8d5377b</guid><dc:creator>Prodromos Kampas</dc:creator><description>&lt;p&gt;We are using the LOG() macros from zephyr I am not sure how we can use the code you suggest.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: High Current Consumption when UART is configured with disable-rx flag and zephyr,pm-device-runtime-auto</title><link>https://devzone.nordicsemi.com/thread/542761?ContentTypeID=1</link><pubDate>Thu, 17 Jul 2025 12:29:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5e1faf2-dd03-4b0d-a945-34c1bc1f50cf</guid><dc:creator>Prodromos Kampas</dc:creator><description>&lt;p&gt;The main problem we are dealing with is that without the use of the&amp;nbsp;&lt;strong&gt;disable-rx&lt;/strong&gt; flag the software crashes at some point, waiting indefinitely in the while loop in the&amp;nbsp;&lt;strong&gt;uart_nrfx_uarte.c&lt;/strong&gt; file, in the &lt;strong&gt;uarte_pm_suspend()&lt;/strong&gt; function.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If we use the&amp;nbsp;&lt;strong&gt;disable-rx&lt;/strong&gt; flag, the code is not stuck anymore in the following while loop but the current consumption is really high.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;while (!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXTO)) {
	/* Busy wait for event to register */
	Z_SPIN_DELAY(2);
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void uarte_pm_suspend(const struct device *dev)
{
	NRF_UARTE_Type *uarte = get_uarte_instance(dev);
	const struct uarte_nrfx_config *cfg = dev-&amp;gt;config;
	struct uarte_nrfx_data *data = dev-&amp;gt;data;

	(void)data;
#ifdef UARTE_ANY_ASYNC
	if (data-&amp;gt;async) {
		/* Entering inactive state requires device to be no
		 * active asynchronous calls.
		 */
		__ASSERT_NO_MSG(!data-&amp;gt;async-&amp;gt;rx.enabled);
		__ASSERT_NO_MSG(!data-&amp;gt;async-&amp;gt;tx.len);
		if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME)) {
			/* If runtime PM is enabled then reference counting ensures that
			 * suspend will not occur when TX is active.
			 */
			__ASSERT_NO_MSG(nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_TXSTOPPED));
		} else {
			wait_for_tx_stopped(dev);
		}

#if !defined(CONFIG_UART_NRFX_UARTE_ENHANCED_RX)
		if (data-&amp;gt;async &amp;amp;&amp;amp; HW_RX_COUNTING_ENABLED(cfg)) {
			nrfx_timer_disable(&amp;amp;cfg-&amp;gt;timer);
			/* Timer/counter value is reset when disabled. */
			data-&amp;gt;async-&amp;gt;rx.total_byte_cnt = 0;
			data-&amp;gt;async-&amp;gt;rx.total_user_byte_cnt = 0;
		}
#endif
	} else if (IS_ENABLED(UARTE_ANY_NONE_ASYNC))
#endif
	{
		if (nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXSTARTED)) {
#if defined(UARTE_INTERRUPT_DRIVEN) &amp;amp;&amp;amp; defined(CONFIG_PM_DEVICE)
			if (data-&amp;gt;int_driven) {
				data-&amp;gt;int_driven-&amp;gt;rx_irq_enabled =
					nrf_uarte_int_enable_check(uarte, NRF_UARTE_INT_ENDRX_MASK);
				if (data-&amp;gt;int_driven-&amp;gt;rx_irq_enabled) {
					nrf_uarte_int_disable(uarte, NRF_UARTE_INT_ENDRX_MASK);
				}
			}
#endif
			nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STOPRX);
			while (!nrf_uarte_event_check(uarte, NRF_UARTE_EVENT_RXTO)) {
				/* Busy wait for event to register */
				Z_SPIN_DELAY(2);
			}
			nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED);
			nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXTO);
			nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_ENDRX);
			nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_ERROR);
		}

		wait_for_tx_stopped(dev);
	}

#ifdef CONFIG_SOC_NRF54H20_GPD
	nrf_gpd_retain_pins_set(cfg-&amp;gt;pcfg, true);
#endif

	nrf_uarte_disable(uarte);

	(void)pinctrl_apply_state(cfg-&amp;gt;pcfg, PINCTRL_STATE_SLEEP);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: High Current Consumption when UART is configured with disable-rx flag and zephyr,pm-device-runtime-auto</title><link>https://devzone.nordicsemi.com/thread/542756?ContentTypeID=1</link><pubDate>Thu, 17 Jul 2025 12:01:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2e88179-8b9c-490f-a0dd-60064d510f45</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;It seems like the disable-rx is not doing what we expect it to do.&lt;/p&gt;
&lt;p&gt;Without disable-rx, the driver seems to leave the channel running&amp;nbsp;&lt;br /&gt;With disable-rx, the driver never queues RX so I think it never calls the power management plugs to shut down the hardware.&lt;/p&gt;
&lt;p&gt;I think the fix is here is to let the driver power off itself and then explicity turn off RX in your firmware. A template code can be like this.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;
static const struct device *uart0 = DEVICE_DT_GET(DT_NODELABEL(uart0));

void main(void)
{
    ...
    ...
    
    pm_device_runtime_enable(uart0);

    /* 
     * when you want to disable rx path
     */
    uart_rx_disable(uart0);
    pm_device_action_run(uart0, PM_DEVICE_ACTION_SUSPEND);

    ...
    ...
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;leave&amp;nbsp;zephyr,pm-device-runtime-auto; as is in your devicetree&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>