Accessing PSRAM (XSPI1) While Running Application from Flash (XSPI2)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-06-10 10:27 AM
Hello everyone,
I’m working on an STM32H7S3L8H6H with two XSPI interfaces:
- XSPI1 (Quad-SPI) connects to an external PSRAM.
- XSPI2 (Octo-SPI) drives an external NOR flash, from which my application code executes directly.
In my bootloader I configure both and start the external memory manager:
MX_XSPI1_Init();
MX_XSPI2_Init();
MX_EXTMEM_MANAGER_Init();
This maps the flash at 0x7000_0000 and the PSRAM at 0x9000_0000. After jumping to main() in the application (which is executing from the XSPI2 flash), I’ve marked XSPI1 as “Runtime Context” in CubeMX and still call:
MX_XSPI1_Init();
But it hangs here:
// inside MX_XSPI1_Init():
if (HAL_XSPIM_Config(&hxspi1, &sXspiManagerCfg, HAL_XSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK) {
Error_Handler(); // stops here
}
I have validated each interface separately, XSPI2 boots and runs code, and XSPI1 handles PSRAM reads/writes without issue. So now, how can I access and use the PSRAM from within the application (which is itself executing from the external flash) ?
Any pointers, configuration tips or code snippets would be greatly appreciated. Thank you!
- Labels:
-
Flash
-
OctoSPI
-
QSPI
-
RAM
-
STM32H7 series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-06-11 1:30 AM
Hello @andgarriv;
Could you please check the XSPI1 configuration?
Is the memory interface running with the maximum speed 200 MHz and with VDD<2.7V?
If yes, make sure that HSLV is enabled.
I recommend you to look at Recommendations for high-speed low-voltage mode (HSLV) on the STM32H7RS.
Thank you.
Kaouthar
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-06-11 2:15 AM
Hello Kaouthar,
XSPI1 is working correctly in the boot code, and in both codebases it’s initialized with the same configuration. It’s running at 50 MHz (200 Mhz without prescaler), VDD = 1.8 V, and HSLV mode is enabled.
Let me know if you need anything else!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2025-06-16 3:30 AM - edited 2025-06-16 7:12 AM
Hello @andgarriv ,
Could you please share your MX_XSPI1_Init() and MX_XSPI2_Init() configurations ?
Please, ensure that each XSPI is mapped independently to its corresponding port (e.g., XSPI1 to Port 1 and XSPI2 to Port 2)
Kind regards,
