Hi list,

I am trying to use config/config.h and config/config_file.h, based on the
slinky example, to store some persistent data in flash fs on nrf51.

Some of the values are written once and remain static after that (e.g.
device id), while other values might change over the lifetime of the device
(e.g. actual configurable settings that need to persist across power
cycles).

The problem I am having is as follows:

1. Write initial values at provisioning time via serial console:

config x/a 1
config x/b 2
config x/c 3
config commit
config save

These values are saved and I can verify that /cfg/run has the right bits.

2. At some later point, change x/b. I have tried doing this both via code
(calling config_save) and via the console, with same result:

console x/b 10
console commit
console save

At this point, only the new value is saved, and /cfg/run no longer contains
any of the previous values, even though config dump still has them all (ie.
the values in memory are correct, and export handler returns them). Of
course, after a power cycle, I lose my previously persistent settings.

Worse, if at this point I try to manually re-set all settings to their
values, all except x/b are saved, so it seems the values are now in two
disjoint sets, and only one of the sets is saved on any particular call to
config_save.

Any ideas on what is going, or pointers to what I am doing wrong? Is this a
side effect of the way flash blocks are written/erased?

PS. As a side note, I have observed some other general flakiness with
config + nffs. Sometimes the initial write partially fails and only some of
the data is saved, seems to be related to the file straddling the inode
boundary (only the data in the second inode can be read back). At other
times, nffs_detect fails after a previous write. Might all be related?

Cheers,
Simon.

Reply via email to