cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX 4.25.0 - Visual Glitches with Fonts/Texts Stored in External NOR Flash

uilter
Senior

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.

Problem Description

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.

Current Workaround

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 ***********************************/

When I change FontFlashSection and TextFlashSection to >NOR_FLASH, the visual glitches appear.

Why This Is a Problem

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.

Environment

  • TouchGFX Version: 4.25.0
  • MCU: STM32H753BIT6
  • External SDRAM
  • External Memory: NOR Flash (memory-mapped via QSPI/OSPI)
  • Note: This same behavior has occurred in other projects as well, so it doesn't seem to be isolated to this specific board.

Questions

  1. Has anyone else experienced similar issues with fonts/texts stored in external flash?
  2. Are there any known timing, caching, or memory-mapped configuration considerations that could cause this behavior specifically for font data?
  3. Is there any additional debugging or diagnostic information I could gather to help identify the root cause?

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!

9 REPLIES 9
mƎALLEm
ST Employee

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.

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.

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 covering 4GB with NO_ACCESS and SubRegionDisable = 0x87 to prevent speculative access
  • Regions 1-4: My specific memory regions (AXI SRAM, SDRAM, SDRAM App, and External NOR Flash)
/* 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

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?

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.

Correct.

What make/model of External NOR Flash are you using here?

Show configuration/initialization code.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jumman_JHINGA
Senior III

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.

@Tesla DeLorean 

I'm using Winbond W25Q128JV.

The main config is:

  • memory-mapped mode
  • CPU runs at 480MHz
  • Clock source for QUADSPI is PLL2R at 200MHz, so the NOR runs at 100MHz

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.

 

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

 

Did you complete the tests? are you still facing the issue with the MPU config?

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.