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

A nice place to keep a small amount of state data

Hello Nordic users and employees,

I'm having a small dilemma. The device I'm building runs on the nRF51822 and needs to store a small number of bytes off to the side and some will occasionally be modified. However, flash is very precious in my application, I have a file system that needs as much space as possible.

The bytes must be off to the side and not a part of the file system because they must be read and written by both my main application and a small bootloader and the latter does not have or need the ability to use the file system. This is in the interest of saving space.

I'm considering using the user-reserved parts of the UICR region of memory to save my data, which consists of state and factory production parameters (date of manufacture, etc.). The factory parameters will not change in normal use.

The state data will occasionally change to signal that the bootloader should perform a device firmware update (DFU) on the next restart. Once the DFU is complete, the bootloader must clear the flag and launch the application normally.

I'm a little concerned using the UICR region for this because if it were somehow corrupted the BOOTLOADERADDR field would be unset and my device would become bricked.

Given that background, my question essentially is: Is there a safe way to use UICR for storing a small amount of modifiable data, without putting the BOOTLOADERADDR and other configuration registers at risk, or is there another place to tuck some nonvolitile data out of the way of main flash?

Regards, Cody

Related