<?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>Minimizing the power draw using System OFF and RAM retention</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/40351/minimizing-the-power-draw-using-system-off-and-ram-retention</link><description>Hi everyone, I&amp;#39;m having an issue with the power draw of my application (SDK 15.0.0, SD 132 v6, Sparkfun nRF52832 Breakout). The application does roughly the following: it sleeps until it receives an GPIO interrupt (there are two different GPIOs which</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 14 Dec 2018 16:06:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/40351/minimizing-the-power-draw-using-system-off-and-ram-retention" /><item><title>RE: Minimizing the power draw using System OFF and RAM retention</title><link>https://devzone.nordicsemi.com/thread/161919?ContentTypeID=1</link><pubDate>Fri, 14 Dec 2018 16:06:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:132a4519-ea74-4d26-adaf-f74243ea33da</guid><dc:creator>lhochstetter</dc:creator><description>&lt;p&gt;Hi H&amp;aring;kon,&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;thanks for the link and hints!&lt;br /&gt;&lt;br /&gt;I&amp;#39;ll mark your &amp;#39;quick and dirty&amp;#39; solution as answer as it was quite helpful.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;lhochstetter&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Minimizing the power draw using System OFF and RAM retention</title><link>https://devzone.nordicsemi.com/thread/161153?ContentTypeID=1</link><pubDate>Tue, 11 Dec 2018 09:56:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d0f0a04-00a6-4ae0-88da-530130eee1ec</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;lhochstetter,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Glad to hear that it worked.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You do not need to set the &amp;quot;POWER_RAM_POWER_S1POWER_On&amp;quot; field, as it is already set (reset value is &amp;#39;1&amp;#39;).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regarding the .ld scripts and syntax, this is given by the toolchain:&amp;nbsp;&lt;a href="https://sourceware.org/binutils/docs/ld/Scripts.html"&gt;https://sourceware.org/binutils/docs/ld/Scripts.html&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You may find better ways of describing the linker scripts, I&amp;#39;d recommend&amp;nbsp;searching around and checking on stack overflow etc. to see if you can find any resources there.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kind regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Håkon&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Minimizing the power draw using System OFF and RAM retention</title><link>https://devzone.nordicsemi.com/thread/161069?ContentTypeID=1</link><pubDate>Mon, 10 Dec 2018 17:06:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3a98148-168e-4597-bc0f-236fb705914a</guid><dc:creator>lhochstetter</dc:creator><description>&lt;p&gt;Hi H&amp;aring;kon,&lt;/p&gt;
&lt;p&gt;it just works (tm)! Thank you!&lt;br /&gt;&lt;br /&gt;I took a closer look at your .ld and .c files and noticed some differences:&lt;br /&gt;&lt;br /&gt;In the .ld file you &amp;quot;included&amp;quot; the no_init declaration in the section which was to be &amp;quot;inserted after .text&amp;quot; (if I understand the .ld file correctly). I used the &amp;quot;spare&amp;quot; section at the very beginning without the &amp;quot;INSERT AFTER ...&amp;quot; command.&lt;br /&gt;&lt;br /&gt;I therefore suspect that my main issue was the no_init declaration at the wrong section.&lt;br /&gt;&lt;br /&gt;In the .c file / in the main function you &amp;quot;only enabled RAM retention&amp;quot; and did not touch the &amp;quot;POWER_RAM_POWER_S1POWER_On register&amp;quot; at all.&lt;br /&gt;&lt;br /&gt;One more question: could you provide me with a couple terms to research, so I can properly understand the .ld files syntax / notation?&lt;br /&gt;&lt;br /&gt;Thanks again!&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;lhochstetter&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Minimizing the power draw using System OFF and RAM retention</title><link>https://devzone.nordicsemi.com/thread/160892?ContentTypeID=1</link><pubDate>Mon, 10 Dec 2018 09:06:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba450e64-bdfe-43a3-8bd3-009312224fdf</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I integrated the previous example into ble_app_beacon (quick and dirty, my apologies), here&amp;#39;s the main file and linker file (SDK v15.2):&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-1b94bb42738746beb543b88f4d01df8f/ble_5F00_app_5F00_beacon_5F00_gcc_5F00_nrf52.ld"&gt;devzone.nordicsemi.com/.../ble_5F00_app_5F00_beacon_5F00_gcc_5F00_nrf52.ld&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-1b94bb42738746beb543b88f4d01df8f/main.c"&gt;devzone.nordicsemi.com/.../main.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I didn&amp;#39;t have any problems running this code, it loops through the LEDs like it should. Could you try this and see if that works?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Minimizing the power draw using System OFF and RAM retention</title><link>https://devzone.nordicsemi.com/thread/160864?ContentTypeID=1</link><pubDate>Mon, 10 Dec 2018 03:55:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e307e7b6-dacf-45f7-a02a-d4bec37f006f</guid><dc:creator>Bluesky</dc:creator><description>&lt;p&gt;Hi wpaul,&lt;/p&gt;
&lt;p&gt;Do you mean I connect to OpenOCD for debugging? Actually my problem is to find out how to get the current draw from the nrf52832 to be 0.7uA when it is in SYSTEM OFF. But I can only get 1.7uA when I flash the code above into it.&lt;/p&gt;
&lt;p&gt;Thank you very much!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Minimizing the power draw using System OFF and RAM retention</title><link>https://devzone.nordicsemi.com/thread/160801?ContentTypeID=1</link><pubDate>Fri, 07 Dec 2018 18:41:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f11d0b34-c3ad-497e-a0e7-9d53c28e66ed</guid><dc:creator>wpaul</dc:creator><description>&lt;p&gt;The nRF52840 board has integrated Segger J-Link debugger which is accessible via USB. The J-Link in turn talks to the 52840 chip via its Serial Wire Debug (SWD) pins. SWD is an ARM standard debug interface present on Cortex-M chips. This is how you flash the board, you can also use it to take control of the 52840 CPU and dump its memory, control its execution of code. You can use OpenOCD to connect to the J-Link interface and then use gdb to set breakpoints and single step the CPU one line or one instruction at a time, e.g.:&lt;/p&gt;
&lt;p&gt;(gdb) target remote localhost:3333 # connect to OpenOCD running on local machine&lt;/p&gt;
&lt;p&gt;(gdb) monitor reset init # reset CPU&lt;/p&gt;
&lt;p&gt;(gdb) break main&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # set breakpoint at main()&lt;/p&gt;
&lt;p&gt;(gdb) continue&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # let the CPU run&lt;/p&gt;
&lt;p&gt;&amp;lt;target continues, until it hits main&amp;gt;&lt;/p&gt;
&lt;p&gt;(gdb) step&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # step one line&lt;/p&gt;
&lt;p&gt;(gdb) stepi &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # step one instruction&lt;/p&gt;
&lt;p&gt;(gdb) info registers&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # examine machine state&lt;/p&gt;
&lt;p&gt;(etc...)&lt;/p&gt;
&lt;p&gt;It sounds like system off mode won&amp;#39;t work as long as the SWD interface on the CPU is in use, which means you have to let the CPU run without GDB connected in order to test it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Minimizing the power draw using System OFF and RAM retention</title><link>https://devzone.nordicsemi.com/thread/160796?ContentTypeID=1</link><pubDate>Fri, 07 Dec 2018 17:31:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d32ffe6d-b886-46d3-b51f-cba22c67a0b1</guid><dc:creator>lhochstetter</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;thanks for the link, I tried to merge your example (the gcc one) with mine, but sadly it didn&amp;#39;t work out i.e. the value was not retained. Again I&amp;#39;m trying to only save the second slave of the 7th RAM tile.&lt;br /&gt;&lt;br /&gt;Code snippets:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint32_t j __attribute__((section(&amp;quot;.no_init&amp;quot;))) __attribute__((used));

