Showing results for 
Search instead for 
Did you mean: 

STM32F469i Touchgfx Working but Slow/Low Framerate/Flickering

Senior II

After a month of headbanging I have finally produced picture on the STM32F469I-DISCO with DSI 800x480 screen that had no noise both during animations and not (unlike my previous attempts)

My config:

Windows 10

STM32CubeIDE 1.6.1

TouchGFX 4.16.1

Using BSP files stm32469_discovery.c/stm32469_discovery_lcd.c/... for SDRAM, LCD (and whatever their dependencies are, just a few files with definitions mainly)

So, I have finally produced a full 800x480 picture with animation, that looks good, except that:

3000ms animation takes some 12s to complete (counted in mind, estimate), barely dragging, but still smooth, just takes too long

I have specific LTDC frequency (27429kHz, default from BSP file) and porch values (randomly found to work), which I cannot change at all, even a bit. If I change anything at all there, the picture goes crazy in different ways.

The screen is strongly flickering, seemingly with each frame.

If I reduce porch values, I get higher framerate, but the image messes up - I get some diagonal tearing and/or random color changes (red stuff flickers with green or blue or purple for a moment every now and then, solid color boxes flicker with random colors too, very trippy). If I reduce porches further, the entire image becomes corrupted. Using any sort of recommended values from the datasheets of the display drivers, whichever it is - NT35510 or OTM8009A - neither produces normal picture. Basically I found good values by accident by trying all possible value there are, almost brute force. No other values than my current produce picture without tearing or random noise during animation. Another point: I'm using the display in landscape mode, for which datasheet of OTM8009A has NO specification - it has porch value tables only for portrait 480x800, not 800x480, I tried switching the vertical and horizontal values around, and just like all other datasheet values that I tried, they don't work and only ruin image.

If I change LTDC frequency and the corresponding values in stm32469i_discovery_lcd.c (frequency value as well as PLL configuration values of all those dividers), the image becomes garbage immediately.

So, in stm32469_discovery_lcd.c, I have the following:

uint32_t LcdClock  = 27429; /*!< LcdClk = 27429 kHz */
/* lcd_orientation == LCD_ORIENTATION_LANDSCAPE */
    VSA  = (uint16_t)480;        /* 12 */
    VBP  = (uint16_t)150;          /* 12 150*/
    VFP  = (uint16_t)150;          /* 12 150*/
    HSA  = (uint16_t)800;        /* 120 */
    HBP  = (uint16_t)36;          /* 120 34*/
    HFP  = (uint16_t)36;          /* 120 34*/
    lcd_x_size = (uint16_t)800;  /* 800 */
    lcd_y_size = (uint16_t)480; /* 480 */
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
PeriphClkInitStruct.PLLSAI.PLLSAIN = 384; //original: 384
PeriphClkInitStruct.PLLSAI.PLLSAIR = 7; //original: 7
PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2; //original: RCC_PLLSAIDIVR_2

This kind of configuration produces perfect image if not for 1/4 speed (3000ms executed for over 10s, perfectly smoothly tho, just slowly).

I have tried to calculate porches given possible frequency and pixel count - active area and porches included - those porch values only destroyed image although they had to work.

Any suggestions on how to improve the situation? So that 3000ms animation played actual 3000ms and so that I had some usable FPS? Am I missing something crucial?