2024-05-14 08:56 PM
Hi,
I'm using a custom H7 board, with QSPI + 16-bit SDRAM, and using RTOS.
However I run into an issue where there's glitching in my gauge in TouchGFX (see attached video...)
TouchGFX is using double buffer, also animationStorage:
setFrameBufferStartAddresses((void*)0xC0000000, (void*)0xC0177000, (void*)0xC0400000);
A few points:
- I'm able to read/write to QSPI & SDRAM correctly
- Static images appear correctly
- Glitch also appears on the whole screen during transition from one image to another
MPU:
static void MPU_Config(void)
{
MPU_Region_InitTypeDef MPU_InitStruct;
/* Disable the MPU */
HAL_MPU_Disable();
/* Configure the MPU attributes for region 0 */
/* Configure the MPU attributes for SDRAM to normal memory*/
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER0;
MPU_InitStruct.BaseAddress = 0xC0000000;
MPU_InitStruct.Size = MPU_REGION_SIZE_256MB;
MPU_InitStruct.SubRegionDisable = 0x0;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
/* Configure the MPU attributes for region 1 */
/* Configure the MPU attributes for the frontbuffer to normal memory*/
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER1;
MPU_InitStruct.BaseAddress = 0xC0000000;
MPU_InitStruct.Size = MPU_REGION_SIZE_1MB;
MPU_InitStruct.SubRegionDisable = 0x0;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
/* Configure the MPU attributes for region 2 */
/* Configure the MPU attributes for the backbuffer to normal memory*/
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER2;
MPU_InitStruct.BaseAddress = 0xC0200000;
MPU_InitStruct.Size = MPU_REGION_SIZE_1MB;
MPU_InitStruct.SubRegionDisable = 0x0;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
/* Configure the MPU attributes for region 3 */
/* Configure the MPU attributes for Quad-SPI area to strongly ordered memory*/
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER3;
MPU_InitStruct.BaseAddress = 0x90000000;
MPU_InitStruct.Size = MPU_REGION_SIZE_64MB;
MPU_InitStruct.SubRegionDisable = 0x0;
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_NOT_SHAREABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
/* Configure the MPU attributes for region 4 */
/* Configure the MPU attributes for QSPI memory to normal memory*/
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER4;
MPU_InitStruct.BaseAddress = 0x90000000;
MPU_InitStruct.Size = MPU_REGION_SIZE_16MB;
MPU_InitStruct.SubRegionDisable = 0x0;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct.AccessPermission = MPU_REGION_PRIV_RO;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
/* Enable the MPU */
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
}
Clock Configurations:
- System: 480 MHz
- FMC : 150 MHz
- LTDC : 20.15 MHz
- QUADSPI : 150 MHz
My LTDC & TouchGFX Configurations:
Can anyone please tell me why this happens? Thanks..
2024-05-20 03:05 AM - edited 2024-05-20 03:06 AM
if you are being able to see proper GUI without animations, but when changing from one to another screen and getting a glitch, i have solved it from different sources:
it happened to me once with wrong MPU and Cache configurations.
Then, it happened to me also with a wrong SDRAM configuration, in this case i did not have glitch at all, but something like "lossing frames"
And the last time i had it, i have provided more memory to heap/stack(talking about the RTOS task memory, the touchGFX task). I am not the best coder, so i made some kind of spagetti and was destroying the memory, i noted and provided more memory, it wasnt the cleanest, but worked.
Greetings
2024-05-30 12:10 PM
Yes, the framebuffer swapping works OK, I've checked this using the oscilloscope and swapFrameBuffers() is called. This is the glitch that happens during the transition between two images (screencapture):
2024-05-30 12:18 PM
Thanks for the reply.
I think the SDRAM is already functioning properly, as data is written without corruption, and static image is not corrupt as well..
For RTOS, we are using TOTAL_HEAP_SIZE = 40000 Bytes and touchGFX task has a stack size of 8192 Words.
Could you please tell us where the MPU and Cache configurations might be wrong? We've tried so many combinations for the MPU and it's still not working..
And is it possible to set an MPU config for DMA2D?
BR
2024-06-03 04:32 AM
It is not an exact way to try, but may you try to put for example 16Kb of total Heap and use like, 12Kb of those? Give it a shoot.
2024-06-03 10:16 AM
Hello
Have you check this post, its pretty similar problem,
Br JTP
2024-06-21 04:38 AM
Hello @wlynn777 ,
Have you made any progress on this topic?
2024-06-23 08:24 PM
Not yet, unfortunately. We suspect there's a problem with the LCD framebuffer as the LCD we're using is not branded, so we're looking for a different one. We'll keep this thread updated.
2024-08-31 12:54 AM
2024-08-31 01:48 AM
You read Introduction to LCD-TFT display controller (LTDC) on STM32 MCUs - Application note?
Primary chapter 5.5.3.
Plus your LTDC config is 800x480 , is this native real for your display ? Have your display internal memory for FB?
Wich core H7 run GUI?
2024-10-07 07:28 AM
Yes, that is the real LCD size, the display doesn't have internal memory.
The STM32H743ZIT6 only has one core..
Still figuring it out.