How to program an external QSPI connected to the STM32

If you like it, share it

This note explain how to program an external QSPI connected to an STM32.

  • First is necessary put the STM32 in boot mode
  • Second is necessary download a appropriate SW on STM32 RAM
  • At this point, you have the possibility to erase, program, etc, an external QSPI connected to the STM32


  • This example is tested on the STM32446E-EVAL (based on STM32F446ZET6) bust is easy to transfer on other STM32.
  • The FW example is X-CUBE-EXTBOOT
  • For detail concerning this explanation see the AN4852.

In this note the user bootcode is downloaded in the internal RAM using the internal bootloader, so that the Flash memory content is not altered.
This bootcode, located in the internal RAM, implements commands allowing the user to program the Quad-SPI Flash memory.


The purpose of this firmware is to program new firmware/data in an external Flash memory, using the same protocol of the internal bootloader:
Via the USART interface and the “Write” command, the ST internal bootloader
downloads the developed binary code into the internal RAM memory, and then, using the “Go” command, it jumps to the entry point of this binary code to execute it (see
image below).
The new bootcode runs from RAM and enables to program the external Quad-SPI
Flash memory.

To reach this goal, user must use the Flash memory loader demonstrator tool, modified to support programming the internal RAM and the Quad-SPI Flash memory.

The image below describes the user bootcode firmware and lists the different implemented commands.

The commands supported by the developed firmware are listed in the image below.

For upload the FW on STM32 is necessary put the STM32 in boot mode and use the Flash Loader Demonstrator, also called STM Flash Loader Demo, FLASHER-STM32.

Be carefully, the SW must be installed in the RAM of STM32.
For more detail see the AN4852 chapter n.2


With the built-in UART bootloader available in STM32 microcontrollers, users program the RAM and the internal Flash memory.
Thanks to the firmware described in AN4852 and the SW package X-CUBE-EXTBOOT, users have the additional possibility of programming an external Quad-SPI Flash memory and to develop their own bootloader to program any external memory connected to communication peripherals such as I2C, SPI, FSMC/FMC, Quad-SPI.