<?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>Zephyr nRF52840 device crashes when turning off UART with device_set_power_state(uart, DEVICE_PM_OFF_STATE, NULL, NULL)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68599/zephyr-nrf52840-device-crashes-when-turning-off-uart-with-device_set_power_state-uart-device_pm_off_state-null-null</link><description>Hello, 
 we need to disable UART0 to achieve low power operation of our device. This is done by running: 
 
 This works correctly on a minimal example when building using default devicetree for nrf52840dk. 
 But it crashes when we use our custom device</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 24 Nov 2020 12:08:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68599/zephyr-nrf52840-device-crashes-when-turning-off-uart-with-device_set_power_state-uart-device_pm_off_state-null-null" /><item><title>RE: Zephyr nRF52840 device crashes when turning off UART with device_set_power_state(uart, DEVICE_PM_OFF_STATE, NULL, NULL)</title><link>https://devzone.nordicsemi.com/thread/281533?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 12:08:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6194215a-52d4-46cd-a417-94cef983a783</guid><dc:creator>Vid</dc:creator><description>&lt;p&gt;We managed to disable UART at boot with the following code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uart_irq_rx_disable(uart);

NRF_UARTE0-&amp;gt;TASKS_STOPTX = 1;
NRF_UARTE0-&amp;gt;EVENTS_RXTO = 0;
NRF_UARTE0-&amp;gt;TASKS_STOPRX = 1;
while(NRF_UARTE0-&amp;gt;EVENTS_RXTO == 0){}
NRF_UARTE0-&amp;gt;EVENTS_RXTO = 0;
// disable whole UART 0 interface
NRF_UARTE0-&amp;gt;ENABLE = 0;

NRF_UARTE0-&amp;gt;PSEL.TXD = 0xFFFFFFFF;
NRF_UARTE0-&amp;gt;PSEL.RXD = 0xFFFFFFFF;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;we re-enable it when needed with:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uart_irq_rx_enable(uart)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The solution was proposed &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/64641/trying-to-shut-down-uart-on-52840-running-zephyr"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Vid&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr nRF52840 device crashes when turning off UART with device_set_power_state(uart, DEVICE_PM_OFF_STATE, NULL, NULL)</title><link>https://devzone.nordicsemi.com/thread/281501?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 10:38:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c83af71-98a9-4bc5-9db0-78fa582df298</guid><dc:creator>Vid</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;we couldn&amp;#39;t disable uart0 completely, because we still use it to connect to device over BLE. So we want to be able to disable at boot, enable it when we need it and then disable it again.&lt;/p&gt;
&lt;p&gt;In the meantime we have already found a solution, I&amp;#39;ll post it below.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Vid&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr nRF52840 device crashes when turning off UART with device_set_power_state(uart, DEVICE_PM_OFF_STATE, NULL, NULL)</title><link>https://devzone.nordicsemi.com/thread/281125?ContentTypeID=1</link><pubDate>Fri, 20 Nov 2020 13:46:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b7dfe09-6cb3-4680-acf0-6582638d37e6</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi Vid,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Try to disable uart0 in the&amp;nbsp;&lt;/span&gt;&lt;strong&gt;nrf52840dk_nrf52840.overlay&lt;/strong&gt;&lt;span&gt;&amp;nbsp;to the project root folder which completely disables the UART0 peripheral:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;&amp;amp;uart0 {
   status = &amp;quot;disabled&amp;quot;;
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You might have to clean/delete the build folder before recompiling.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;-Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>