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

how can I retain RAM after watchdog reset and bootloader present

Im using nrf51822 (16KB RAM), I'm trying to retain some data (RAM) after watchdog reset. when I load only the softdevice and my app, the RAM retention workings, but when I used it with bootloader, the data is always reset. I use this customized scatter file :

RW_IRAM2 0x20002000 UNINIT 0x20  {
   main.o (rtc_ram)
  }
  
  RW_IRAM1 0x20002020 0x3FE0{  ; RW data
   .ANY (+RW +ZI)
  }

I can see the data on the map file are set in the region 0x20002000 to 0x20002080, but each time the system reset, the data is reset.

I configured RAM retention on BLOCK1 after advertising start function

if(sd_power_ramon_set(0x00020003) != NRF_SUCCESS)
        {
        NVIC_SystemReset();
        }

I configured the desired RAM retention data this way

static uint8_t session_start_flag	__attribute__((section("rtc_ram"),zero_init));
static uint8_t reset_after_hang		__attribute__((section("rtc_ram"),zero_init));
static uint16_t steps_store_index	__attribute__((section("rtc_ram"),zero_init));
static uint16_t last_read_block		__attribute__((section("rtc_ram"),zero_init));
static uint16_t last_offset			  __attribute__((section("rtc_ram"),zero_init));

what could be the issue? I thought that when the app is valid, it's launched automatically on watchdog reset and the bootloader code is just flash code???, I mean the RAM is not affected by the bootlader

Parents Reply Children
No Data
Related