cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H743 Flash not properly formatted after downloading binary using STM32CubeIDE

wyzykEnno
Associate II

Hello,

I am currently in the process of writing EEPROM emulation for stm32h743. The library works mostly correctly but due to unfortunate timing of downloading file through IDE flash is not properly initialized effectively making one of the sectors invalid to use. If I use stm32CubeProgrammer and attach to running device everything works as expected.
The sector memory (0x81E0000), looks like on the screenshot below, and the amount of rows filled with zeros depends on VOLTAGE_RANGE (more info later):

Screenshot from 2024-07-04 15-04-38.png

the function is initialized just after configuring all peripherials (eeh_Init():(

wyzykEnno_0-1720174407889.png

LED diode was used for troubleshooting process. It lights up for about 400ms, if eeh_Init() is allowed to finish.

But when I start the debug session with binary file to download it lights up for way shorter time.

The amount of zeros depends on the VOLTAGE_RANGE mentioned before, used for erasing data:

wyzykEnno_0-1720174908187.png



My guess is that downloading binary file to microcontroller when using ide makes the code run for some amount of time before resseting and going back to the beggining.

The problem is, neither HAL_Delay(SomeAmountOfTime) nor while(uwTick<SomeAmountOfTime) doesn't work.

I assume there is some very basic infromation and simple workaround that I am unable to find and I would be vary grateful for any help on this matter.

 

If you need more details, please let me know.

1 ACCEPTED SOLUTION

Accepted Solutions
wyzykEnno
Associate II

The problem was that ide was resetting the microcontroller during memory erase, i managed to delay memory erase so it will not start before the reset

View solution in original post

3 REPLIES 3
MM..1
Chief II

Why you kill flash memory with many zero writes instead one num ???

With my knowledge, the zeros are set by HAL_FLASHEx_Erase() function. It was used in an example eeprom emulaiton provided by ST for stm32h7a3 microcontroller and I did not want to modify something that was suggested by the manufacturer.

How do you suggest killing flash memory with one num?

wyzykEnno
Associate II

The problem was that ide was resetting the microcontroller during memory erase, i managed to delay memory erase so it will not start before the reset