int main(void)
{
	// Initialize.
	gpio_init();
	ble_stack_init();

	sd_power_ram_power_set(7, (POWER_RAM_POWER_S1POWER_On &amp;lt;&amp;lt; POWER_RAM_POWER_S1POWER_Pos)
		                | (POWER_RAM_POWER_S1RETENTION_On &amp;lt;&amp;lt; POWER_RAM_POWER_S1RETENTION_Pos));

	if (0 == nrf_gpio_pin_read(BSP_BUTTON_0)) {
		nrf_drv_gpiote_out_clear(BSP_LED_0);
	}

	if (3 == j) {
		nrf_drv_gpiote_out_clear(BSP_LED_2);
		j = 0;
	}

	j++;
	nrf_delay_ms(1000);
	nrf_drv_gpiote_out_set(BSP_LED_0);
	nrf_drv_gpiote_out_set(BSP_LED_2);
	sd_power_system_off();

	for(;;) {
		idle_state_handle();
	}

}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;My linker file (based on the original ble_app_beacon) which I tied to merge with the linker file provided in your example.&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;/* Linker script to configure memory regions. */

SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)

MEMORY
{
  FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0x5a000
  RAM (rwx) :  ORIGIN = 0x200018a8, LENGTH = 0xd758
  NO_INIT (rwx) :  ORIGIN = 0x2000F000, LENGTH = 0x1000
}

