Skip to main content
Associate II
January 14, 2024
Question

Can't erase/write some Flash page in STM32G071RB

  • January 14, 2024
  • 2 replies
  • 1363 views

Hello,

I'm writing a Flash HAL driver in order to understand better how this CHIP work.

My functions at the moment work correctly but for some page I have an HardFault(During erase).

For example I can't erase/write the page 0 and others pages.

Please could you explain me why?

Thanks!

2 replies

TDK
January 14, 2024

Probably your code is running at page 0. Erasing it causes unexpected behavior.

"If you feel a post has answered your question, please click ""Accept as Solution""."
dmrsimAuthor
Associate II
January 14, 2024

Hello @TDK , thanks for your reply.
There is a way to verify that my code is running at page 0?

TDK
January 14, 2024

That's typically where the code starts. If you haven't changed any settings, that's where it is.

Your linker script should have a section called FLASH. If it's set to 0x08000000, code starts there, at page 0.

"If you feel a post has answered your question, please click ""Accept as Solution""."