<?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 do I power off the UART</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/94834/how-do-i-power-off-the-uart</link><description>I have a nRF9160 board that is running off batteries. I need to conserve power and I would like to power off the UART. In the field I do not need any printouts or listening to keystrokes. How do I completely power off the UART? There will not be a terminal</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 17 Dec 2022 15:49:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/94834/how-do-i-power-off-the-uart" /><item><title>RE: How do I power off the UART</title><link>https://devzone.nordicsemi.com/thread/401138?ContentTypeID=1</link><pubDate>Sat, 17 Dec 2022 15:49:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73756641-5a28-454e-8956-7019e3590606</guid><dc:creator>Achim Kraus</dc:creator><description>&lt;p&gt;&amp;gt; &lt;span&gt;you can close this ticket.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m an other user, it&amp;#39;s up to you to click &amp;quot;Verify Answer&amp;quot; ;-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I power off the UART</title><link>https://devzone.nordicsemi.com/thread/400866?ContentTypeID=1</link><pubDate>Thu, 15 Dec 2022 14:06:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea2e4fd0-c4bd-49bf-8fb6-f0e598d971b8</guid><dc:creator>Timothy</dc:creator><description>&lt;p&gt;Achim&lt;/p&gt;
&lt;p&gt;I used the second method with CONFIG_SERIAL=y and&amp;nbsp;&lt;span&gt;pm_device_state_set(uart_dev,PM_DEVICE_STATE_OFF); it does disable the UARt and does not crash. The production application continues to run. Thank you very much. you can close this ticket.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I power off the UART</title><link>https://devzone.nordicsemi.com/thread/400704?ContentTypeID=1</link><pubDate>Wed, 14 Dec 2022 17:27:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d65001b1-3c7b-423b-93ab-ee6c893086e0</guid><dc:creator>Achim Kraus</dc:creator><description>&lt;p&gt;Hm, not sure, maybe it was somehow mixed up:&lt;/p&gt;
&lt;p&gt;If &amp;quot;&lt;span&gt;CONFIG_SERIAL=n&amp;quot; is used, then you don&amp;#39;t need the &amp;quot;power_manager&amp;quot; stuff.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So the part:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;#if 1&lt;br /&gt;/*Option 3: by chosen node*/&lt;br /&gt;#define MY_SERIAL DT_CHOSEN(zephyr_console)&lt;br /&gt; const struct device *uart_dev = device_get_binding(DT_LABEL(MY_SERIAL));&lt;br /&gt; pm_device_state_set(uart_dev,PM_DEVICE_STATE_OFF); &lt;br /&gt;#endif&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;must/may be switched off by &amp;quot;#if 0&amp;quot;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;If &amp;quot;&lt;span&gt;CONFIG_SERIAL=y&amp;quot; is used, then you may use the &amp;quot;power_manager&amp;quot; stuff. But don&amp;#39;t call &amp;quot;pm_device_state_set(uart_dev,PM_DEVICE_STATE_OFF);&amp;quot; unconditional. I would always guard that with &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;if (device_is_ready(uart_dev)) {&lt;br /&gt;&amp;nbsp; pm_device_state_set(uart_dev,PM_DEVICE_STATE_OFF);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;that doesn&amp;#39;t crash, even if &amp;quot;uart_dev&amp;quot; is NULL.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I power off the UART</title><link>https://devzone.nordicsemi.com/thread/400693?ContentTypeID=1</link><pubDate>Wed, 14 Dec 2022 16:31:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38ddabf1-5f1f-4d23-8fac-dedf73d2ffce</guid><dc:creator>Timothy</dc:creator><description>&lt;p&gt;Achim&lt;/p&gt;
&lt;p&gt;if I put this at the start of main&lt;/p&gt;
&lt;p&gt;void main(void)&lt;br /&gt;{&lt;br /&gt; int err;&lt;/p&gt;
&lt;p&gt;#if 1&lt;br /&gt;/*Option 3: by chosen node*/&lt;br /&gt;#define MY_SERIAL DT_CHOSEN(zephyr_console)&lt;br /&gt; const struct device *uart_dev = device_get_binding(DT_LABEL(MY_SERIAL));&lt;br /&gt; pm_device_state_set(uart_dev,PM_DEVICE_STATE_OFF); &lt;br /&gt;#endif&lt;br /&gt; LOG_INF(&amp;quot;asset_tracker AWS V2 WSSC Started&amp;quot;);&lt;/p&gt;
&lt;p&gt;*******************************&lt;/p&gt;
&lt;p&gt;I get the following repeated. I am not able to upgrade to a later version. There is a lot of customer and device driver code that would have to be ported.. so a lot of the printout is disabled but it is not running my program. it is just continually rebooting.&lt;/p&gt;
&lt;p&gt;I: Boot source: none&lt;br /&gt;I: Swap type: none&lt;br /&gt;I: Bootloader chainload address offset: 0x10000&lt;br /&gt;I: Starting bootloadert image slot&lt;br /&gt;I: Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x1&lt;br /&gt;I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3&lt;br /&gt;I: Boot source: none&lt;br /&gt;I: Swap type: none&lt;br /&gt;I: Bootloader chainload address offset: 0x10000&lt;br /&gt;I: Starting bootloadert image slot&lt;br /&gt;I: Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x1&lt;br /&gt;I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3&lt;br /&gt;I: Boot source: none&lt;br /&gt;I: Swap type: none&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I power off the UART</title><link>https://devzone.nordicsemi.com/thread/400687?ContentTypeID=1</link><pubDate>Wed, 14 Dec 2022 15:52:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3423895-9d9f-4ea6-9274-a9bd83a448e4</guid><dc:creator>Achim Kraus</dc:creator><description>&lt;p&gt;&amp;gt; v2.6.99-ncs1&lt;/p&gt;
&lt;p&gt;I use NCS 2.1.2 with v3.1.99-ncs1-1. I&amp;#39;m not sure, what that older version offers.&lt;/p&gt;
&lt;p&gt;&amp;gt; &lt;span&gt;CONFIG_SERIAL=n&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I guess your code access that device &amp;quot;unconditional&amp;quot;.&lt;/p&gt;
&lt;p&gt;&amp;gt; ../src/jfet_files/jfet_init.c: fatal error: power_manager.h: No such file or directory&lt;/p&gt;
&lt;p&gt;I guess, that requires a newer version, e.g. NCS 2.1.2&lt;/p&gt;
&lt;p&gt;Anyway, for a fast solution without update to NCS 2.1.2, I would recommend, that you try one of the samples, e.g. blinky with &lt;span&gt;CONFIG_SERIAL=n and see, if that works. Or the nrf9160 udp sample.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If so, the try to find, where your code access the uart.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If the blinky doesn&amp;#39;t work, then I&amp;#39;m not sure, if that&amp;#39;s related to OS version.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I power off the UART</title><link>https://devzone.nordicsemi.com/thread/400662?ContentTypeID=1</link><pubDate>Wed, 14 Dec 2022 14:37:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6bf37b7-9751-4f77-8638-74bb6c9c0d0e</guid><dc:creator>Timothy</dc:creator><description>&lt;p&gt;Achim - I tried the static method by setting &lt;span&gt;CONFIG_SERIAL=n in prj.conf&amp;nbsp;&lt;/span&gt;and I got the following repeatedly.&lt;/p&gt;
&lt;p&gt;*** Booting Zephyr OS build v2.6.99-ncs1 ***&lt;br /&gt;I: Starting bootloader&lt;br /&gt;I: Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x1&lt;br /&gt;I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3&lt;br /&gt;I: Boot source: none&lt;br /&gt;I: Swap type: none&lt;br /&gt;I: Bootloader chainload address offset: 0x10000&lt;br /&gt;*** Booting Zephyr OS build v2.6.99-ncs1 ***&lt;br /&gt;I: Starting bootloader&lt;br /&gt;I: Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x1&lt;br /&gt;I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3&lt;br /&gt;I: Boot source: none&lt;br /&gt;I: Swap type: none&lt;br /&gt;I: Bootloader chainload address offset: 0x10000&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I tried the dynamic message and I got the following message&lt;/p&gt;
&lt;p&gt;../src/jfet_files/jfet_init.c: fatal error: power_manager.h: No such file or directory&lt;/p&gt;
&lt;p&gt;any idea what I am missing or doing wrong in either case?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I power off the UART</title><link>https://devzone.nordicsemi.com/thread/400567?ContentTypeID=1</link><pubDate>Wed, 14 Dec 2022 10:15:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da3b9130-311c-4ec1-bb5a-ddb21fc7c881</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Timothy&lt;/p&gt;
&lt;p&gt;I agree with the suggestions from Achim.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For further reading &lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/optimizing-power-on-nrf53-designs"&gt;this blog&lt;/a&gt; has a lot of good input on power management in general. It is targeted for nRF5340 designs specifically, but a lot of the information in the blog will be relevant for other devices as well.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I power off the UART</title><link>https://devzone.nordicsemi.com/thread/400533?ContentTypeID=1</link><pubDate>Wed, 14 Dec 2022 08:45:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b85efad7-7b22-480b-9b98-c9ecffe70c1d</guid><dc:creator>Achim Kraus</dc:creator><description>&lt;p&gt;AFAIK, there are two ways:&lt;/p&gt;
&lt;p&gt;static:&lt;/p&gt;
&lt;p&gt;- CONFIG_SERIAL=n&lt;/p&gt;
&lt;p&gt;dynamic:&lt;/p&gt;
&lt;p&gt;- CONFIG_PM_DEVICE=y&lt;/p&gt;
&lt;div style="background-color:#ffffff;color:#000000;font-family:&amp;#39;Droid Sans Mono&amp;#39;, &amp;#39;monospace&amp;#39;, monospace;font-size:14px;font-weight:normal;line-height:19px;white-space:pre;"&gt;
&lt;div style="background-color:#ffffff;color:#000000;font-family:&amp;#39;Droid Sans Mono&amp;#39;, &amp;#39;monospace&amp;#39;, monospace;font-size:14px;font-weight:normal;line-height:19px;white-space:pre;"&gt;
&lt;div&gt;&lt;span style="color:#808080;"&gt;#include&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#e21f1f;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;power_manager.h&lt;/span&gt;&lt;span style="color:#e21f1f;"&gt;&amp;quot;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style="background-color:#ffffff;color:#000000;font-family:&amp;#39;Droid Sans Mono&amp;#39;, &amp;#39;monospace&amp;#39;, monospace;font-size:14px;font-weight:normal;line-height:19px;white-space:pre;"&gt;
&lt;div style="background-color:#ffffff;color:#000000;font-family:&amp;#39;Droid Sans Mono&amp;#39;, &amp;#39;monospace&amp;#39;, monospace;font-size:14px;font-weight:normal;line-height:19px;white-space:pre;"&gt;
&lt;div&gt;&lt;span style="color:#0000ff;"&gt;static&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;const&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;struct&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;device&lt;/span&gt;&lt;span style="color:#000000;"&gt; *&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;const&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;uart0_dev&lt;/span&gt;&lt;span style="color:#000000;"&gt; = &lt;/span&gt;&lt;span style="color:#8a1bff;"&gt;DEVICE_DT_GET_OR_NULL&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#8a1bff;"&gt;DT_CHOSEN&lt;/span&gt;&lt;span style="color:#000000;"&gt;(zephyr_console));&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style="background-color:#ffffff;color:#000000;font-family:&amp;#39;Droid Sans Mono&amp;#39;, &amp;#39;monospace&amp;#39;, monospace;font-size:14px;font-weight:normal;line-height:19px;white-space:pre;"&gt;
&lt;div style="background-color:#ffffff;color:#000000;font-family:&amp;#39;Droid Sans Mono&amp;#39;, &amp;#39;monospace&amp;#39;, monospace;font-size:14px;font-weight:normal;line-height:19px;white-space:pre;"&gt;
&lt;div&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#8f08c4;"&gt;if&lt;/span&gt;&lt;span style="color:#000000;"&gt; (&lt;/span&gt;&lt;span style="color:#74531f;"&gt;device_is_ready&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#000000;"&gt;uart0_dev&lt;/span&gt;&lt;span style="color:#000000;"&gt;)&lt;/span&gt;&lt;span style="color:#808080;"&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#1f377f;"&gt;ret&lt;/span&gt;&lt;span style="color:#000000;"&gt; = &lt;/span&gt;&lt;span style="color:#74531f;"&gt;pm_device_action_run&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#000000;"&gt;uart0_dev&lt;/span&gt;&lt;span style="color:#000000;"&gt;, &lt;/span&gt;&lt;span style="color:#000000;"&gt;PM_DEVICE_ACTION_SUSPEND&lt;/span&gt;&lt;span style="color:#000000;"&gt;);&lt;/span&gt;
&lt;div&gt;}&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style="background-color:#ffffff;color:#000000;font-family:&amp;#39;Droid Sans Mono&amp;#39;, &amp;#39;monospace&amp;#39;, monospace;font-size:14px;font-weight:normal;line-height:19px;white-space:pre;"&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>