SECTIONS
{
  .no_init (NOLOAD):
  {
    PROVIDE(__start_no_init_data = .);
	KEEP(*(SORT(.no_init*)))
	PROVIDE(__stop_no_init_data = .);
  } &amp;gt; NO_INIT
}

SECTIONS
{
  . = ALIGN(4);
  .mem_section_dummy_ram :
  {
  }
  .log_dynamic_data :
  {
    PROVIDE(__start_log_dynamic_data = .);
    KEEP(*(SORT(.log_dynamic_data*)))
    PROVIDE(__stop_log_dynamic_data = .);
  } &amp;gt; RAM
  .cli_sorted_cmd_ptrs :
  {
    PROVIDE(__start_cli_sorted_cmd_ptrs = .);
    KEEP(*(.cli_sorted_cmd_ptrs))
    PROVIDE(__stop_cli_sorted_cmd_ptrs = .);
  } &amp;gt; RAM
  .fs_data :
  {
    PROVIDE(__start_fs_data = .);
    KEEP(*(.fs_data))
    PROVIDE(__stop_fs_data = .);
  } &amp;gt; RAM

} INSERT AFTER .data;

SECTIONS
{
  .mem_section_dummy_rom :
  {
  }
  .sdh_soc_observers :
  {
    PROVIDE(__start_sdh_soc_observers = .);
    KEEP(*(SORT(.sdh_soc_observers*)))
    PROVIDE(__stop_sdh_soc_observers = .);
  } &amp;gt; FLASH
  .sdh_ble_observers :
  {
    PROVIDE(__start_sdh_ble_observers = .);
    KEEP(*(SORT(.sdh_ble_observers*)))
    PROVIDE(__stop_sdh_ble_observers = .);
  } &amp;gt; FLASH
  .pwr_mgmt_data :
  {
    PROVIDE(__start_pwr_mgmt_data = .);
    KEEP(*(SORT(.pwr_mgmt_data*)))
    PROVIDE(__stop_pwr_mgmt_data = .);
  } &amp;gt; FLASH
  .log_const_data :
  {
    PROVIDE(__start_log_const_data = .);
    KEEP(*(SORT(.log_const_data*)))
    PROVIDE(__stop_log_const_data = .);
  } &amp;gt; FLASH
    .nrf_balloc :
  {
    PROVIDE(__start_nrf_balloc = .);
    KEEP(*(.nrf_balloc))
    PROVIDE(__stop_nrf_balloc = .);
  } &amp;gt; FLASH
  .sdh_state_observers :
  {
    PROVIDE(__start_sdh_state_observers = .);
    KEEP(*(SORT(.sdh_state_observers*)))
    PROVIDE(__stop_sdh_state_observers = .);
  } &amp;gt; FLASH
  .sdh_stack_observers :
  {
    PROVIDE(__start_sdh_stack_observers = .);
    KEEP(*(SORT(.sdh_stack_observers*)))
    PROVIDE(__stop_sdh_stack_observers = .);
  } &amp;gt; FLASH
  .sdh_req_observers :
  {
    PROVIDE(__start_sdh_req_observers = .);
    KEEP(*(SORT(.sdh_req_observers*)))
    PROVIDE(__stop_sdh_req_observers = .);
  } &amp;gt; FLASH
    .nrf_queue :
  {
    PROVIDE(__start_nrf_queue = .);
    KEEP(*(.nrf_queue))
    PROVIDE(__stop_nrf_queue = .);
  } &amp;gt; FLASH
    .cli_command :
  {
    PROVIDE(__start_cli_command = .);
    KEEP(*(.cli_command))
    PROVIDE(__stop_cli_command = .);
  } &amp;gt; FLASH
  .crypto_data :
  {
    PROVIDE(__start_crypto_data = .);
    KEEP(*(SORT(.crypto_data*)))
    PROVIDE(__stop_crypto_data = .);
  } &amp;gt; FLASH

} INSERT AFTER .text

