This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Powering down RAM sections increases current

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 comes out to be 0x3AA8. Looking at this configuration, I understand that I am using 2 sections of the RAM (section 0 & 1). Hence I am powering down sections 2 to 7. My assumption is that powering down the RAM will reduce my current consumption by some value. But instead of that my current consumption is going into mA. I don't understand what I am doing wrong. I have pasted my code below. Please let me know my mistake.

int main(void)
{
    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};

    // Initialize the SoftDevice handler module.
    SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);

    for (uint8_t i = 2; i < 8; i++)
    {
            NRF_POWER->RAM[i].POWER = 0;
            NRF_POWER->RAM[i].POWERCLR = 0x00030003;
    }

    sd_power_mode_set(NRF_POWER_MODE_LOWPWR);

    while (true)
    {
            sd_app_evt_wait();
    }

    return 0;
}
Parents Reply Children
  • 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.

    int main(void)
    

    { 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};

    // Initialize the SoftDevice handler module.
    SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);
    
    for (uint8_t i = 3; i < 8; i++)
    {
            NRF_POWER->RAM[i].POWER = 0;
            NRF_POWER->RAM[i].POWERCLR = 0x00030003;
    }
    
    sd_power_mode_set(NRF_POWER_MODE_LOWPWR);
    
    while (true)
    {
            sd_app_evt_wait();
    }
    
    return 0;
    

    }

    Thanks, SUK

  • Pls post screen of your memory configuration.

  • 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.

        /* 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 = .);
      } > RAM
    
      /* No init RAM section in bootloader. Used for app/boot information exchange. */
      .noinit(NOLOAD) :
      {
    
      } > NOINIT
    } INSERT AFTER .data;
    
    INCLUDE "nrf52_common.ld"
    
  • It looks ok, did you rebuild (clean, build) whole project before trying?

  • 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:

    NRF_POWER->RAM[4].POWER = 0;
    NRF_POWER->RAM[4].POWERCLR = 0x00030003;
    

    Do I need to use both statements or either one is fine?

Related