cancel
Showing results for 
Search instead for 
Did you mean: 

External PSRAM not working when using SBSFU

RamaKrishna
Associate II

Hi,

In my application using stm32l496zgt6 I'm using DCMI to capture Image and storing image Data in External PSRAM  , this code works fine, Problem is whenever integrating this piece of code with application using SBSFU, As soon as MX_FMC_Init(); function is called in main(); MemManage_Handler is being called and application is freezing here.  I just wanted to know if MPU settings of SBSFU is causing this problem or anything I'm missing with respect to SBSFU that i have to take care while using External memories.

3 REPLIES 3
Jocelyn RICARD
ST Employee

Hello @RamaKrishna,

Yes, SBSFU on STM32L4 enables MPU to limit code execution on active SLOT.

You can check easily if MPU is the issue by deactivating this protection in app_sfu.h : SFU_MPU_USERAPP_ACTIVATION

Best regards

Jocelyn

RamaKrishna
Associate II

Hi, 

Thanks, and sorry for the delayed response, whenever I disable the MPU, Application is able to access the PSRAM, but is there any way to keep the MPU enabled and also use PSRAM.

Please suggest, Thanks in advance. 

Jocelyn RICARD
ST Employee

Hello @RamaKrishna ,

On STM32L4, all 8 MPU areas are already used.

To be able to give access to PSRAM you will need to take one area and remove the associated protection.

The easiest way is to take the last area (Area 7) used to set the last 64KB of first bank as non executable. When disabled, an attacker could potentially write some code in this area and execute it later. This attacker would have previously found a weakness in your code through an remote connection in order to take control over execution. I let you evaluate the risk. 

Then you can change the configuration in sfu_low_level_security.h

APP_PROTECT_MPU_AREA_HIDE_START and following to cover your PSRAM area.

Best regards

Jocelyn