cancel
Showing results for 
Search instead for 
Did you mean: 

STM32N6570-DK: LCD flickers when boot from flash

p5n
Associate II

Hello,

I have an application that shows image from camera from time to time on the screen. This app flashed at 0x7010'0000 and works well when I run FSBL in dev mode from debugger.

But if I flash this FSBL at 0x7000'0000 and switch to flash boot app works in general (according to uart output and ethernet activity) but screen flickers.

Sometimes correct image appears for very short time.

What can cause the problem?

(FSBL is almost unmodified Projects/STM32N6570-DK/Templates/Template_FSBL_XIP)

4 REPLIES 4
Saket_Om
ST Employee

Hello @p5n 

If your app or framebuffer is in XIP flash, and the cache is not set up for non-cached access, you may see stale or inconsistent data.

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.
Saket_Om

Do you mean MPU settings? App is in nor flash, framebuffer in PSRAM, I have separate non-cacheable segment in .ld file which is also configured in MPU, but PSRAM is not configured in MPU

  /* create an attribute configuration for the MPU */
  attr_config.Attributes = INNER_OUTER(MPU_WRITE_BACK | MPU_NON_TRANSIENT | MPU_RW_ALLOCATE);
  attr_config.Number = MPU_ATTRIBUTES_NUMBER0;

  HAL_MPU_ConfigMemoryAttributes(&attr_config);

  /* Create a region associated with memory address 0x70000000 */
  /*Normal memory type, code execution allowed */
  default_config.Enable = MPU_REGION_ENABLE;
  default_config.Number = MPU_REGION_NUMBER0;
  default_config.BaseAddress = 0x70000000;
  default_config.LimitAddress = 0x78000000-1;
  default_config.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
  default_config.AccessPermission = MPU_REGION_ALL_RO;
  default_config.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
  default_config.AttributesIndex = MPU_ATTRIBUTES_NUMBER0;
  HAL_MPU_ConfigRegion(&default_config);

  /* create an attribute configuration for the MPU */
  attr_config.Attributes = INNER_OUTER(MPU_NOT_CACHEABLE);
  attr_config.Number = MPU_ATTRIBUTES_NUMBER1;

  HAL_MPU_ConfigMemoryAttributes(&attr_config);

  /* Create a non cacheable region */
  /*Normal memory type, code execution unallowed */
  default_config.Enable = MPU_REGION_ENABLE;
  default_config.Number = MPU_REGION_NUMBER1;
  default_config.BaseAddress = __NON_CACHEABLE_SECTION_BEGIN;
  default_config.LimitAddress =  __NON_CACHEABLE_SECTION_END;
  default_config.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
  default_config.AccessPermission = MPU_REGION_ALL_RW;
  default_config.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
  default_config.AttributesIndex = MPU_ATTRIBUTES_NUMBER1;
  HAL_MPU_ConfigRegion(&default_config);

 

Hello @p5n 

it's always better to have PSRAM area declared as executable Never.

 

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.
Saket_Om

Moving framebuffer to SRAM helps, but configuring PSRAM as MPU_NOT_CACHEABLE and MPU_INSTRUCTION_ACCESS_DISABLE does not help

 

extern uint32_t __spsram;
extern uint32_t __epsram;
#define __PSRAM_SECTION_BEGIN ((uint32_t) &__spsram)
#define __PSRAM_SECTION_END   ((uint32_t) &__epsram)
...
  /* create an attribute configuration for the MPU */
  attr_config.Attributes = INNER_OUTER(MPU_NOT_CACHEABLE);
  attr_config.Number = MPU_ATTRIBUTES_NUMBER2;

  HAL_MPU_ConfigMemoryAttributes(&attr_config);

  /* Create a non cacheable region */
  /*Normal memory type, code execution unallowed */
  default_config.Enable = MPU_REGION_ENABLE;
  default_config.Number = MPU_REGION_NUMBER2;
  default_config.BaseAddress = __PSRAM_SECTION_BEGIN;
  default_config.LimitAddress =  __PSRAM_SECTION_END;
  default_config.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
  default_config.AccessPermission = MPU_REGION_ALL_RW;
  default_config.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
  default_config.AttributesIndex = MPU_ATTRIBUTES_NUMBER2;
  HAL_MPU_ConfigRegion(&default_config);