Skip to main content
SJ.7
Visitor II
November 4, 2022
Question

User FLASH_ERASE not working properly on STM32G071 MCU

  • November 4, 2022
  • 1 reply
  • 1056 views

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?

This topic has been closed for replies.

1 reply

KDJEM.1
Technical Moderator
November 9, 2022

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.