2026-01-06 3:48 AM
Hello everyone,
I'm experiencing an issue with TouchGFX 4.25.0 on a custom STM32H7-based board that we develop and sell as an OEM product, and I'm hoping someone can help me understand what might be causing it.
When fonts and texts are configured to be stored in the external NOR Flash memory, we observe undesirable visual glitches and artifacts, particularly affecting text rendering. However, when the same fonts and texts are kept in the internal Flash, everything renders correctly without any issues.
To avoid the problem, I've modified the linker script to force FontFlashSection and TextFlashSection into internal Flash, while only ExtFlashSection (for images/assets) goes to external NOR Flash:
/* TOUCHGFX Begin *********************************/
FontFlashSection :
{
*(FontFlashSection FontFlashSection.*)
*(.gnu.linkonce.r.*)
. = ALIGN(0x4);
} >FLASH
TextFlashSection :
{
*(TextFlashSection TextFlashSection.*)
*(.gnu.linkonce.r.*)
. = ALIGN(0x4);
} >FLASH
ExtFlashSection :
{
*(ExtFlashSection ExtFlashSection.*)
*(.gnu.linkonce.r.*)
. = ALIGN(0x4);
} >NOR_FLASH
/* TOUCHGFX End ***********************************/While this workaround is functional, fonts and texts can consume a significant amount of internal Flash memory, which becomes problematic in projects with limited internal Flash availability or when we need that space for application code.
I'd really appreciate any insights or suggestions. If there's any additional information I can share to help investigate this issue (memory configuration, screenshots of the glitches, HAL/clock settings, etc.), please let me know and I'll be happy to provide it.
Thank you in advance for your help!
2026-01-06 4:00 AM - edited 2026-01-06 6:08 AM
Hello,
My first thought is to configure the background MPU to prevent any CM7 speculative access to an invalid memory region.
Did you do that?
Please refer to any H7 example that contains that configuration:
static void MPU_Config(void)
{
MPU_Region_InitTypeDef MPU_InitStruct;
/* Disable the MPU */
HAL_MPU_Disable();
/* Configure the MPU as Strongly ordered for not defined regions */
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.BaseAddress = 0x00;
MPU_InitStruct.Size = MPU_REGION_SIZE_4GB;
MPU_InitStruct.AccessPermission = MPU_REGION_NO_ACCESS;
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER0;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct.SubRegionDisable = 0x87;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
/* Enable the MPU */
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
}
Then you need to enable the access for each memory region needed by your application one by one: QSPI, SDRAM etc ..
You can refer to this thread for that MPU background config in this post.
2026-01-06 5:39 AM
Hello @mƎALLEm,
Thank you so much for the quick and detailed response!
I've implemented the background region configuration you suggested. My updated MPU configuration now includes:
/* REGION 0: Background region - Prevents speculative access */
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER0;
MPU_InitStruct.BaseAddress = 0x00;
MPU_InitStruct.Size = MPU_REGION_SIZE_4GB;
MPU_InitStruct.SubRegionDisable = 0x87;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct.AccessPermission = MPU_REGION_NO_ACCESS;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
I will be running extensive tests throughout this week with fonts and texts stored in the external NOR Flash to confirm that the issue is fully resolved. I'll report back with the results once testing is complete.
Thanks again for pointing me in the right direction!
Best regards
2026-01-06 5:52 AM
Thank you for the feedback.
So if I understand well it seems the issue is resolved but you need to confirm by running extensive tests?
2026-01-06 5:59 AM
Correct.
2026-01-07 3:56 AM
What make/model of External NOR Flash are you using here?
Show configuration/initialization code.
2026-01-07 4:50 AM
hi @uilter i also faced the flickering issue .. when i was trying to load text from ext flash memory... increasing the speed of QSPI resolved my issue.
2026-01-07 4:51 AM
I'm using Winbond W25Q128JV.
The main config is:
Below is my init code:
void MX_QUADSPI_Init(void)
{
hqspi.Instance = QUADSPI;
hqspi.Init.ClockPrescaler = 1;
hqspi.Init.FifoThreshold = 1;
hqspi.Init.SampleShifting = QSPI_SAMPLE_SHIFTING_NONE;
hqspi.Init.FlashSize = 23;
hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_8_CYCLE;
hqspi.Init.ClockMode = QSPI_CLOCK_MODE_0;
hqspi.Init.FlashID = QSPI_FLASH_ID_1;
hqspi.Init.DualFlash = QSPI_DUALFLASH_DISABLE;
if (HAL_QSPI_Init(&hqspi) != HAL_OK)
{
Error_Handler();
}
if (W25Q128_Init() != HAL_OK)
{
Error_Handler();
}
if (W25Q128_EnableMemoryMappedMode() != HAL_OK)
{
Error_Handler();
}
}
We use the external loader from Clive Turvey - https://github.com/cturvey/stm32extldr.
This file - CLIVEONE-W25Q128_STM32H7XX-PF10-PG6-PF8-PF9-PF7-PF6
Let me know if you need another specifique information.
Thanks.
2026-01-07 4:55 AM
@jumman_JHINGA
Thanks for your message.
I already tried it, without success. My current clock is 100 MHz, so very enough.
We also use double buffer strategy, external SDRAM with FMC and DMA2D.
2026-01-07 5:00 AM
Did you complete the tests? are you still facing the issue with the MPU config?