EEPROM function in BL2100


I have a controller that occasionally needs to be reset to “factory defaults”. In the old PK2200 Little Star, I used the EEPROM to store a series of default values, and if the user pressed a certain key sequence during startup, these would be loaded. Since the R/W cycle was months, I never worried about lifetime.

I would like to emulate this behavior in the BL2100, using the Flash memory for storage, which may be only 256 or so bytes.

No, I do not want to depend on the battery for RAM backup. Been burned by this in the past with bad/dead batteries.

Is the FAT file system the way to go, or is there something easier, like a:

const int defaults[] = {8,9,7,6};

Since variables defined as constants are stored in Flash, I could then use this structure to fill in the values into the editable variables.

Just a thought. Any suggestions welcome!!

Thank, Dave

Answered my own question.

I used readUserBlock() and writeUserBlock. I found that a new controller contains all 1s in the user block, so I check for two char variables == 0xFF. If so, this is a new unit and it needs to be initialized.

I store the system IP address, serial baudrate and operations mode in the block. It reads the configuration upon powerup.

Thanks, David