Save Power with RAM-Retention in sleep-mode

Hello,

To save power, I would like to deactivate parts of the RAM memory on the nRF52840. I have already looked at the System OFF example and the manual of the nrf52840.

According to the Memory Report, my firmware uses 32.39 kbytes of RAM. According to the manual, I now understand that RAM0-RAM7 are blocks with 2*4096 byte sections. So now, can I leave blocks RAM0 - RAM3 enabled and disable the blocks above (RAM4 - RAM8) and get the best savings, or do I have to do it differently?
Also, do I understand correctly that to disable, I use the following function?

nrf_power_rampower_mask_off(NRF_POWER, block, section_mask);
 
Or can I somehow disable all unused RAM blocks in the configuration?

Parents
  • So now, can I leave blocks RAM0 - RAM3 enabled and disable the blocks above (RAM4 - RAM8) and get the best savings, or do I have to do it differently?

    You got it right. Know the size of the RAM that is being used and keep that RAM enabled. Shut the power off for the rest of the RAM blocks.

    Also, do I understand correctly that to disable, I use the following function?

    If you  are still using nRF5SDK then using nrf_power_rampower_mask_off is the correct way to do it for every block you want to disable.

    If you are using nRF Connect SDK then you can have the retention configuration of the RAM set as shown here

  • Thanks for the Quick answer. So far I dealt with the System Off example, but this seems to be outdates than.
    And sorry, I use nRF Connect SDK in Version 2.3.0 on a Wuerth Proteus-3 / nRF52840. 
    My first thought after reading the retention system devicetree setup, is that following DT entry would reduce my amount of SRAM an only the initialized area would be powered.

    &sram0 {
    	reg = <0x20000000 DT_SIZE_K(33)>;
    };


    But the power consumption has not droped. At the moment I consume about 3,88uA in Sleep Mode. Can I disable the rest of SRAM to save more Power? 

  • Jonas, I am sorry. I misunderstood your requirement. 

    If your goal is to set to SRAM to retention (Which I misunderstood to system retention) then you are looking at the correct sample.

    The main API that writes directly to the POWER register that sets the RAM retention on and off is nrf_power_rampower_mask_off/on. 

    Sorry for misunderstanding your simple query.

Reply Children
  • Okay thank you very much. I tried to copy the System OFF example into my project, but just failed to get the CRC check done right. So I skip this right now.  
    And the way I just understood it, I shouldn't reduce the memory to 33 KB in the device tree as in my last message, so that I can retain the memory areas later with the nrf_power_rampower_mask_off/on function.
    I am debugging now, to get the RAM Registers where I start retaining and what lenth I have to pass to the function. The retention should then start at 0x200077C0 and end at 0x20040000. 

    if my thoughts are wrong, please let me know.

Related