Reattempt failed flash operations #1
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In collaboration with @esev
Submitted for your consideration. Seems to be working, but definitely needs careful review.
(Hopefully) resolves the issues with NRF52 flash corruption which are occasionally caused when a connected BLE device moves out of range.
Flash operations are asynchronous when softdevice is enabled. If a BLE connection terminates non-gracefully (
BLE_HCI_CONNECTION_TIMEOUT
etc), it will cause an in-progress write/erase operation to fail.Currently: failure of an async flash operation is not detected. No attempt to repeat is made if the operation failed.
Log (old)
This PR: detects failed flash operations using info available in the flash event callback, and makes several additional attempts to repeat a failed operation (before eventually giving up, if necessary).
Log
Log (verbose)
Note: Write 1 and Write 2 are a result of a pre-existing workaround: