<?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>Powering down RAM sections increases current</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/20512/powering-down-ram-sections-increases-current</link><description>Hi,
I am trying to measure (and reduce) the current consumption of my board. I am using nrf52832 (64K RAM) for my development. The RAM layout is as follows: RAM (rwx) : ORIGIN = 0x20002080, LENGTH = 0x2EA8. Stack is 2048 and heap is 1024 bytes. Total</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 16 Mar 2017 16:09:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/20512/powering-down-ram-sections-increases-current" /><item><title>RE: Powering down RAM sections increases current</title><link>https://devzone.nordicsemi.com/thread/79976?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2017 16:09:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68ba35b9-0d83-4e44-9c97-0ed126d96651</guid><dc:creator>SUK</dc:creator><description>&lt;p&gt;Changing the for loop location solved my problem. The current is now in uA.
Thank you so much for helping out Stian and Wojtek.&lt;/p&gt;
&lt;p&gt;SUK&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Powering down RAM sections increases current</title><link>https://devzone.nordicsemi.com/thread/79974?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2017 15:53:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e7177bd-2a2c-46c2-bd55-028544a4acfc</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Please see my updated answer. You only have to  use the POWERCLR register.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Powering down RAM sections increases current</title><link>https://devzone.nordicsemi.com/thread/79973?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2017 14:55:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:106c7fc4-8437-4fb3-bcdf-fd518a91981a</guid><dc:creator>SUK</dc:creator><description>&lt;p&gt;Yes I did. Same result. Infact, if I just power down section 4 of RAM, the current consumption has shot to 9 mA. Are these values correct:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_POWER-&amp;gt;RAM[4].POWER = 0;
NRF_POWER-&amp;gt;RAM[4].POWERCLR = 0x00030003;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Do I need to use both statements or either one is fine?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Powering down RAM sections increases current</title><link>https://devzone.nordicsemi.com/thread/79972?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2017 14:51:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2157801e-bf5c-4f02-ae97-3a15618d599a</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;It looks ok, did you rebuild (clean, build) whole project before trying?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Powering down RAM sections increases current</title><link>https://devzone.nordicsemi.com/thread/79980?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2017 14:50:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:343d11f9-dcb6-437f-91ac-8cb885579d03</guid><dc:creator>SUK</dc:creator><description>&lt;p&gt;If I don&amp;#39;t power down any of the RAM sections, my current consumption is around 2 micro Amps. This is very confusing. Except for the softdevice, nothing is powered on in my code. Yes I am using GCC with Eclipse Mars.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Powering down RAM sections increases current</title><link>https://devzone.nordicsemi.com/thread/79979?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2017 14:48:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31f0ae51-bc0a-4118-b6b1-16e73826f299</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;sorry, didn&amp;#39;t see your last comment..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Powering down RAM sections increases current</title><link>https://devzone.nordicsemi.com/thread/79978?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2017 14:47:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8457b01-a438-4b8e-9224-b351e819adb6</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;How does your linker script look now? Are you using GCC? Are you sure it&amp;#39;s not the code itself that fails? If you set i = 4/5/6.. etc, the current consumption looks fine?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Powering down RAM sections increases current</title><link>https://devzone.nordicsemi.com/thread/79971?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2017 14:44:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79d7853a-f3ca-432e-af16-768a062e98b7</guid><dc:creator>SUK</dc:creator><description>&lt;p&gt;Please find below the memory configuration. The memory config is using section 7 of RAM to store non initialized RAM data. Hence I tried powering down sections from 3 to 6 keeping section 7 powered up. But still the same result.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    /* Linker script to configure memory regions. */

SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)

MEMORY
{
  FLASH (rx) : ORIGIN = 0x1c000, LENGTH = 0x58000
  RAM (rwx) :  ORIGIN = 0x20002080, LENGTH = 0x3000 
  
  /** Location of non initialized RAM. Non initialized RAM is used for exchanging bond information
   *  from application to bootloader when using buttonluss DFU OTA or exchanging bootloader version
	*	information from bootloader to application. 
   */
  NOINIT (rwx) :  ORIGIN = 0x2000FF80, LENGTH = 0x80
}

