<?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>NRF9160 power off and wake up</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/88229/nrf9160-power-off-and-wake-up</link><description>Hello, this is a follow up on this ticket: https://devzone.nordicsemi.com/f/nordic-q-a/84834/protecting-the-battery-via-sleep-mode 
 Our goal is to switch off the device (based on nrf9160) when battery voltage is under a threshold and wake it up (reboot</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 02 Jun 2022 12:30:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/88229/nrf9160-power-off-and-wake-up" /><item><title>RE: NRF9160 power off and wake up</title><link>https://devzone.nordicsemi.com/thread/370693?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2022 12:30:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8eb3f3f6-314a-4154-b8c4-38a6b87d443b</guid><dc:creator>Elfving</dc:creator><description>[quote user="XavierN"]&lt;p&gt;We have been testing a bit from our side, it seems like the shutdown left the system in an inconsistent state because sometimes, after shutdown, it woke up upon cable connection but sometimes didn&amp;#39;t.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;Yeah that might be correct. When turning off the modem, it will start off by disconnecting from the network. This might take some time, potentially 5 seconds if that is what you&amp;#39;ve arrived at. During this time it won&amp;#39;t be able to go into system OFF - and won&amp;#39;t be able to wake up either. So I don&amp;#39;t think it is in an inconsistent state per se, just not in&amp;nbsp;&lt;span&gt;PM_STATE_SOFT_OFF. I believe the modem can give a callback when it completed, but I am not sure about this.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Btw, is the USB power connected to the GPIO, or VDD line which is additionally connected to USB power? Ie., does the GPIO pin you use for wake-up jump from 3V to 5V when you connect USB?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9160 power off and wake up</title><link>https://devzone.nordicsemi.com/thread/370185?ContentTypeID=1</link><pubDate>Tue, 31 May 2022 11:34:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af511f42-82ae-4cd8-afba-eb24af8d8cdd</guid><dc:creator>XavierN</dc:creator><description>&lt;p&gt;I see.&lt;/p&gt;
&lt;p&gt;We have been testing a bit from our side, it seems like the shutdown left the system in an inconsistent state because sometimes, after shutdown, it woke up upon cable connection but sometimes didn&amp;#39;t.&lt;/p&gt;
&lt;p&gt;In the end what worked for us is to shut down the modem before and to give it some time to shutdown, these is the shutdown sequence that we are using right now and seems to be wor&lt;code&gt;king fine:&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrf_gpio_cfg_input(POWER_DETECTION_GPIO_PIN, NRF_GPIO_PIN_NOPULL);&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrf_gpio_cfg_sense_set(POWER_DETECTION_GPIO_PIN, NRF_GPIO_PIN_SENSE_HIGH);&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOG_INF(&amp;quot;Batterylow, about to sleep&amp;quot;);&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/code&gt;&lt;code&gt;LOG_INF(&amp;quot;Power off modem&amp;quot;);&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lte_lc_offline();&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lte_lc_power_off();&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; k_sleep(K_SECONDS(5)); //We need to give the modem time to shut down&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOG_INF(&amp;quot;Power off DEVICE&amp;quot;);&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pm_power_state_force(0u, (struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0});&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; k_sleep(K_SECONDS(5)); //Trigger the shutdown by sleeping&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;With this sequence we do get a system shutdown and a reliable wake up upon usb cable connection (which is connected to a GPIO).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9160 power off and wake up</title><link>https://devzone.nordicsemi.com/thread/370174?ContentTypeID=1</link><pubDate>Tue, 31 May 2022 11:04:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89c61a6b-3f69-460d-a1cd-0ef1d495cf40</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hello again,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When it comes to checking the voltage in order to enter sleep mode, the best way to proceed depends on if you are using a regulator or not. If you aren&amp;#39;t, you can measure the voltage using the &lt;a href="https://infocenter.nordicsemi.com/topic/ref_at_commands/REF/at_commands/mob_termination_ctrl_status/xvbat.html"&gt;%XVBAT&lt;/a&gt;&amp;nbsp;command.&amp;nbsp;If you are using a regulator, you would have to create a voltage divider and measure that lower voltage using the ADC. (Its common to then use a mosfet along with the voltage divider, to stop too much current being wasted).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The wake-up is a bit harder, as you need to notice the increased voltage in order to reboot. For this you would have to create an additional external circuit that can create a jump to a logical one, and feed that to the GPIO.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9160 power off and wake up</title><link>https://devzone.nordicsemi.com/thread/370020?ContentTypeID=1</link><pubDate>Mon, 30 May 2022 14:07:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b531fa9a-f8b5-4dc0-a054-d92dbf08aca2</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hello again Xavier,&lt;/p&gt;
&lt;p&gt;Nice testing!&lt;/p&gt;
[quote user=""]In the example we were given, we find nowhere how to link the input event to a &amp;quot;wake up callback&amp;quot;[/quote]
&lt;p&gt;Right,&amp;nbsp;when using the lowest power state&amp;nbsp;&amp;quot;&lt;span&gt;PM_STATE_SOFT_OFF&amp;quot; there is no need for it.&amp;nbsp;The contents of system(CPU and memory) will not be preserved, so the system will be restarted as if from an initial power-up and kernel boot either way.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you&amp;#39;d want a wake-up callback you could always&amp;nbsp;go for another power state, but I got the impression that you wanted to do a reboot either way? &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/zephyr/samples/boards/nrf/system_off/README.html"&gt;The documentation on the sample&lt;/a&gt; offers some more info on eg. RAM retention, in case that is relevant for you.&lt;/span&gt;&lt;/p&gt;
[quote user=""]&lt;p&gt;Our question is, how to instruct the device to wake up or reboot upon input activation?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;I will have to get back to you on this, as I&amp;nbsp;have some concerns here.&lt;/p&gt;
&lt;p&gt;Btw, what NCS version are you using?&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;Elfving&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9160 power off and wake up</title><link>https://devzone.nordicsemi.com/thread/369571?ContentTypeID=1</link><pubDate>Wed, 25 May 2022 14:11:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03f6e97c-19d2-4da1-9b2e-7d1fb748b8f2</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hello Xavier,&lt;/p&gt;
&lt;p&gt;I will have to get back to you next week, due to the upcoming holiday.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>