cancel
Showing results for 
Search instead for 
Did you mean: 

Screen dithering problem.

ABURM
Senior

Hi guys.

I am using STM32H7B3LIHQ MCU, MX25LM51245GXDI00 flash and IS42S32800J-6BLI RAM with NHD-4.3-800480CF-ASXP-CTP TFT screen. I configured the LTDC, FMC, OCTOSPI, TouchGFX and FREERTOS settings. I have a 2 problem.

1- I added textArea in the screen for trying. I am increasing the "counter" register and displaying its value in the textArea at 100 mS intervals. But counter register does not inreasing the 100mS intervals, it increasing in 1000mS intervals. FREERTOS TICK_RATE_Hz = 1000 and this is code;

void screenView::handleTickEvent()
{
    static int tickCount = 0;
    if (tickCount++ >= 100)
    {
    	Unicode::snprintf(textArea1Buffer, TEXTAREA1_SIZE, "%u",counter);
    	textArea1.invalidate();
        tickCount = 0;
    }
    if (counter >= 17000) counter = 0;
    else counter++;
}

2- I added an image with a resolution of 800x480 to the screen. The textarea is on this image. Every time I refresh the screen (textArea1:invalidate()), the screen dithering. But sometimes (1 time in 10 refreshes etc.) it doesn't dithering.

I can share cubemx settings, codes or schematics. What is the problem?

1 ACCEPTED SOLUTION

Accepted Solutions
ABURM
Senior

Hi guys.

I solved the problem. FMC clock configuration and parameters were wrong. Screen dithering fixed. Video and another components (textarea etc.) is working perfectly.

handleTickEvent() It still doesn't work as it should. But it's not a big deal. But it is interesting that the St employes do not care about this post.

View solution in original post

10 REPLIES 10
ABURM
Senior

Guys, this is the Cubemx LTDC settings;


LTDC.pnglayer.png

 

 

 

 

 

and this is the TFT screen timing diagram and input timing requirements;
timing.pngTFT.png

LTDC frequency is 29.2MHz.
LTDC freq.png

 

 

 

 

There is an interesting situation here. I change the signal polarities in cubemx and look at the signals with an oscilloscope. Changing the HSYNC and VSYNC signal polarities has no effect on the display. Horizantal syncronization polarity high or low and vertical syncronization polarity high or low it is not important. I added a 216x216 video to an 800x480 image. The video plays normally. But dithering problem is continue. Do you have any idea for this problem?

ABURM
Senior

Hi guys.

I solved the problem. FMC clock configuration and parameters were wrong. Screen dithering fixed. Video and another components (textarea etc.) is working perfectly.

handleTickEvent() It still doesn't work as it should. But it's not a big deal. But it is interesting that the St employes do not care about this post.

LouisB
ST Employee

Hello @ABURM ,

For the handle tick event, could you try :

 

void screenView::handleTickEvent()
{
    static int tickCount = 0;
    if (!(tickCount % 100))
    {
    	Unicode::snprintf(textArea1Buffer, TEXTAREA1_SIZE, "%u",counter);
    	textArea1.invalidate();
        counter ++;
    	tickCount = 0;
    }
    if (counter >= 17000) counter = 0;
}

the way you put the  counter ++ its incremented every ticks.

 

BR,

Louis BOUDO
ST Software Engineer | TouchGFX

Hi LouisB.

Thanks for simplifying the code.Do you have any idea about handleTickEvent() not being 1mS? This time increases for every component I add to the touchgfx project. For example, when I add the 216x216 example video, it becomes approximately 2mS.

Hello @ABURM ,

You may have a slower rendering due to the video processing which will increase the render time.

 

Br,

Louis BOUDO
ST Software Engineer | TouchGFX
codex174
Associate II

It sounds like your display timing and refresh handling might be off. The counter issue happens because `handleTickEvent()` runs with TouchGFX ticks, not directly with FreeRTOS timing. So even if your RTOS tick is 1 ms, TouchGFX usually runs at a slower frame rate (like 16–60 Hz), which explains the 1-second update delay.

For the screen dithering, it’s likely a frame buffer or LTDC sync issue, often caused by unaligned buffers or slow SDRAM access. Try enabling double buffering and check your LTDC clock and SDRAM timings. You can also test your display visually using a **Black Screen Test** to confirm whether the flicker comes from the panel or the refresh cycle itself.

the delay you’re seeing in the counter is because handleTickEvent() in TouchGFX doesn’t rely directly on FreeRTOS ticks but on the TouchGFX internal frame refresh rate. So, even though your system tick might be set to 1ms, if TouchGFX is running at 60Hz, your update function only gets called every 16ms or so. That’s why your counter seems to increase every second instead of every 100ms. If you need faster updates, you can move the counter logic to a separate FreeRTOS task and then send the value to the UI thread.

That makes sense. How can I check and test this properly? Should I start from the LTDC and SDRAM settings or first run a full Black Screen Test on the display to confirm if the issue is hardware-related?

You’re on the right track. You can start with a full Black Screen Test using this link: https://geo-peek.com/ doing that will help you confirm whether the flicker/dithering is coming from the panel or your system setup.

If the screen behaves cleanly (no flicker) during the Black Screen Test, then your hardware is likely okay and you should next dive into LTDC and SDRAM settings (timings, buffers, clock, D-cache, etc.) to fix the issue.