<?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 to avoid TX current when connected UART device is POWERD OFF ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/101983/how-to-disable-and-enable-uart-at-runtime-to-avoid-tx-current-when-connected-uart-device-is-powerd-off</link><description>How to disable and enable UART on runtime to avoid TX current when connected UART device is POWERD OFF ? (NRF5340) 
 I am having separate power path switch for all sensors and different subsystem. 
 One sensor is UART based. If I turn OFF the sensor power</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 21 Jul 2023 11:14:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/101983/how-to-disable-and-enable-uart-at-runtime-to-avoid-tx-current-when-connected-uart-device-is-powerd-off" /><item><title>RE: How to disable and enable UART at runtime to avoid TX current when connected UART device is POWERD OFF ?</title><link>https://devzone.nordicsemi.com/thread/437639?ContentTypeID=1</link><pubDate>Fri, 21 Jul 2023 11:14:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00ac2ea0-1b86-4748-9cce-d74b0478af06</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again,&lt;br /&gt;&lt;br /&gt;I am glad to hear that you were able to achieve the lower power consumption!&lt;br /&gt;Using the power management module to disable the peripheral is also a good way to approach this.&lt;br /&gt;&lt;br /&gt;For the record, you can &lt;a href="https://docs.zephyrproject.org/apidoc/latest/group__subsys__pm__device.html#gaee5546eacb9be7caa9d59ab63926cc4c"&gt;use these predefined PM actions with the call to pm_device_action_run&lt;/a&gt;, instead of the &amp;#39;0&amp;#39; argument, for convenience, readability, and maintainability :)&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&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 to avoid TX current when connected UART device is POWERD OFF ?</title><link>https://devzone.nordicsemi.com/thread/437400?ContentTypeID=1</link><pubDate>Thu, 20 Jul 2023 07:31:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a1b0b37-5a74-4d79-9120-90fe56d5f3dd</guid><dc:creator>vinodsdw</dc:creator><description>&lt;p&gt;I tried to find such uninit functions but couldn&amp;#39;t find those.&lt;/p&gt;
&lt;p&gt;Instead I called the below function and those disabled the PORT and made the PINs are input floating.&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;pm_device_action_run&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;uart_dev1&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;pm_device_action_run&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;uart_dev2&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;pm_device_action_run&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;i2c&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;pm_device_action_run&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;spi&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;This reduced power consumption drastically and now able to achieve &amp;lt; 50uA with Bluetooth advertising.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable and enable UART at runtime to avoid TX current when connected UART device is POWERD OFF ?</title><link>https://devzone.nordicsemi.com/thread/437239?ContentTypeID=1</link><pubDate>Wed, 19 Jul 2023 12:04:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a30f254-27e1-4ee5-9cff-748fcfa84eec</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user="vinodsdw"]Now irrespective of the rtos sleep/idle, if I want to disable the sensor, I am turning OFF the sensor VDD by above mentioned method. Now if I turn off the sensor, then I need to immediately turn OFF the UART to INPUT mode to save current drawn via the TX pin.[/quote]
&lt;p&gt;Thank you for clarifying, you can achieve this using the uninit function which you can call at the same time you are cutting the power to the sensor.&lt;/p&gt;
[quote user="vinodsdw"]I will check the&amp;nbsp;&lt;span&gt;e&amp;nbsp;&lt;/span&gt;&lt;a href="https://github.com/NordicSemiconductor/nrfx/blob/98d6f433313a3d8dcf08dce25e744617b45aa913/drivers/include/nrfx_uart.h#L227"&gt;driver&amp;#39;s uninit function&lt;/a&gt;&lt;span&gt;&amp;nbsp; to see if I can disable and enable the driver in runtime.&lt;/span&gt;[/quote]
&lt;p&gt;Alright, let me know if you should encounter any other issues or questions when doing this! :)&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&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 to avoid TX current when connected UART device is POWERD OFF ?</title><link>https://devzone.nordicsemi.com/thread/437050?ContentTypeID=1</link><pubDate>Tue, 18 Jul 2023 13:53:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ff556fc-3cad-41f3-8a4a-cab776363434</guid><dc:creator>vinodsdw</dc:creator><description>&lt;p&gt;I mean I am using a GPIO to control the power (vdd) of external sensor by using P-Mosfet.&lt;/p&gt;
&lt;p&gt;Now irrespective of the rtos sleep/idle, if I want to disable the sensor, I am turning OFF the sensor VDD by above mentioned method. Now if I turn off the sensor, then I need to immediately turn OFF the UART to INPUT mode to save current drawn via the TX pin.&lt;/p&gt;
&lt;p&gt;I will check the&amp;nbsp;&lt;span&gt;e&amp;nbsp;&lt;/span&gt;&lt;a href="https://github.com/NordicSemiconductor/nrfx/blob/98d6f433313a3d8dcf08dce25e744617b45aa913/drivers/include/nrfx_uart.h#L227"&gt;driver&amp;#39;s uninit function&lt;/a&gt;&lt;span&gt;&amp;nbsp; to see if I can disable and enable the driver in runtime.&lt;/span&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 to avoid TX current when connected UART device is POWERD OFF ?</title><link>https://devzone.nordicsemi.com/thread/437030?ContentTypeID=1</link><pubDate>Tue, 18 Jul 2023 13:04:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8723eda7-05a9-4473-8475-63a14dd5219f</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]How to disable and enable UART on runtime to avoid TX current when connected UART device is POWERD OFF ? (NRF5340)[/quote]
&lt;p&gt;Do you here mean SYSTEM_ON sleep when you say POWERED OFF?&lt;br /&gt;In the case of SYSTEM_OFF sleep no peripherals will be enabled, and so the UART would not be contributing to any power leakage in this case.&lt;br /&gt;&lt;br /&gt;You can still use the &lt;a href="https://github.com/NordicSemiconductor/nrfx/blob/98d6f433313a3d8dcf08dce25e744617b45aa913/drivers/include/nrfx_uart.h#L227"&gt;driver&amp;#39;s uninit function&lt;/a&gt;&amp;nbsp;to uninit the driver at any time during runtime, and then use the corresponding init function again when you require the UART functionality, if this is what you are asking.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Please let me know and elaborate more on the desired behavior if this was not what you were asking about.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>