<?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 get NRF52840 into deep sleep while power supply is low?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70684/how-to-get-nrf52840-into-deep-sleep-while-power-supply-is-low</link><description>Chip: NRF52840 
 Firmware platform: Wirepas V5 
 
 Hello! 
 I am now writing firmware for a product based on HW&amp;amp;SW mentioned above. 
 It is powered by battery and sends data periodically. 
 I want to halt or deep-sleep the chip after detecting the supply</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 22 Jan 2021 03:08:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70684/how-to-get-nrf52840-into-deep-sleep-while-power-supply-is-low" /><item><title>RE: How to get NRF52840 into deep sleep while power supply is low?</title><link>https://devzone.nordicsemi.com/thread/290634?ContentTypeID=1</link><pubDate>Fri, 22 Jan 2021 03:08:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f30f0fd-0d71-450a-8bd7-3abedcbdde70</guid><dc:creator>Sealedfire</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your suggestion!&lt;/p&gt;
&lt;p&gt;I just got suggestion from Wirepas support of the appropriate APIs.&lt;/p&gt;
&lt;p&gt;You&amp;#39;re right, Wirepas stack takes whole control of the power management and requires application must call functions from Wirepas SDK.&lt;/p&gt;
&lt;p&gt;I have found the graceful way to deep-sleep it.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks a lot for your help!&lt;/p&gt;
&lt;p&gt;Good day!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;DanielDuan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get NRF52840 into deep sleep while power supply is low?</title><link>https://devzone.nordicsemi.com/thread/290633?ContentTypeID=1</link><pubDate>Fri, 22 Jan 2021 03:03:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14053c3b-bbca-4dd0-9c78-cf23d1a8274b</guid><dc:creator>Sealedfire</dc:creator><description>&lt;p&gt;Hi Shaney,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Don&amp;#39;t worry man, I already got feedback from Wirepas support.&lt;/p&gt;
&lt;p&gt;Thanks and have a good day!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;DanielDuan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get NRF52840 into deep sleep while power supply is low?</title><link>https://devzone.nordicsemi.com/thread/290451?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2021 10:25:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53304f2e-e4e3-43aa-9e08-c650b7af6174</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Daniel,&lt;/p&gt;
&lt;p&gt;I guess you would have to check with the authors of the Wirepas stack to make sure that you don&amp;#39;t break anything by entering system off at the wrong time. Check whether there are some graceful shutdown considerations you need to take. I am not familiar with Wirepas, but based on a quick Google search, it looks like some sort of (Bluetooth?) Mesh stack.&lt;/p&gt;
&lt;p&gt;So I guess it holds some network information that may or may not need to be stored in flash before entering system off.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;However, there is an API to enter system off, found in nrf_power.h in NCS:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;__STATIC_INLINE void nrf_power_system_off(void)
{
    NRF_POWER-&amp;gt;SYSTEMOFF = POWER_SYSTEMOFF_SYSTEMOFF_Enter;
    __DSB();

    /* Solution for simulated System OFF in debug mode */
    while (true)
    {
        __WFE();
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You can check out the implementation of nrf_power_system_off. It tells you the address of the system off register, which you can also find &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/power.html?cp=4_0_0_4_2_6#unique_1094298747"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get NRF52840 into deep sleep while power supply is low?</title><link>https://devzone.nordicsemi.com/thread/290392?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2021 06:23:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75473d66-acf9-4ff4-9d50-3edc879cc14b</guid><dc:creator>Shaney</dc:creator><description>&lt;p&gt;Ah I see sorry that I couldn&amp;#39;t be of any more help. I hope you find a solution to your problem. &lt;br /&gt;&lt;br /&gt;Have good one!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get NRF52840 into deep sleep while power supply is low?</title><link>https://devzone.nordicsemi.com/thread/290382?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2021 04:17:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:34c0768f-c875-4114-b79b-c51b7ef793d3</guid><dc:creator>Sealedfire</dc:creator><description>&lt;p&gt;Hi Shaney,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your suggestion!&lt;/p&gt;
&lt;p&gt;Sorry I can&amp;#39;t implement this since the Wirepas stack takes control of related registers and no APIs to share with application.&lt;/p&gt;
&lt;p&gt;I also asked them for suggestion, seems the best way is to turn off the radio part, and I am waiting for their suggestion.&lt;/p&gt;
&lt;p&gt;Anyway I really appreciate your immediate help.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks and best regards!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;DanielDuan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get NRF52840 into deep sleep while power supply is low?</title><link>https://devzone.nordicsemi.com/thread/290117?ContentTypeID=1</link><pubDate>Wed, 20 Jan 2021 06:01:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e67345b-768f-4488-bf0a-e504ab7989de</guid><dc:creator>Shaney</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;I&amp;#39;ve done something similar and I used the ADC &lt;a href="https://docs.zephyrproject.org/latest/reference/peripherals/adc.html#adc"&gt;https://docs.zephyrproject.org/latest/reference/peripherals/adc.html#adc&lt;/a&gt; to measure the battery levels and then I forced the system in to deep sleep when the sampled value where lower than a threshold.&lt;br /&gt;&lt;br /&gt;Putting the system to deep sleep can be done by first enabling it in your Kconfig file using:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_SYS_POWER_DEEP_SLEEP_STATES=y
CONFIG_SYS_PM_STATE_LOCK=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And then using&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;sys_pm_force_power_state(SYS_POWER_STATE_DEEP_SLEEP_1);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;To put the system in deep sleep.&lt;/p&gt;
&lt;p&gt;To avoid the system shutting down on its own when you have long idle time I suggest disabling automatic deep sleep first thing you do using&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt; sys_pm_ctrl_disable_state(SYS_POWER_STATE_DEEP_SLEEP_1);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;These functions can be found in power/power.h.&lt;/p&gt;
&lt;p&gt;Before you enter deep sleep, ensure that you have enabled any of the peripherals that can wake the system from deep sleep, otherwise it will sleep forever or until the power dips so low that the system resets.&lt;/p&gt;
&lt;p&gt;You can wake the system with these methods:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/power.html?cp=4_0_0_4_2_2#unique_1384365742"&gt;https://infocenter.nordicsemi.com/topic/ps_nrf52840/power.html?cp=4_0_0_4_2_2#unique_1384365742&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Hope it&amp;#39;ll help you get started.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>