2020-09-23 03:23 AM
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:
2020-09-23 06:25 AM
I would start by looking at the detail of the fault (hard fault?) to find the source of the issue.
2020-09-23 10:38 PM
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?