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

[STM32G4] flash dual bank ignored during erase #1151

Open
hshose opened this issue Mar 20, 2024 · 2 comments
Open

[STM32G4] flash dual bank ignored during erase #1151

hshose opened this issue Mar 20, 2024 · 2 comments

Comments

@hshose
Copy link
Contributor

hshose commented Mar 20, 2024

Problem: When writing to flash pages beyond 128 on STM32G4 (in particular G474), Flash::erase fails silently und the Flash::program does not return an error (even though, right after programming the PROGERR Bit 3 in FLASH->SR register is set, as GDB tells me).

This is due to the DBANK bit not beeing set in the flash.cpp

According to the RM0440, pp. 135, in dual bank mode (DBANK=1), the BKER bit should be set to 1 for pages after 128. Dual bank mode is default.

What really threw me off was, that I could program addresses beyond page 128 once.
I just now realized, that this this is likely because the factory values for flash would be 0x00 or 0xFF, in which case they are already erased the first time programmed.

At least the G474 Flash example and #1146 are effected by this problem.

@hshose
Copy link
Contributor Author

hshose commented Mar 20, 2024

Proposed fix in #1146

@hshose
Copy link
Contributor Author

hshose commented Mar 20, 2024

LOL might need a bit more logic to model the dual bank flash on the G4 family:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants