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): MAX32650 (ME10) Flash Address Fix #1354

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

Conversation

BrentK-ADI
Copy link
Contributor

@BrentK-ADI BrentK-ADI commented Feb 20, 2025

Corrected a bug in how the flash physical address (relative to flash base) was calculated which caused a block of pages' addresses to be incorrectly masked. This ultimately caused issues when doing single page erases whenever bit 20 of the Flash address was set.

In the original implementation, -1 was done on the FLASH_MEM_SIZE to presumably get a valid mask. This works when the memory size is a power of 2. However, since the memory on the MAX32650 is 3MB (0x300000), subtracting 1 results in a mask of 0x2FFFFF, where Bit 20 is 0. All pages with Bit 20 set to 1 will have an incorrect address calculated.

The solution was to just subtract the base address, since the range was already validated in the if block. This is the same implementation that the MAX32690 (also with 3MB of Flash) does.

@github-actions github-actions bot added the MAX32650 Related to the MAX32650 (ME10) label Feb 20, 2025
@@ -5,7 +5,7 @@
*/
/******************************************************************************
*
* Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
* Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
* Analog Devices, Inc.),
* Copyright (C) 2023-2024 Analog Devices, Inc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be 2023-2025

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All set.

Corrected a bug in how the flash physical address (relative to flash base) was calculated
which caused a blockof pages' addresses to be incorrectly masked. This ultimately caused
issues when doing single page erases where bit 20 of the Flash address was set.
@BrentK-ADI
Copy link
Contributor Author

Sorry for the erroneous push. Committed a different fix to the wrong branch on my end. This PR should be back to just the flash fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MAX32650 Related to the MAX32650 (ME10)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants