Skip to main content
Wrend.1
Associate III
December 28, 2020
Question

Screen tearing in a fixed area, how to avoid it.

  • December 28, 2020
  • 6 replies
  • 4156 views

The screen tearing issue is as below. It looks always appear in the right area:

0693W000006GwEqQAK.gif​The screen is FMC16 bit parallel port, and the parameter is as below:

0693W000006GwKFQA0.pngAnd the screen has TE signal, the TE Interrupt function is an below:

 void TouchGFX_TickHandler(uint8_t PinStatus)
 {
			if (os_inited == true)
			{
				if (PinStatus) /* Raising edge : entering Active Area */
				{
					HAL::getInstance()->vSync();
					OSWrappers::signalVSync();
					// Swap frame buffers immediately instead of waiting for the task to be scheduled in.
					// Note: task will also swap when it wakes up, but that operation is guarded and will not have
					// any effect if already swapped.
					HAL::getInstance()->swapFrameBuffers();
					GPIO::set(GPIO::VSYNC_FREQ);
				}
				else /* Falling edge : exiting active area */
				{
					GPIO::clear(GPIO::VSYNC_FREQ);
					HAL::getInstance()->frontPorchEntered();
				}
			}
 }

Can anyone tell me what caused the screen to tear? And can I avoid it by program.​

This topic has been closed for replies.

6 replies

Alexandre RENOUX
Visitor II
January 5, 2021

Hello Wrend.1,

Are you sure it is related to FMC ?

What MCU do you use ? Is the white box part of your GUI ?

/Alexandre

Wrend.1
Wrend.1Author
Associate III
January 5, 2021

I don't know if the FMC related to it.:sad_but_relieved_face:

The MCU is H750VBTx, and the white box is the part of my GUI, I write it for observing the tearing phenomenon.

Alexandre RENOUX
Visitor II
January 5, 2021

What is the resolution of your display ?

If your display is an FMC display, it has an embedded GRAM right ?

Do you invalidate the whole screen ? You can check by pressing F2 key on your keyboard when running the simulator.

Tearing effect happens when you have bad synchronization between TouchGFX and your display. It can also happen if the GUI requires too much computing power but this is not the case here.

So actually if your display interface is FMC, you are right to check the parameters for this display. Unfortunately I don't know about your custom display.

Maybe you can refer to the Application Template for L496-DISCO available on TouchGFX Designer. This project uses FMC as a display interface.

/Alexandre

Wrend.1
Wrend.1Author
Associate III
January 6, 2021

The resolution is 320*170,

it has an embedded GRAM right like this:

namespace {
 // Use the section "TouchGFX_Framebuffer" in the linker to specify the placement of the buffer
 LOCATION_PRAGMA("TouchGFX_Framebuffer")
 uint32_t frameBuf[(320 * 170 * 2 + 3) / 4] LOCATION_ATTRIBUTE("TouchGFX_Framebuffer");
 uint32_t animationStorage[(320 * 170 * 2 + 3) / 4] LOCATION_ATTRIBUTE("TouchGFX_Framebuffer");
}
 
void TouchGFXGeneratedHAL::initialize()
{
 HAL::initialize();
 
 registerEventListener(*(touchgfx::Application::getInstance()));
 
 setFrameBufferStartAddresses((void*)frameBuf, (void*)0, (void*)animationStorage);
 /*
 * Set whether the DMA transfers are locked to the TFT update cycle. If
 * locked, DMA transfer will not begin until the TFT controller has finished
 * updating the display. If not locked, DMA transfers will begin as soon as
 * possible. Default is true (DMA is locked with TFT).
 */
 lockDMAToFrontPorch(true);
}

,and I invalidate the whole screen( I change the white box position and invalidate the screen in a tick event).

I will read the demo of L496-DISCO for some solution, my code is according to F412 demo, there have not much difference.

Alexandre RENOUX
Visitor II
January 6, 2021

Hello Wrend.1,

If you don't use LTDC, you should not lock DMA to front Porch. Can you make sure in TouchGFXHAL.cpp in void TouchGFXHAL::initialize() you have the line lockDMAToFrontPorch(false); ?

With a H750 updating an area of 370x170 should be quite easy in terms of computing power, so I believe tearing comes from something else like wrong synchronization between your screen and your MCU.

/Alexandre