Skip to main content
Visitor II
August 2, 2022
Question

STM32F767 flash programming problem

  • August 2, 2022
  • 4 replies
  • 1701 views

Hi everyone,

We are trying to program the MCU flash memory to write and save some data on it.

After successfully writing to a single sector, we can't delete the sector content anymore.

We are using HAL_FLASHEx_Erase to delete the sector.

In particular, we use the ideas in this article https://controllerstech.com/flash-programming-in-stm32/

Thanks in advance.

    This topic has been closed for replies.

    4 replies

    Graduate II
    August 2, 2022

    Are you asking a Question, or making a statement?

    Well the HAL FLASH functions do work properly on the F767's, so perhaps review the Reference Manual, or looks at the examples provided in CubeF7 for the board..

    gsaru.1Author
    Visitor II
    August 3, 2022

    Asking a question...

    Correction to the original post - after a single write(that might have failed) to a sector, when we try to write/overwrite the same sector we fail. Already read the Reference Manual (and I'm sure the HAL FLASH functions work properly), hence looking for advice on how to proceed from here/ things to think about that we might have missed.

    Graduate II
    August 3, 2022

    every time you want to write FLASH, the entire flash page needs to be erased.

    https://community.st.com/s/question/0D53W00001hkN4aSAE/hardfault-when-i-try-to-program-in-the-flash-memory

    What i usually end up doing is:

    1. copy entire flash page to ram buffer
    2. modify the part of the ram buffer i want
    3. erase flash page
    4. copy back RAM buffer into erased flash page
    Graduate II
    August 3, 2022

    Recomended reading RM0410

    I have never used an F7, what about the single/dual bank bits?

    Visitor II
    March 31, 2024

    For dual bank information you can use this resource:

    STM32F7 Series Flash memory dual bank mode, software expansion for STM32Cube (AN4826)