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

NXP drivers: flash: soc_flash_mcux: remove CMD_MARGIN_CHECK #83472

Conversation

DerekSnell
Copy link
Contributor

@DerekSnell DerekSnell commented Dec 31, 2024

The CMD_BLANK_CHECK can return errors when the flash is readable, and should only be used after programming, not in is_area_readable(). From the LPC55S69 datasheet: "As cells age and lose charge, a correctly programmed address will fail this check, while still being able to be read successfully for the remaining duration of the data retention time."

Resolves #83599

The CMD_BLANK_CHECK can return errors when the flash is readable, and
should only be used after programming, not in is_area_readable().  From
the LPC55S69 datasheet: "As cells age and lose charge, a correctly
programmed address will fail this check, while still being able to be
read successfully for the remaining duration of the data retention time."

Signed-off-by: Derek Snell <[email protected]>
@DerekSnell DerekSnell added backport v3.7-branch Request backport to the v3.7-branch backport v4.0-branch Backport to the v4.0-branch labels Jan 6, 2025
@fabiobaltieri fabiobaltieri merged commit 88b9cb6 into zephyrproject-rtos:main Jan 6, 2025
34 checks passed
@DerekSnell DerekSnell deleted the lpc_flash_remove_marging_check branch January 22, 2025 20:24
@phonkane
Copy link

A bit late with my comment but I wonder if this works as intended. According to LPC55 User Manual, "If a page is found which is not correctly erased, the FAIL flag is set". I get it that if the FAIL flag is not set (i.e. page is not blank), reading this page is safe. However shouldn't the test be repeated for each page in the range passed to is_area_readable()? It looks like the FAIL flag is set if any of the pages in the range is programmed, but this does not mean it is safe to read the entire range. Admittedly this should work just fine as long as the same flash region is always completely programmed or erased.

Also the commit message is a bit confusing, I guess "CMD_BLANK_CHECK can return errors" should be read as "CMD_MARGIN_CHECK can return errors"?

@DerekSnell
Copy link
Contributor Author

Hi @phonkane ,
Great point, and thank you for raising this up. We agree with your concern, and I created this issue #86432 to track updating that driver.

And yes, I had an error in the commit message. It should read "The CMD_MARGIN_CHECK can return errors when the flash is readable...". Sorry I cannot update that commit message now.

Thank you for raising this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Flash backport v3.7-branch Request backport to the v3.7-branch backport v4.0-branch Backport to the v4.0-branch platform: NXP Drivers NXP Semiconductors, drivers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NXP drivers: flash: soc_flash_mcux: CMD_MARGIN_CHECK fails infrequently
5 participants