cancel
Showing results for 
Search instead for 
Did you mean: 

User FLASH_ERASE not working properly on STM32G071 MCU

SJ.7
Associate

I want to write some data into flash memory on STM32G071 MCU as a part of a project. For that, I am using the function 'HAL_FLASHEx_Erase' to erase the pages before writing. While debugging it's working fine. But when I downloaded the code to MCU and started running, the execution stuck somewhere. I have found that the code runs smoothly till the line, CLEAR_BIT(FLASH->CR, FLASH_CR_PER); inside the function. But it didn't execute even the very next line.

How can I resolve the problem?

1 REPLY 1
KDJEM.1
ST Employee

Hello @Community member​,

I advise you to get inspired from the available FLASH_eraseProgram examples in the STM32CubeG0 MCU package. These examples may help you in the configuration by following the instructions in the readme file.

I hope this helps!

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.