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

    To avoid this I think the easiest way is to make a copy of the bsp_board_leds_init() function somewhere (in main.c for instance), and run that rather than running bsp_board_init(BSP_INIT_LEDS). 

    Then you can comment out the last line of the bsp_board_leds_init function, where the LED's are turned off:

    static void bsp_board_leds_init_copy(void)
    {
    #if defined(BOARD_PCA10059)
      // If nRF52 USB Dongle is powered from USB (high voltage mode),
      // GPIO output voltage is set to 1.8 V by default, which is not
      // enough to turn on green and blue LEDs. Therefore, GPIO voltage
      // needs to be increased to 3.0 V by configuring the UICR register.
      if (NRF_POWER->MAINREGSTATUS &
      (POWER_MAINREGSTATUS_MAINREGSTATUS_High <<   POWER_MAINREGSTATUS_MAINREGSTATUS_Pos))
      {
        gpio_output_voltage_setup();
      }
    #endif

      uint32_t i;
      for (i = 0; i < LEDS_NUMBER; ++i)
      {
        nrf_gpio_cfg_output(m_board_led_list[i]);
      }
      // bsp_board_leds_off(); - This line should be commented out
    }

    This code can be found on line 125 of boards.c

    Best regards
    Torbjørn

Reply
  • Hi Vishnu

    To avoid this I think the easiest way is to make a copy of the bsp_board_leds_init() function somewhere (in main.c for instance), and run that rather than running bsp_board_init(BSP_INIT_LEDS). 

    Then you can comment out the last line of the bsp_board_leds_init function, where the LED's are turned off:

    static void bsp_board_leds_init_copy(void)
    {
    #if defined(BOARD_PCA10059)
      // If nRF52 USB Dongle is powered from USB (high voltage mode),
      // GPIO output voltage is set to 1.8 V by default, which is not
      // enough to turn on green and blue LEDs. Therefore, GPIO voltage
      // needs to be increased to 3.0 V by configuring the UICR register.
      if (NRF_POWER->MAINREGSTATUS &
      (POWER_MAINREGSTATUS_MAINREGSTATUS_High <<   POWER_MAINREGSTATUS_MAINREGSTATUS_Pos))
      {
        gpio_output_voltage_setup();
      }
    #endif

      uint32_t i;
      for (i = 0; i < LEDS_NUMBER; ++i)
      {
        nrf_gpio_cfg_output(m_board_led_list[i]);
      }
      // bsp_board_leds_off(); - This line should be commented out
    }

    This code can be found on line 125 of boards.c

    Best regards
    Torbjørn

Children
No Data
Related