2025-04-20 5:15 AM - edited 2025-04-20 4:31 PM
Hi All,
I am having difficulties getting both HEXSPI PSRAM (XSPI1) and OCTOSPI (XSPI2) running at the same time in a memory mapped mode on STM32H7S78-DK board.
There are two examples for this board:
XSPI_PSRAM_MemoryMapped that configures XSPI1 in memory mapped mode (access to external RAM)
XSPI_NOR_ReadWhileWrite_DTR that configures XSPI2 in memory mapped mode (access to external FLASH)
Each example runs OK separately. However, when I've ported XSPI1 code from "XSPI_PSRAM_MemoryMapped" project to "XSPI_NOR_ReadWhileWrite_DTR" project PSRAM works in memory mapped mode but external flash doesn't any more.
I am finding that change in HAL_XSPI_MspInit() that configures XSPI1 breaks operation of XSPI1 in memory mapped mode.
Is there any example source code that work for STM32H7S78-DK board with PSRAM and OCTO FLASH out of the box ?
2025-04-21 2:21 AM
Hello @Dub Bartolec;
> PSRAM works in memory mapped mode but external flash doesn't any more.
Could you please give more detail about the issue. What do you mean by external flash doesn't work? Do you get a hardfault or no data transmitted or you received a corrupted data.....?
Are the XSPIs interfaces configured in Multiplexed mode?
Make sure that the data transmission to be completed before switching from memory to another.
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.
2025-04-21 3:40 AM - edited 2025-04-21 3:42 AM
Hi Kaouthar,
Refer to Schematic for STM32H7S78-DK "mb1763-h7s7I8-d01-schematic.pdf'
On STM32H7S78-DK XSPIs are supposed to be configured as follows:
XSPI1 - Configured as HEXA connected to APMEM PSRAM chip (Sheet 6 on schematic)
XSPI2 - Configured as OCTO connected to MX66UW1G45GXDI00 FLASH (Sheet 5 on the schematic)
I've merged XSPI1 and PSRAM config form "XSPI_PSRAM_MemoryMapped" project into "XSPI_NOR_ReadWhileWrite_DTR" Boot project and at the point where Boot is supposed to jump into application in external FLASH at address 0x70000000 if I put debug point after memory is mapped I am supposed to be able to dump memory using "Memory Browser" in STM32CubeIDE.
Memory at 0x90000000, external PSRAM is visible.
Memory at 0x70000000, exernal FLASH is not visible.
However, I think I've found out what the problem is.....
There is serious bug in "XSPI_NOR_ReadWhileWrite_DTR_Boot" project code that causes external FLASH on XSPI2 not to be visible if XSPI1 is enabled at the same time. This project only works by chance.
I'll publish what the bug is, and what the fix is here and hopefully ST is going to update and fix that in next release of STM32CubeMX package for STM32H7S.
Current firmware package that we are using is "STM32Cube FW_H7RS V1.2.0" and bug is there.
It needs to be fixed in next release of firmware package o people do not run into same problem as I did.
2025-04-23 3:01 PM
Hi @KDJEM.1
Fix to the code might be too complex to be published here.
Can you get me in touch with team that maintains "STM32Cube FW_H7RS V1.2.0" package so I can send them files that have to be changed ?
2025-04-24 5:29 AM
Hello @Dub Bartolec ;
Thank you for your investigation.
I recommend you to share files to be modified in the community by drag-and-drop, as shown in the below figure.
I'll report them internally to the STM32Cube_FW_H7RS team for checking and fixing.
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.
2025-04-24 7:19 AM
if what you mean is having the code in flash and have PSRAM for large variables you can follow this
program in flash : https://github.com/ST-TOMAS-Examples-ExtMem/stm32h7rs_ospi/blob/main/description/1_extmem_intro.md
after you setup in ioc the psram like other exemples
in the memory manager you set memory 2 in PSRAM
after in the app use the linker ROM XSPI1 RAM XSPI2
Create a section for the external ram
and after to use a variable in psram declare a attribute to the variable
2025-04-26 8:21 PM
Hi @KDJEM.1
Will do that. I need to prepare patch to pass it to here.BTW, there are still some bug fixes I've found on STM32H7xx series that I've pointed out here and they never got fixed.
2025-04-26 8:37 PM
Hi @Hamady
We tried this and entire process of creating memory mapped External FLASH and External memory for STM32H7S/R and H/W config of STM32H7S78-DK with STM32CubeMX is extremely fragile.
Your example shows how to sort it out with external FLASH on XSPI1 and that works fine if I change config to use FLASH on XSPI2 as it is on DK board. This works.
To get both external RAM and external FLASH getting configured at the same time requires quite a lot of manual changes to code generated by STM32CubeMX.
I've done it by merging configs from two STM32H7S/R projects. One that use external RAM and another that uses external FLASH. It wasn't straight forward and in the process I've discovered bug in one example.
BTW, some STM32H7S/R examples were not created by IOC files