cancel
Showing results for 
Search instead for 
Did you mean: 

Can't erase/write some Flash page in STM32G071RB

dmrsim
Associate III

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!

3 REPLIES 3
TDK
Guru

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".
dmrsim
Associate III

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

TDK
Guru

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".