Skip to main content
Visitor II
September 23, 2020
Question

Fault/error when accessing data on internal flash memory STM32H753

  • September 23, 2020
  • 4 replies
  • 1527 views

Hi,

We're storing some device configuration on last sector(7) at BANK2 inside internal flash memory. Sometimes device goes into state where part of this this sector is not readable by our code(generates fault) also this sector is not readable by cubeprogrammer and only solution to make our device work again(make unreadable part readable again) is to mass erase chip.

What could be causing such issue where we cannot read only part of flash memory? How can we check why such region is unreadable?

Some more details:

  • We are always erasing whole sector when we need to change something in config structure and then we reflash it.
  • Data we're storing there is around 1700 bytes currently
  • This happens pretty much randomly and there is no easy way to reproduce it

    This topic has been closed for replies.

    4 replies

    Super User
    September 23, 2020

    I would start by looking at the detail of the fault (hard fault?) to find the source of the issue.

    GMiki.1Author
    Visitor II
    September 24, 2020

    We know exactly what's causing fault. We are trying to read from certain address from flash memory(in valid range, not protected by anything).

    We tracked down the issue and it seems like problem with timings. What we noticed is that after successfully calling "HAL_FLASH_Program()" and restarting device right after we experience corrupted/damaged flash regions. Shouldn't this function ensure that it is safe to turn off device right after it returns? Adding short delay after programming seems to be solving the issue?

    Graduate
    March 13, 2025

    Hi, were you able to solve this problem? I encountered the same problem and don’t understand how to solve it

    Super User
    March 13, 2025

     Sometimes device goes into state where part of this this sector is not readable by our code(generates fault) 

    This can occur as result of programming error (for whatever reason) so access to affected flash area triggers ECC errors. This can be cured by erasing the sector properly. This should reset the ECC. If this won't help, erase the whole bank.

    Now, why programming errors can occur... For one, because of the "parallelism" parameter too large for available power. Try lesser (slower) values.

     

     

    Graduate
    March 14, 2025

    Mike1992_0-1741942618352.pngMike1992_1-1741942648084.png

    Thank you, it helped me to clearly indicate the beginning and end of the memory address and setting 2 ways ICACHE; when setting DIRECT MAPPED CACHE, saving occurred with an error

    Technical Moderator
    March 14, 2025

    @Mike1992 wrote:

    Mike1992_0-1741942618352.pngMike1992_1-1741942648084.png

    Thank you, it helped me to clearly indicate the beginning and end of the memory address and setting 2 ways ICACHE; when setting DIRECT MAPPED CACHE, saving occurred with an error


    That's not a STM32H7 product but another MCU part number (maybe H5). If you have an issue please open a new thread an give the part number you are using.

    Thanks.