Showing results for 
Search instead for 
Did you mean: 

Unable to use HSPI + OctoSPI to talk to PSRAM + NOR-FLASH (respectively)


I am trying to bring up the STM32U5A9J-DK wherein I can use the external NOR_FLASH over OctoSPI_1 and the external PSRAM over HSPI_1 -- both in memory mapped mode. I am trying to use the STM32CubeMX to generate the drivers but am having some difficulties.

I have tried using the 'default' configuration suggested by the CubeMX IDE and have also tried , unsuccessfully, to tweak some of the GPIO setttings. Bottom line, no matter what I do, the IDE always insists that the Data pins in the OCTOSPI1 are in conflict with a whole host of other functions -- But I don't think they are because the Alternate Functions are set up correctly.

So why in blazes is the CubeMX saying that there is a conflict? NOTHING MAKES SENSE HERE.

I have attached a screenshot of the IDE showing the conflicts. Thanks for any help.

I am attaching a screen shot of the IDE where I see the conflict.


Accepted Solutions


APMemory PN with "XX' (like APS512XXN-OBR or APS256XX-OBR) are supporting both OPI & HPI mode. The device is booting in x8 and can be swap to x16 by mode register. The command you mentioned are setting the configuration on the MCU side.

The benefit of using HPI x16 mode are following:

  1. Double the bandwidth versus OPI, up to 1Gbps and provide a pin count, power, and a very competitive advantage compared to SDRAMx32 (512Mb SDRAM x32 price example; 512Mb HPI price example)
  2. An other advantage of HPI versus OPI is active power, for the same amount of data tranfert, you can run HPI half of the time and consume much less power, spending more time in standby.

Below are illustrations of pin count & power benefit of OPI versus SDRAMx16 & HPI versus SDRAMx32


Hope this help


View solution in original post

ST Employee

Hi, what tweak of IOs setting you implemented? I may have a try to see if it's easy to reproduce this issue. thanks!



Thanks for the follow up. I have no idea where to begin my response to your specific question. If you take a look at the attached screen shot you will notice that all data pins of the OCTOSPI1 are shown in YELLOW.  It is not clear to me if this is just a 'notification' or that it will actually cause operational errors.

  • My fundamental question is: Has anybody actually got the HSPI working with the specific PSRAM populated on the  'STM32U5A9J-DK' board in memory-mapped mode with an x16 bus width -- I have not seen any proof (i.e. examples, projects, etc.) that it has been demonstrated anywhere other than a claim in the documentation that it is 'supposed to work'.
  • The PSRAM included in the Design Kit is an x8 Serial PSRAM and I can only assume that the system will have to be set up to use the double transfer rate to achieve the x16 transfer. In this case, do I configure the HSPI as a single x16 or as dual-x8?

Thanks for your help again.


ST Employee

Hello @RMand 

According to the screenshot you have shared, the GPIO settings are not inline with default configuration in STM32U5A9J-DK. You can refer to schematics for details. Also, you are missing some parameters in the settings.

We suggest you the following project. It shows how to erase, write and read data on HSPI configured as a single x16 STM32Cube\Repository\STM32Cube_FW_U5_V1.3.0\Projects\STM32U5x9J-DK\Examples\BSP

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.

Hi @FBL 

I am attaching a newly created configuration generated by CubeMX when I select the 'STM32U5A9J-DK' board. If you load it up in your local install of CubeMX you will see that the default configuration also shows the 8 data lines of OSPI1 as 'in conflict'...... 

The web GUI does not allow me to upload the .ioc file so I am trying it now with a .txt extension.



And thanks for the pointer to the example -- I will review it now.

I do not see a IOC configuration file for the BSP example.  Where can I get one?

>>I do not see a IOC configuration file for the BSP example.  Where can I get one?

Manually crafted content does not use / come from .IOC configuration files.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Ooops, I clicked on the wrong button....

I wanted to say that the example listed above does NOT USE MEMORY MAPPED mode for the HSPI PSRAM. My original question was about any active projects that show the operation of the AP512 PSRAM in memory mapped mode over the HSPI interface.


The DMA example perhaps gets the closest.


(++) The memory access can be configured in memory-mapped mode with the call of function BSP_HSPI_RAM_EnableMemoryMapped(). To go back in indirect mode, the function BSP_HSPI_RAM_DisableMemoryMapped() should be used.


File also pulled via  STM32Cube_FW_U5_V1.3.0\Projects\STM32U5x9J-DK\Templates\TrustZoneDisabled\STM32CubeIDE\.project

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..