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

create a variable that maintains the value after module sleep

Hello, 

I am develop a project with nRF52832 and I use nRF5_SDK_14.2.0 and softdevice s132.

My problem is I need create a variable that maintains the value after of the module have been in sleep state.

how can I create this variable?

Regards,

Daniel

Parents
  • In IDLE sleep (WFE) you do not need to worry about this as the RAM is kept alive, so I am assuming you are talking about SYSTEM_OFF sleep.

    There are few ways to do it.

    1) You can use persistent storage (flash) and use the flash libraries to create a smaller block which you can easily address in any state of your system startup. Since you are already using the SDK, I assume you know fds and fstorage libraries.

    2) You can force a variable initialization to reside at a particular address and then you can configure the RAM section individually to be kept ON during system OFF state. This will not consume too much current as a RAM block of 4KB size will only consume 20nA extra average current.

    3) If you are writing only once and reading multiple times, you can use one of the UICR->CUSTOMER[X] register. Note that unlike option 1) you will be able to write to this register only once (without full chiperase)

Reply
  • In IDLE sleep (WFE) you do not need to worry about this as the RAM is kept alive, so I am assuming you are talking about SYSTEM_OFF sleep.

    There are few ways to do it.

    1) You can use persistent storage (flash) and use the flash libraries to create a smaller block which you can easily address in any state of your system startup. Since you are already using the SDK, I assume you know fds and fstorage libraries.

    2) You can force a variable initialization to reside at a particular address and then you can configure the RAM section individually to be kept ON during system OFF state. This will not consume too much current as a RAM block of 4KB size will only consume 20nA extra average current.

    3) If you are writing only once and reading multiple times, you can use one of the UICR->CUSTOMER[X] register. Note that unlike option 1) you will be able to write to this register only once (without full chiperase)

Children
Related