Unreadable flash due to power failure
We met with strange problem with STM32H743.
Could you please advice how to diagnose the following bug/effect of built-in flash :
we use STM32H743 at our device. We calibrate the device within assembling procedure.
The calibration data stored in built-in flash of the chip.
But it was found that if the power is accidentally turned off while
writing to the flash, this area of the flash becomes unreadable.
The worst is that when we are trying to read this area, the chip gets into
a hardfault probably.
Then watchdog reboots the device and the device become a "brick", with
endless rebooting.
A test firmware has been prepared that does not read calibration
data at startup. Using the initial bootloader, it was loaded into the device.
Hardfault has ended.
When you try to read the calibration command in the device interface,
hardfault occurs again.
If we force to clear the sector and write the calibration data by the
command from host device, the flash restores its functions and works
correctly.
Please advice how to avoid it and how can we check flash memory to
diagnose the failed sectors?