2025-08-05 3:14 AM
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)
2025-08-05 6:24 AM
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.
2025-08-05 10:40 AM
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);
2025-08-06 6:41 AM
Hello @p5n
it's always better to have PSRAM area declared as executable Never.
2025-08-08 4:08 AM
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);