SECTIONS
{
  .fs_data :
  {
    PROVIDE(__start_fs_data = .);
    KEEP(*(.fs_data))
    PROVIDE(__stop_fs_data = .);
  } &amp;gt; RAM

  /* No init RAM section in bootloader. Used for app/boot information exchange. */
  .noinit(NOLOAD) :
  {

  } &amp;gt; NOINIT
} INSERT AFTER .data;

INCLUDE &amp;quot;nrf52_common.ld&amp;quot;
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Powering down RAM sections increases current</title><link>https://devzone.nordicsemi.com/thread/79970?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2017 14:39:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:085b9090-eeca-4e6e-84af-6ed91102a3b3</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;Pls post screen of your memory configuration.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Powering down RAM sections increases current</title><link>https://devzone.nordicsemi.com/thread/79977?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2017 14:29:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32446fde-cd00-4878-85dc-09d010ce134f</guid><dc:creator>SUK</dc:creator><description>&lt;p&gt;Hi Stian, Thank you for your reply. I have modified my code to power only 3 RAM sections and power down the remaining ones. But the current consumption is still high. Any ideas on that?
Thanks,
SUK&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Powering down RAM sections increases current</title><link>https://devzone.nordicsemi.com/thread/79969?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2017 14:28:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6ce7575-6e07-4222-986e-2e007a9ddd38</guid><dc:creator>SUK</dc:creator><description>&lt;p&gt;Hi Wojtek, Thank you for answering. I have modified my code to power down sections 3 to 7. But still my current consumption is in mA. Any ideas on that? I have attached the modified code below.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;int main(void)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;{
nrf_clock_lf_cfg_t clock_lf_cfg = {
.source        = NRF_CLOCK_LF_SRC_RC,
.rc_ctiv       = 16,
.rc_temp_ctiv  = 2,
.xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM};&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// Initialize the SoftDevice handler module.
SOFTDEVICE_HANDLER_INIT(&amp;amp;clock_lf_cfg, NULL);

for (uint8_t i = 3; i &amp;lt; 8; i++)
{
        NRF_POWER-&amp;gt;RAM[i].POWER = 0;
        NRF_POWER-&amp;gt;RAM[i].POWERCLR = 0x00030003;
}

sd_power_mode_set(NRF_POWER_MODE_LOWPWR);

while (true)
{
        sd_app_evt_wait();
}

return 0;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Thanks,
SUK&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Powering down RAM sections increases current</title><link>https://devzone.nordicsemi.com/thread/79975?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2017 12:13:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4fe0fc79-91dc-41ef-a5b6-0856624f700b</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure if I understand your calculations correctly, but anyways, RAM ORIGIN is where the application RAM starts after the Softdevice RAM, and then you have the size of the application RAM.&lt;/p&gt;
&lt;p&gt;So lets say you want to power 2 RAM sections. That equals 16k = 0x4000.&lt;/p&gt;
&lt;p&gt;RAM starts at 0x2000 0000&lt;br /&gt;
Softdevice ends at 0x2000 2080  (This depends on the SD configuration; using the numbers in your question)&lt;br /&gt;
Then you have 0x4000 - 0x2080 = 0x1F80 left for the application.&lt;/p&gt;
&lt;p&gt;So the values in the linker script should then be,&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;RAM (rwx) : ORIGIN = 0x20002080, LENGTH = 0x1F80
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;EDIT&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I ran your code and I got the same result. The problem is that you&amp;#39;re turning of RAM after the SOFTDEVICE_HANDLER_INIT(). There&amp;#39;s a protection mechanism in the SD. Move the for loop to the start of main() and you should be fine. Or you can use the SD call for turning of RAM, sd_power_ram_power_clr().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Powering down RAM sections increases current</title><link>https://devzone.nordicsemi.com/thread/79968?ContentTypeID=1</link><pubDate>Thu, 16 Mar 2017 11:47:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:83db07a1-62f9-49e4-8fb6-6f95580bd5cf</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;0x20002080 + 0x2EA8 = 0x20004F28.
So, You are using RAM0-2 blocks. RAM begins at 0x20000000, not 0x20002080. It is 0x20002080 because 0x2080 is reserved for SoftDevice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>