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

Storing variable values in system off mode.

Hi,

I need to store few variables values(long a = 4568;) to RAM (might be some other place) when the system went to sytem off mode .

How I can achieve in the nRF 51822 version 3.1 controller with SDK 6 and SD S110 .

Regards, Anand

Parents
  • Hi Anand,

    I am assuming that you are asking on how to put RAM in retention mode just before system off.

    // Switch on both RAM banks when in System OFF mode.
    NRF_POWER->RAMON |= (POWER_RAMON_OFFRAM0_RAM0On << POWER_RAMON_OFFRAM0_Pos) | 
                        (POWER_RAMON_OFFRAM1_RAM1On << POWER_RAMON_OFFRAM1_Pos);
    
    // Enter System OFF and wait for wake up from GPIO detect signal.
    NRF_POWER->SYSTEMOFF = 0x1;
    

    This will put both the RAM banks into retention and your stored values in ram will retain their values after the system wakes up from OFF mode.

    I would also recommend you to use latest SDK available for your projects. developer.nordicsemi.com/.../

    Also do not initialize RAM at every system restart Capture.JPG

  • One more thing Anand,

    The value of the ManufacturerData is preserved when the system wakes up from SYSYEMOFF. But your code has to guarentee that it will not be corrupted by stack push and pop operations in the initialization code (system startup). That is something you should take special care of, and that depends on how your function call structure is organized. If there is even one push/pop happening before main (in system startup code), then your ManufacturerData[30] will most likely be corrupted after the chip wakes up from the system off mode .

Reply
  • One more thing Anand,

    The value of the ManufacturerData is preserved when the system wakes up from SYSYEMOFF. But your code has to guarentee that it will not be corrupted by stack push and pop operations in the initialization code (system startup). That is something you should take special care of, and that depends on how your function call structure is organized. If there is even one push/pop happening before main (in system startup code), then your ManufacturerData[30] will most likely be corrupted after the chip wakes up from the system off mode .

Children
No Data
Related