<?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 minimize power consumption during power failure while RTC is on</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/63790/how-to-minimize-power-consumption-during-power-failure-while-rtc-is-on</link><description>Hello, 
 I&amp;#39;d like to detect a power failure and keep the nRF52840 alive using for example a super capacitor. 
 From the hardware side, is it ok to just feed the nRF52840 through a diode to the pins VDDH and VDD with 3.3V and connect a super capacitor</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 19 Jul 2020 17:35:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/63790/how-to-minimize-power-consumption-during-power-failure-while-rtc-is-on" /><item><title>RE: How to minimize power consumption during power failure while RTC is on</title><link>https://devzone.nordicsemi.com/thread/260713?ContentTypeID=1</link><pubDate>Sun, 19 Jul 2020 17:35:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6629cd7-cbbc-448e-ab42-a102ecafdcf8</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]From the hardware side, is it ok to just feed the&amp;nbsp;&lt;span&gt;nRF52840 through a diode to the pins VDDH and VDD with 3.3V and connect&amp;nbsp;a super capacitor though a resistor?&lt;/span&gt;[/quote]
&lt;p&gt;In theory, yes. (Not sure why you need to connect it through a resistor?) But you will have to do some calculations and testing of course. &lt;/p&gt;
&lt;p&gt;One thing to be aware of is that if you cut the power to the rest of the circuit, the GPIOs on the nRF52 must not be set to high output voltage as you will most likely power the rest of the circuit through the GPIOs. Set all the GPIOs to disconnected input (0x2) to prevent leakage.&lt;/p&gt;
[quote user=""]From the software side when I detect the power failure signal, what steps do I have to take to minimize power consumption while RTC still runs?[/quote]
&lt;p&gt;In general, it is normal to keep the code in the lowest power state no matter if there is a power failure signal received or not. The softdevice examples in the SDK (which need the RTC to run) are already in the lowest power state between the BLE events. Of course there are some pitfalls you should be aware of, but my point is that these should be avoided in any application, regardless if it&amp;#39;s a lower power application or not. And the code in the SDK takes care of this already.&lt;/p&gt;
&lt;p&gt;Are you going to use the SDK and softdevice?&lt;/p&gt;
[quote user=""] I already read that I have to switch off all peripherals such as UART and RADIO and then use WFI/WFE instructions. [/quote]
&lt;p&gt;&amp;nbsp;Yes, it&amp;#39;s important to switch of any UART transmission. The RADIO is typically not controlled by the user, since you need a complex stack to operate the RADIO. This stack should already be power optimized (like the BLE softdevice).&lt;/p&gt;
&lt;p&gt;WFE should be called whenever the CPU is not doing any thing. The way you normally solve this is to put WFE in the main loop. And just use interrupts to do the different tasks. After the tasks are done, the chip returns to the WFE in the main loop. The softdevice and most of the code in the SDK are designed this way.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""]Do I have to change the POWER configuration, for example switch from DC/DC to LDO in REG1? [/quote]
&lt;p&gt;&amp;nbsp;No. The POWER peripheral/regulator is automatically controlled. You just enable (or not enable) DCDC, based on if your design has DCDC components or not, and the the regulator will automatically switch between ULP (Ultra Low Power) mode and DCDC/LDO&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]Does the CLOCK need some configuration to ensure the 64MHz clock is switched off?[/quote]
&lt;p&gt;No. The HF clock is automatically controlled. You can however start the HF crystal manually if you need a more accurate clock. And then the HF crystal has to be switched off manually again before entering sleep. But usually you just use the internal HF clock which is automatically controlled.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]Do I understand it correctly to use the&amp;nbsp;ION_RAMON_GPIOTEPORT mode form the Sleep table (System ON, full 256 kB RAM retention, wake on GPIOTE PORT event) and can even lower power consumption by retaining only some of the RAM.[/quote]
&lt;p&gt;You mention that you need the RTC to run, so then the correct number will be the ION_RAMON_RTC.&lt;/p&gt;
&lt;table border="1" cellpadding="4" cellspacing="0" frame="border" rules="all" summary=""&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="vertical-align:top;" colspan="1" headers="d4783e47" rowspan="1"&gt;I&lt;sub&gt;ON_RAMON_RTC&lt;/sub&gt;&lt;/td&gt;
&lt;td style="vertical-align:top;" colspan="1" headers="d4783e50" rowspan="1"&gt;
&lt;p&gt;System ON, full 256 kB RAM retention, wake on RTC (running from LFRC clock)&lt;/p&gt;
&lt;/td&gt;
&lt;td style="vertical-align:top;" colspan="1" headers="d4783e53" rowspan="1"&gt;&lt;/td&gt;
&lt;td style="vertical-align:top;" colspan="1" headers="d4783e56" rowspan="1"&gt;&lt;/td&gt;
&lt;td style="vertical-align:top;" colspan="1" headers="d4783e59" rowspan="1"&gt;&lt;/td&gt;
&lt;td style="vertical-align:top;" colspan="1" headers="d4783e63" rowspan="1"&gt;&lt;span&gt; &lt;/span&gt;&lt;/td&gt;
&lt;td style="vertical-align:top;" colspan="1" headers="d4783e66" rowspan="1"&gt;&lt;span&gt;3.16&lt;/span&gt;&lt;/td&gt;
&lt;td style="vertical-align:top;" colspan="1" headers="d4783e69" rowspan="1"&gt;&lt;span&gt; &lt;/span&gt;&lt;/td&gt;
&lt;td style="vertical-align:top;" colspan="1" headers="d4783e72" rowspan="1"&gt;µA&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;You can disable parts of the RAM if you want, but usually this is not something that is done during run-time. I would check how much RAM you need and then disable the blocks you don&amp;#39;t need in the beginning of main (and adjust the linker script accordingly).&lt;/p&gt;
&lt;p&gt;Just a final though. If the device is not going to be functional in this &amp;quot;power failure&amp;quot; mode anyways (because if you do anything it will run out of power), it&amp;#39;s maybe better to design the code so that it survives a power failure. I&amp;#39;m thinking about writing the critical configuration data to flash, and just load this data back when the device is reset. This way I think it&amp;#39;s more robust to failures in general. There might be other reset reasons than power failures.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>