cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot get OCTOSPI example for STM32U575ZI MCU to work

PKolo.1
Associate II

Hello everyone,

I am currently trying to connect a APS51208N PSRAM to a STM32U575ZIT6 using the OCTOSPI interface. I followed the steps for the first example in application note AN5050 (chapter 5.2.5, number 1). However when I step through the program, it goes into hard fault the second it has to read from the OCTOSPI2 memory bank at 0x70000000 (tried the OCTOSPI1 bank at 0x90000000 too, same result). The debugger shows an error when trying to access this memory too.

Additionally, there is a sporadic error when stepping over the EnableMemoryMapped function too, which says "Target is not responding, retrying..." and the debugger becomes non-reponsive. To be more precise, this is the line where the problem occurs (in HAL_OSPI_MemoryMapped):

MODIFY_REG(hospi->Instance->CR, (OCTOSPI_CR_TCEN | OCTOSPI_CR_FMODE),

                (cfg->TimeOutActivation | OSPI_FUNCTIONAL_MODE_MEMORY_MAPPED));

I have tested the code on two identical boards with identical results, so I think a faulty MCU can be ruled out.

I have added the project I set up as an attachment. Any hints or solutions would be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Aime
ST Employee

Hello @PKolo.1​ ,

Thanks for your description and the attached project, I will try to help you out through this issue 😉 .

I checked your project and yes it seems that you followed the step detailed in the application note AN5050, but you forgot to configure your external PSRAM.

The steps to set the external memory in memory mapped are :

  • Initialize the OCTOSPI pins
  • Configure the memory (Latency, drive strength, burst type)
  • Enable the memory mapped mode

In your case you need to add the second step. I checked the APS51208N datasheet, you need to configure the registers MR0 and MR8.

Please find a code example on how to connect an PSRAM AP Memory in memory on STM32U5 devices in the package STM32_Cube_FW_V1.x.x\Projects\B-U585I IOT02A\Examples\OCTOSPI\OSPI_PSRAM_MemoryMapped

Find attached the APS51208N datasheet and let me know if you need any additional support.

A.MVE

View solution in original post

2 REPLIES 2
Aime
ST Employee

Hello @PKolo.1​ ,

Thanks for your description and the attached project, I will try to help you out through this issue 😉 .

I checked your project and yes it seems that you followed the step detailed in the application note AN5050, but you forgot to configure your external PSRAM.

The steps to set the external memory in memory mapped are :

  • Initialize the OCTOSPI pins
  • Configure the memory (Latency, drive strength, burst type)
  • Enable the memory mapped mode

In your case you need to add the second step. I checked the APS51208N datasheet, you need to configure the registers MR0 and MR8.

Please find a code example on how to connect an PSRAM AP Memory in memory on STM32U5 devices in the package STM32_Cube_FW_V1.x.x\Projects\B-U585I IOT02A\Examples\OCTOSPI\OSPI_PSRAM_MemoryMapped

Find attached the APS51208N datasheet and let me know if you need any additional support.

A.MVE

Hello,

thanks for your reply. I have now tried the same code on the B-U585I-IOT02A board, and the SRAM is properly recognized. Upon further investigation I realized that the level shifter on my project board was simply configured incorrectly, so it turns out it was just a hardware problem. Thanks for your response regardless, it will be useful for fine-tuning the PSRAM.