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

fix(PeriphDrivers): Fix flash ecc issue for MAX32657 #1300

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mertvatansever
Copy link

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.

image

@github-actions github-actions bot added the MAX32657 Related to the MAX32655 (ME30) label Dec 16, 2024
Copy link
Contributor

@ttmut ttmut left a 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]>
@mertvatansever
Copy link
Author

What if first 15 bytes are not all 0xFF?

Updated the code to set 16th byte to 0xFF if 16th byte is 0xFD and rest of the bytes are 0xFF.

@mertvatansever mertvatansever requested a review from ttmut December 18, 2024 07:12
@kevin-gillespie
Copy link
Contributor

kevin-gillespie commented Dec 18, 2024

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.

@ttmut ttmut requested a review from MaureenHelm December 18, 2024 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MAX32657 Related to the MAX32655 (ME30)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants