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

RAM retention settings with SoftDevice enabled

Hello,

 

I am using nRF52832, SDK_15.3.0, S132 SoftDevice and Segger for flashing the image. I am using ‘ble_app_blinky’.

I have few variables in application. These will be keep on changing based on different conditions in application. Other than power reset, those variables to be retained both in System ON and System OFF mode.

 

1) I searched entire ble_app_blinky project but I could not find sd_power_ram_power_set(). Still RAM content retained, when device wakes from “System ON” mode.

a) Whether SoftDevice will enable these settings, so that variables are retained even in System ON mode.

b) (Or) Since by default after reset, both bits A & B are set to 1 indicating RAM section S0 & S1 are enabled by default in System OF mode.

2) Device went to System OFF mode. But content in variables are lost. As per below links

a) I want to retain entire RAM rather than ".retained_section" for different variables.

b) If entire RAM is not retained during System OFF, then what is the purpose of S0RETENTION and S1RETENTION in RAM[0].POWER register.

c) Whether blow code is good enough so that entire RAM will retained even in System OFF mode.  But still I am not able to see the retained value.

https://devzone.nordicsemi.com/f/nordic-q-a/47620/ram-retention-of-softdevice-ram-region

https://devzone.nordicsemi.com/f/nordic-q-a/36099/ram-retention-problem

    uint8_t i;
    for(i = 0; i < 8; i++) // Retain RAM 0 - RAM 7
    {
        sd_power_ram_power_set(i, (POWER_RAM_POWER_S0POWER_On << POWER_RAM_POWER_S0POWER_Pos) |
                                  (POWER_RAM_POWER_S1POWER_On << POWER_RAM_POWER_S1POWER_Pos) |
                                  (POWER_RAM_POWER_S0RETENTION_On << POWER_RAM_POWER_S0RETENTION_Pos) |
                                  (POWER_RAM_POWER_S1RETENTION_On << POWER_RAM_POWER_S1RETENTION_Pos));
    }
    
    u8SystemOFFTestCounter++;
    // Start execution.
    NRF_LOG_INFO("SystemOFF Test %d", u8SystemOFFTestCounter);

3) Even I thought to skip GPIO initialization. Since variables are not retained in RAM, I am getting code crash.

    /* Reset reason */
    uint32_t rr = log_resetreason();
    
    // During System OFF mode, no need to re-initialize GPIO pins (This will avoid Glitch on pins)
    if(rr == NRF_POWER_RESETREAS_OFF_MASK)
    {
        leds_init();
        buttons_init();
    }

Also I have gone through "ram_retention" which is without softDevice and "ble_app_pwr_profiling" example where sd_power_ram_power_set() is no where called. I am bit confused.

I have gone through lot of mails on forum. But there is not straight froward answer.

Do we need to change any Segger settings to avoid RAM initialization while wake-up from System OFF. Please take this issue on high priority.

Thanks & Regards

Vishnu Beema

Parents
  • Hi Vishnu

    1) RAM retention refers to the ability of the RAM to retain it's state during power down, which is indeed working. When you leave system OFF mode the RAM content is still intact. 

    What happens here is that the RAM is overwritten after you wake from system OFF and go through the MCU startup procedure, which the RAM retention doesn't protect you from. 

    2) This is probably caused by the internal variables of the led and button modules not being retained. 

    The normal procedure is to re-initialize the various SDK modules after wakeup from system OFF. 

    Is this not a viable option in your application?

    Otherwise you would have to ensure that all the global and static variables in these modules are located in a .non_init section. 

    Best regards
    Torbjørn

Reply
  • Hi Vishnu

    1) RAM retention refers to the ability of the RAM to retain it's state during power down, which is indeed working. When you leave system OFF mode the RAM content is still intact. 

    What happens here is that the RAM is overwritten after you wake from system OFF and go through the MCU startup procedure, which the RAM retention doesn't protect you from. 

    2) This is probably caused by the internal variables of the led and button modules not being retained. 

    The normal procedure is to re-initialize the various SDK modules after wakeup from system OFF. 

    Is this not a viable option in your application?

    Otherwise you would have to ensure that all the global and static variables in these modules are located in a .non_init section. 

    Best regards
    Torbjørn

Children
No Data
Related