Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add abstraction for storing persistent variables #202

Closed
Tracked by #201
PatrickKa opened this issue Dec 18, 2023 · 4 comments · Fixed by #307
Closed
Tracked by #201

Add abstraction for storing persistent variables #202

PatrickKa opened this issue Dec 18, 2023 · 4 comments · Fixed by #307

Comments

@PatrickKa
Copy link
Contributor

PatrickKa commented Dec 18, 2023

Description

Persistent variables are part of the persistent state. They are very important because they contain things like the activeFirmwareImage. Therefore, they should be implemented with a self-healing mechanism. I suggest storing each variable three times on the FRAM and every time a variable is read the three values are compared and a potentially wrong value is overwritten.

There must also be a way to easily place multiple persistent variables one after the other on the FRAM without overlapping and manual address calculations.

@PatrickKa
Copy link
Contributor Author

Blocked by #185 and #192

@PatrickKa
Copy link
Contributor Author

PatrickKa commented May 26, 2024

We should also add a counter that is incremented every time a persistent variable needed to be repaired. That counter should probably also be a persistent variable, so get()/load()/whatever should also return whether a repair happened or not.

Edit: We don't have time for this additional complexity, and the test memory section of the FRAM can give us similar if not better information anyway.

@PatrickKa
Copy link
Contributor Author

PatrickKa commented May 26, 2024

We also need to make sure that all persistent variables are repaired often enough such that only a single one of the three redundant copies of the values gets corrupted by radiation.

Edit: I think all (or at least most) of the persistent variables are part of the telemetry data/beacon, therefore they are accessed every 30 s which surely is enough.

@PatrickKa
Copy link
Contributor Author

As explained in #294, we need a fallback mechanism in case the FRAM does not work. This means that every persistent variable also needs to cache the value three times in RAM. If the FRAM works, data is read from and written to it. The data is also always written to the cache, but only when the FRAM doesn't work is it also read from the cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants