-
Notifications
You must be signed in to change notification settings - Fork 88
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
fix(PeriphDrivers): Fix flash ecc issue for MAX32657 #1300
Conversation
17e3449
to
e6105f5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if first 15 bytes are not all 0xFF?
Erasing flash will also erase the ECC bits. These bits are not updated until a flash write. Reading from erased memory will signal a ECC error that is falsely corrected from 0xFF to 0xFD on the 16th byte of each 128-bit line. This commit applies a workaround by setting the 16th byte of each line to 0xFF to handle this issue on max32657. Co-authored-by: Mert Vatansever <[email protected]> Co-authored-by: Kevin Gillespie <[email protected]>
e6105f5
to
94f4406
Compare
Updated the code to set 16th byte to 0xFF if 16th byte is 0xFD and rest of the bytes are 0xFF. |
I think this is pretty good for now. There are still some corner cases where we could still be masking an actual ECC error, but I'm also not sure if we'll be able to completely solve the problem. This will only check the range of data that we're reading to make sure it's erased, but we should really check the entire 128 bit line to make sure it's erased. |
Description
Erasing flash will also erase the ECC bits. These bits are not updated until a flash write. Reading from erased memory will signal a ECC error that is falsely corrected from 0xFF to 0xFD on the 16th byte of each 128-bit line.
This PR applies a workaround by setting the 16th byte of each line to 0xFF to handle this issue for max32657.
This is tested with zephyr/tests/drivers/flash/common. The result is indicated below.