Skip to main content
LRolf.11
Visitor II
April 3, 2019
Question

HAL_FLASH Erase Failing to clear addresses to 0xffffffff...

  • April 3, 2019
  • 0 replies
  • 587 views

I am using the HAL libraries to interface to the flash on the STM32G071GBU6. Specifically, I am attempting to make use of a non-volatile flash interface to read/write 1 user parameter byte to flash.

While using HAL_FLASHEx_Erase right before HAL_FLASH_Program on flash page 63 (towards the end of my 128K flash), I am seeing an error being thrown with HAL_FLASH_Program, that appears indicative that the erase is not resetting the page to 0xffffffff. The error is HAL_FLASH_ERROR_PROG.

To me, it is looking liek the hall function for erasing a page is not properly clearing the flag on the memory indicating that it can be written to again, hence why I get the error I am seeing. Any suggestions would be appreciated!

As this change can occur at any time, and custom hardware has been built, I cannot add a wire to power any sort of low power RAM, but the product I am working on is a pre-cursor to the actual product so flash memory wear is not an issue at this time.

This topic has been closed for replies.