Skip to main content
Associate
April 27, 2026
Solved

STM32H745I-DISCO – External flash erase/init failure with TouchGFX project

  • April 27, 2026
  • 1 reply
  • 291 views

Hi Community,

I am using STM32H745I-DISCO board and generated a TouchGFX project and attempted to flash/debug from CubeIDE. The flashing process fails during the erase stage.

Observed Errors

  • Initially: “Error: failed to erase memory”
  • After enabling external loader (without initialization):
    • Erase still fails
  • After enabling external loader with Initialize = true:
    • “Failed to initialize external memory”
    • “Error in initializing ST-LINK device”
  • In CubeProgrammer:
    • External flash is detected when selecting loader MT25TL01_STM32H745I-DISCO
    • However:
      • Mass erase fails
      • Sector erase also fails
      • Error message:
        • “Sector erase operation has failed… please verify flash protection” 

I am using STM32CubeIDE v1.18.1 and STM32CubeProgrammer: v2.16.x

I have attached screenshots.

Can someone help what could be the issue?

Thanks.

 

Best answer by mƎALLEm

Hello,

I don't have your project so I couldn't tell what problem you have.

I've attached a TouchGFX project running on STM32H745I-DISCO board.

You can use the TouchGFX Designer tool to directly generate code, compile, simulate and upload the application.

As shown in the below screenshot:

1- You need to generate the code by clicking  mALLEm_2-1778057877758.png

2- (Optional step) to compile and simulate the graphics on PC: mALLEm_3-1778057985557.png

3- To Compile and upload your TouchGFX application to the target (The DISCO board in your case): mALLEm_4-1778058047536.png

mALLEm_1-1778057781454.png

With the attached project, please test it by following step 1 and step 3. You should see this screen in the LCD:

mALLEm_0-1778057387237.png

1 reply

mƎALLEm
ST Technical Moderator
April 27, 2026

Hello,


@Tharun123 wrote:
  • In CubeProgrammer:
    • External flash is detected when selecting loader MT25TL01_STM32H745I-DISCO
    • However:
      • Mass erase fails
      • Sector erase also fails
      • Error message:
        • “Sector erase operation has failed… please verify flash protection” 

Based on this statement I have the impression there is a problem with the external memory.

Try to run the QSPI example provided in CubeH7: https://github.com/STMicroelectronics/STM32CubeH7/tree/master/Projects/STM32H745I-DISCO/Examples/QSPI/QSPI_MemoryMappedDual

If it doesn't work there is an issue with the external memory, either the memory is broken or there is something gone wrong on the board/PCB!

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
Tharun123Author
Associate
May 6, 2026

Hi mƎALLEm,

I tried the QSPI_MemoryMappedDual example from CubeH7 on the STM32H745I-DISCO board.

Results:

  • The example flashed successfully

  • It ran successfully without any errors

  • QSPI erase/write/read operations are working correctly

I also tested another example:

  • LTDC_Layer1

  • The image is displayed correctly on the LCD

So it looks like:

  • QSPI hardware is working

  • External flash is working

  • LCD/LTDC is also working

However, when I generate a simple TouchGFX project (small image only):

  • If I flash without enabling external loader:

    • Flashing succeeds

    • Code runs

    • But nothing appears on the display

  • If I enable and initialize the external loader:

    • I get:

      • “Failed to initialize external memory”

      • “Error in initializing ST-LINK device”

At this point I am confused about the correct workflow for TouchGFX on STM32H745I-DISCO.

Could you please clarify:

  1. What is the exact process to generate and flash a TouchGFX project on STM32H745I-DISCO?

  2. Is external QSPI flash mandatory even for a very small image/UI?

  3. Which external loader should be selected for this board?

  4. Are there any specific TouchGFX memory configuration settings required for this board?

Thanks.

mƎALLEm
mƎALLEmBest answer
ST Technical Moderator
May 6, 2026

Hello,

I don't have your project so I couldn't tell what problem you have.

I've attached a TouchGFX project running on STM32H745I-DISCO board.

You can use the TouchGFX Designer tool to directly generate code, compile, simulate and upload the application.

As shown in the below screenshot:

1- You need to generate the code by clicking  mALLEm_2-1778057877758.png

2- (Optional step) to compile and simulate the graphics on PC: mALLEm_3-1778057985557.png

3- To Compile and upload your TouchGFX application to the target (The DISCO board in your case): mALLEm_4-1778058047536.png

mALLEm_1-1778057781454.png

With the attached project, please test it by following step 1 and step 3. You should see this screen in the LCD:

mALLEm_0-1778057387237.png

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.