2026-03-11 2:47 AM
HI,
I'm using stm32h7s78-dk, and setup the external flash following this tutorial
The "appli" project is in external flash and runs with no issue. Now I want to write some config data such as display brightness to the external flash according to user input but I can't find a way to do that.
I tried HAL_FLASH_Program(), but it seems can only modify the internal flash. Then I tried to enable EXTMEM_MANAGER_APPLI in CubeMX to use EXTMEM_WriteInMappedMode(). However, I can't reinitialize the xspi in "appli" project..
What is the appropriate way to do this?
Any input is much appreciated!
Solved! Go to Solution.
2026-03-11 3:12 AM
Hello,
Please refer to this example provided in the CubeH7RS package in github.
The readme file indicates that the code is executed from Bank0 and the write is performed to Bank1.
2026-03-11 3:12 AM
Hello,
Please refer to this example provided in the CubeH7RS package in github.
The readme file indicates that the code is executed from Bank0 and the write is performed to Bank1.
2026-03-11 8:06 AM
Thanks for reply!
My current setup is using xspi1 to interface with PSRAM, xspi2 for external flash. According to the example you mentioned, I need to use both xspi1 and xspi2 on the flash chip to be able to read and write at the same time.
So I have to use other method to interface with external ram, or have a dedicated chip such as a EEPROM to store the config data.
Am I understanding this correctly?
2026-03-12 12:31 AM - edited 2026-03-12 1:22 AM
I'm not expert of that interface but I think that's not possible to write to the same external memory flash while executing from it as you may stall the XSPI interface/the CPU.
So maybe you need to relocate the program that writes to the external flash to another memory (internal SRAM/Flash or even the external SRAM you are using). After achieving the write operation you need to jump again to your program stored in the XSPI flash.
Or for simply use an EEPROM or FRAM to store your data.
2026-03-12 3:04 AM
Thanks for your help.
It should be possible as long as the read (XIP) and write happens in different banks according to AN6228 .
But due to the construction of the stm32h7s78-dk board, I need to use 1 xspi for PSRASM. I think I just store the data in the SD card for now before making a custom board.