Hi,
I am using NRF52832 with softdevice s112 and SDK 15.3. I have 20 bytes of data which I want to retain in RAM during system off. I use the following code so that the data is not initialized.
uint8_t m_addl_adv_manuf_data[ADV_ADDL_MANUF_DATA_LEN] __attribute__ ((section(".noinit")));
Then in main, I get the slave and section and set the ram retention on. I checked the value and my variable belongs in slave 1 section 0 and I set the power to 0x1FFFF. But the value is not retained after wakeup from system off
uint32_t p_offset = (uint32_t)(&m_addl_adv_manuf_data[0] - RAM_START_ADDRESS);
uint8_t ram_slave_n = (p_offset / 8192);
uint8_t ram_section_n = (p_offset % 8192)/4096;
NRF_LOG_INFO(" addr %x offset %x RAM section %d, slave %d",&m_addl_adv_manuf_data[0],p_offset,ram_slave_n,ram_section_n);
sd_power_ram_power_set(ram_slave_n,(1 << ram_section_n) << POWER_RAMON_OFFRAM0_Pos);
uint32_t ram_power;
sd_power_ram_power_get(ram_slave_n,&ram_power);
NRF_LOG_INFO("power %x",ram_power);
On the other hand, If I assign the variable m_addl_adv_manuf_data to some other slave and section (slave 4 and section 0) 0x20008000 by using the sample code then even if I do not enable the RAM retention in the power register, it is still able to retain the value. This is really confusing. Can you explain why ?
#define RAM_MEMORY_TEST_ADDRESS (0x20008000UL)
Thanks,
Jyoti