INCLUDE &amp;quot;nrf_common.ld&amp;quot;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Sorry for making you basically hold my hand but I&amp;#39;m fairly ignorant when it comes to the SDK and how things work / are compiled ... is there by chance an introduction / tutorial which explains the SDK structure etc. ? (I&amp;#39;m also at a loss when it comes to tracking down function definitions etc.)&lt;br /&gt;&lt;br /&gt;I tried to compile your example but it kept complaining, that some files where missing - the ../../config directory does not seem to be in the .zip. I&amp;#39;m also guessing that your example was written with an older SDK version as system_nrf52.c seems to have changed places.&lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;&lt;br /&gt;lhochstetter&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Minimizing the power draw using System OFF and RAM retention</title><link>https://devzone.nordicsemi.com/thread/160525?ContentTypeID=1</link><pubDate>Thu, 06 Dec 2018 09:40:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d7a4df0-3d69-4c61-81f7-c73b8ae8da4f</guid><dc:creator>Bluesky</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;H&amp;aring;kon,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;What do you mean &amp;quot;&lt;span&gt;single-stepping through your code&lt;/span&gt;&amp;quot;?&lt;/p&gt;
&lt;p&gt;my code is just as simple as below:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;quot;boards.h&amp;quot;

/**
* @brief Function for application main entry.
*/
int main(void)
{
NRF_POWER-&amp;gt;SYSTEMOFF = 1;
}
/** @} */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So am I in the debug mode?&lt;/p&gt;
&lt;p&gt;Thanks &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Minimizing the power draw using System OFF and RAM retention</title><link>https://devzone.nordicsemi.com/thread/160523?ContentTypeID=1</link><pubDate>Thu, 06 Dec 2018 09:33:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b786ba1-4474-438e-882d-0224c6d7bb17</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;By debugging, I mean that you actively entered &amp;quot;debug mode&amp;quot; through your IDE and single-stepping through your code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Minimizing the power draw using System OFF and RAM retention</title><link>https://devzone.nordicsemi.com/thread/160486?ContentTypeID=1</link><pubDate>Thu, 06 Dec 2018 02:25:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31186a05-4980-4dcc-a695-d892e856c95b</guid><dc:creator>Bluesky</dc:creator><description>&lt;p&gt;Hi, I would ask what do you mean by &amp;quot;&lt;span&gt;Are you debugging while trying to enter system off mode?&amp;quot;. Do you mean connect your board with an usb to pc? if I unplug the board with the usb, is this mean I am not in the debug mode?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Minimizing the power draw using System OFF and RAM retention</title><link>https://devzone.nordicsemi.com/thread/160441?ContentTypeID=1</link><pubDate>Wed, 05 Dec 2018 15:47:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97a90150-9004-43dc-ba30-17e204e8ac9e</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="lhochstetter"]Another question in the very same project popped up: I&amp;#39;m seeing 15-20mV spikes in intervals of around 45ms when advertising / when sd_app_evt_wait() is running.[/quote]
&lt;p&gt;These are due to the regulator refresh mode:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/20121/periodic-current-during-waiting-event"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/20121/periodic-current-during-waiting-event&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I assume you&amp;#39;re using a 10 ohm resistor (1.5 to 2 mA) to monitor the current.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="lhochstetter"]However, RAM retention doesn&amp;#39;t (again using above shown snippets). I&amp;#39;m trying to retain the entire RAM of the nRF52832, but it seems that my for loop doesn&amp;#39;t do it&amp;#39;s job. I tried to only set the 7th RAM tile (both sections) but to no avail.&lt;br /&gt;&lt;br /&gt;What am I missing?[/quote]
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Pointing to a specific address is not a recommended approach, as you do not know if there&amp;#39;s anything there already, like the .stack or .heap section. See this thread and the linked threads for more information on ram retention after system off:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/36848/nrf52840-ram-retention-example-fails-with-max_test_iterations-1"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/36848/nrf52840-ram-retention-example-fails-with-max_test_iterations-1&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Minimizing the power draw using System OFF and RAM retention</title><link>https://devzone.nordicsemi.com/thread/160236?ContentTypeID=1</link><pubDate>Tue, 04 Dec 2018 14:57:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e2735ab-3d8b-48f2-bb08-c45459a90191</guid><dc:creator>lhochstetter</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;waking up from Sytem OFF using following snippets works just fine, thanks alot!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void gpio_init(void)
{
	ret_code_t err_code;

	err_code = nrf_drv_gpiote_init();
	APP_ERROR_CHECK(err_code);

	nrf_drv_gpiote_out_config_t out_config = GPIOTE_CONFIG_OUT_SIMPLE(true);
	err_code = nrf_drv_gpiote_out_init(BSP_LED_0, &amp;amp;out_config);

	APP_ERROR_CHECK(err_code);
	err_code = nrf_drv_gpiote_out_init(BSP_LED_2, &amp;amp;out_config);

	nrf_gpio_cfg_sense_input(BSP_BUTTON_0, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void main()
{
	uint32_t j = ((uint32_t *) (0x2000F000))[0];

	// Initialize.
	gpio_init();
	ble_stack_init();
    for (int i = 0; i &amp;lt; 8; i++) {
    	sd_power_ram_power_set(i,
    		                  (POWER_RAM_POWER_S0POWER_On &amp;lt;&amp;lt; POWER_RAM_POWER_S0POWER_Pos)
    		                | (POWER_RAM_POWER_S1POWER_On &amp;lt;&amp;lt; POWER_RAM_POWER_S1POWER_Pos)
    		                | (POWER_RAM_POWER_S0RETENTION_On &amp;lt;&amp;lt; POWER_RAM_POWER_S0RETENTION_Pos)
    		                | (POWER_RAM_POWER_S1RETENTION_On &amp;lt;&amp;lt; POWER_RAM_POWER_S1RETENTION_Pos));
    }
	if (0 == nrf_gpio_pin_read(BSP_BUTTON_0)) {
		nrf_drv_gpiote_out_clear(BSP_LED_0);
	}

	if (3 == j) {
		nrf_drv_gpiote_out_clear(BSP_LED_2);
		j = 0;
	}

	j++;
	((uint32_t *) (0x2000F000))[0] = j;

	nrf_delay_ms(1000);

	nrf_drv_gpiote_out_set(BSP_LED_0);
	nrf_drv_gpiote_out_set(BSP_LED_2);

	sd_power_system_off();


	for(;;) {
		sd_app_evt_wait();
	}
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;However, RAM retention doesn&amp;#39;t (again using above shown snippets). I&amp;#39;m trying to retain the entire RAM of the nRF52832, but it seems that my for loop doesn&amp;#39;t do it&amp;#39;s job. I tried to only set the 7th RAM tile (both sections) but to no avail.&lt;br /&gt;&lt;br /&gt;What am I missing?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Another question in the very same project popped up: I&amp;#39;m seeing 15-20mV spikes in intervals of around 45ms when advertising / when sd_app_evt_wait() is running.&lt;br /&gt;&lt;br /&gt;Could it be that some scanning related code is running in the background / softdevice in between advertisements? (I&amp;#39;ve largely adapted the ble_peripheral / ble_app_beacon example, but I&amp;#39;d argue that the scanning functionality isn&amp;#39;t configured / started).&lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;&lt;br /&gt;lhochstetter&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Minimizing the power draw using System OFF and RAM retention</title><link>https://devzone.nordicsemi.com/thread/159956?ContentTypeID=1</link><pubDate>Mon, 03 Dec 2018 12:50:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f041872b-136c-4126-94d9-0cf1b145f790</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Systemoff will generate a reset when you wake up, so the simplest logic is to check your GPIOs upon init, or reading the NRF_GPIO-&amp;gt;LATCH register:&lt;pre class="ui-code" data-mode="c_cpp"&gt;gpio_init();
// Check the GPIO states to see which one is still active
if (nrf_gpio_pin_read(my_pin) == ACTIVE_LEVEL) {
    do_something();
}

// Alternative is to read NRF_GPIO-&amp;gt;LATCH register.
// See http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/gpio.html#register.LATCH
// Write &amp;#39;1&amp;#39; to bitfields in register to clear it.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="lhochstetter"]When I use this snippet the system freezes up again and the voltage rises to a couple hundred mV (without I measure &amp;lt;20 mV when idling). Judging by the existance of the &lt;em&gt;sd_power_ram_power_*()&lt;/em&gt; functions I assume that you have to use those to configure RAM retention but my attempts so far failed.[/quote]
&lt;p&gt;&amp;nbsp;When the softdevice is enabled, you shall not write directly to the NRF_POWER register, as this will create a fault-condition. You should rather use the sd_ prefixed function call. You can write the exact same bit pattern into the sd_power_ram_power_* function as you would to the NRF_POWER-&amp;gt;RAMON register.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Minimizing the power draw using System OFF and RAM retention</title><link>https://devzone.nordicsemi.com/thread/159763?ContentTypeID=1</link><pubDate>Fri, 30 Nov 2018 16:18:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:193f411b-5dbb-4e7a-b00c-11eabf5c2e3d</guid><dc:creator>lhochstetter</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;thanks for the input, going to System OFF and waking up to the GPIO interrupts works!&lt;br /&gt;&lt;br /&gt;The remaining issues are the RAM retention and the &amp;quot;GPIO detection&amp;quot; (i.e. which GPIO is responsible for the interrupt).&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;I tried to adapt the approach taken in the &lt;em&gt;ble_app_pwr_profiling&lt;/em&gt; example, namely bsp_board_button_state_get(...) but to no avail.&lt;br /&gt;&lt;br /&gt;I would like to also connect an ISR to the GPIO interrupt if it takes place while the system is active / not in System OFF (I guess that I&amp;#39;ll have to do the (ISR) configuration each time the system wakes up again).&amp;nbsp; Therefore I&amp;#39;ve configured the GPIOs like so:&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(false);
in_config.pull = NRF_GPIO_PIN_PULLUP;
err_code = nrf_drv_gpiote_in_init(BSP_BUTTON_0, &amp;amp;in_config, button_handler);
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_event_enable(BSP_BUTTON_0, true);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;How do I determine which GPIO woke up the system?&lt;br /&gt;&lt;br /&gt;---&lt;br /&gt;&lt;br /&gt;I tried to merge my current code with the &lt;em&gt;peripheral / ram_retention &lt;/em&gt;example:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    NRF_POWER-&amp;gt;RAMON |= (POWER_RAMON_OFFRAM0_RAM0On &amp;lt;&amp;lt; POWER_RAMON_OFFRAM0_Pos) |
                        (POWER_RAMON_OFFRAM1_RAM1On &amp;lt;&amp;lt; POWER_RAMON_OFFRAM1_Pos);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;When I use this snippet the system freezes up again and the voltage rises to a couple hundred mV (without I measure &amp;lt;20 mV when idling). Judging by the existance of the &lt;em&gt;sd_power_ram_power_*()&lt;/em&gt; functions I assume that you have to use those to configure RAM retention but my attempts so far failed.&lt;br /&gt;&lt;br /&gt;From what I have gathered I may have to adapt the .ld file and add something like no_init memory sections.&lt;br /&gt;&lt;br /&gt;Am I on the right way / are there any &amp;quot;more elaborate&amp;quot; examples regarding RAM retention with the S132 softdevice present?&lt;br /&gt;&lt;br /&gt;Kind regards,&lt;br /&gt;&lt;br /&gt;lhochstetter&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Minimizing the power draw using System OFF and RAM retention</title><link>https://devzone.nordicsemi.com/thread/159387?ContentTypeID=1</link><pubDate>Wed, 28 Nov 2018 10:26:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e297656b-9aa1-4378-9a51-8fadbcd43211</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1 mA is too high. it should be ~1 uA in system off, given that there&amp;#39;s no LEDs or similar that is on in sleep. Your GPIOs are latched when entering sleep mode, so it is important that you set these to a defined level, or disconnect them in firmware (setting NRF_GPIO-&amp;gt;PIN_CNF[] field &amp;quot;CONNECT&amp;quot; to 0).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You could add system off to any example, after a given time/event has occurred (per your application requirement).&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s an example for a active low button:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;nrf_gpio_cfg_sense_input(MY_PIN, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
err_code = sd_power_system_off();
APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Minimizing the power draw using System OFF and RAM retention</title><link>https://devzone.nordicsemi.com/thread/159225?ContentTypeID=1</link><pubDate>Tue, 27 Nov 2018 12:51:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a760c02-bbff-4567-9813-e90bda50f409</guid><dc:creator>lhochstetter</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;sorry for the belated reply. I tried your suggestion (the board did go to some sort of power saving mode, drawing ~1mA but was unresponsive afterwards).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I spent some time studying the ble_app_pwr_profiling example. In the example two functions are used to go to the System OFF mode:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;sd_power_system_off()&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Since sd_power_system_off() is used in the ble_evt_handler() I assume that this function is used when the Softdevice is / was active. nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF) is used otherwise.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Right now I&amp;#39;m trying to gut the ble_app_pwr_profiling example to get a simple non-connectable beacon which reacts to button presses, advertising the button pressed and the count of button presses, and returning to System OFF afterwards.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;EDIT&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not debugging / There is no debugger attached&lt;/p&gt;
&lt;p&gt;/EDIT&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best,&lt;/p&gt;
&lt;p&gt;lhochstetter&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Minimizing the power draw using System OFF and RAM retention</title><link>https://devzone.nordicsemi.com/thread/156896?ContentTypeID=1</link><pubDate>Mon, 12 Nov 2018 13:46:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:399388ac-2976-4d03-94d9-c9ee18df0585</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you are using the nrf_pwr_mgmt library, you should call the appropriate API for entering system off mode:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF);&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Are you debugging while trying to enter system off mode? Emulated systemoff (entering system off in debug mode) will not work as intended, as it will return immediately due to the debugger being attached.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Kind regards,&lt;/div&gt;
&lt;div&gt;Håkon&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>