Accessing PSRAM (XSPI1) While Running Application from Flash (XSPI2)
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!
