feat: EEPROM-backed device configuration store #45
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wait-to-fix
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
daru/PICsense#45
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The first step toward user-configurable devices (no reflashing) is a persistent, versioned configuration block in the 256-byte data EEPROM. Currently only the packet counter is persisted (4 bytes at 0x00); the remaining 252 bytes are free. This issue defines the config schema, layout, versioning, and validation that all other configurability features build on.
Storage decision: data EEPROM. Both the data EEPROM and Flash program memory are self-writable at runtime via the EECON registers (EEPGD/CFGS select the space), so the "can the program write the Flash?" question is yes. We are using the data EEPROM anyway: it is byte-addressable, the firmware already has
eeprom_read_16/32andeeprom_write_16/32helpers inPICKLE.h, and the config is written very infrequently (once, over UART), so wear is a non-issue. Flash would be the datasheet-recommended home for rarely-changing data, but the data EEPROM is simpler here.Proposed starting layout (open to change):
Flow: after writing the config over UART (#46), the board is power-cycled; the config is loaded from EEPROM into RAM at boot and the device then runs continuously.
Open questions: