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

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

mertvatansever
Copy link
Contributor

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 <mert.vatansever@analog.com>
Co-authored-by: Kevin Gillespie <kevin.gillespie@analog.com>
@mertvatansever
Copy link
Contributor 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
@kevin-gillespie kevin-gillespie merged commit bdf3bd9 into main Dec 19, 2024
11 checks passed
@kevin-gillespie kevin-gillespie deleted the fix/flash_ecc_me30 branch December 19, 2024 02:28
sihyung-maxim pushed a commit to analogdevicesinc/hal_adi that referenced this pull request Dec 19, 2024
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