STM32H7R7: How to setup XSPI for external nor flash AT25XE321D
- January 23, 2026
- 6 replies
- 445 views
Hi,
The external nor flash AT25XE321D is 32Mbits, support quad IO/XIP spi operation, max. 133MHz Freq. Std. JEDEC/SFDP. It is connected to STM32H7R7Z8J6 with with XSPI1 port-1 interface.
I am using MX v6.116.1 to setup project for my board. By IDE v2.0.0, the project 'Boot' works from internal flash but it is failed to run 'Appli' from external AT25XE321D. And the project 'ExtMemLoader' is successfully built and deployed:
- File copied successfully under STM32CubeProgrammer.
- File copied successfully under STM32CubeIDE
I tried STM32CubeProgrammer v2.21.0 to program the AT25XE321D with using the ExtMemLoader.stldr I just built, but failed too. "Error: Mass erase operation failed." See attached log for more logs.
Back to my settings in MX:
1) 100MHz XSPI1 clock source

2) XSPI1 settings and GPIOs

There 4 memory types available and no 'custom' option. I pick the 'Macronix' as it is most close to AT25XE321D.

3) ExtMemLoader settings

I also go through followings but did not help me to solve the problem:
- AN5050: Getting started with Octo-SPI, Hexadeca-SPI, and XSPI interfaceson STM32 MCUs
- https://community.st.com/t5/stm32-mcus/how-to-create-an-external-flash-loader-for-an-stm32h7rs/ta-p/742005
- https://community.st.com/t5/stm32-mcus/integrating-and-debugging-external-memory-on-stm32-mcus-part-2/ta-p/865238
Can any one give me hand, thanks in advance!
