Can I estimate the time request of LCD fresh by a lv_task?

Hello friends.

I use a STM32F103 to drive my LCD with lvgl.

the flowing image show my screen.
the gauge needle drived by a lv_task.
In the lv_task, 1ms was defined.
The needle moved as sine cycle in 100 steps/cycle.

So, 100 ms is the cycle time the needle moved forward and back to start.
Actually, I count the time, 8 second (= 8,000 ms) is the real cycle time.

So, Can I say, my MCU need 80 ms to refresh my screen?


What is the resolution of the screen? STM32F103 is very slow to drive screens with “normal” resoltion.

How do you send the pixel to the screen? SPI or parallel? What is clock speed and bus width in case of parallel bus?

What is the size of the display buffer(s)?

Do you use DMA in flush_cb and 2 display buffers?

1 Like

Thank you sir.
You provide us a great GUI lib. Thank you very much.

Actually, I use STM32F103 just for a try. and I have plan to port my program to STM32F429.

In my project, I use a FSMC to transfor my CMD with LCD. It’s parallel I guess. clocl speed 36M.
LCD size 480*320 pixels. and I don’t use DMA.

I post the question just for discussing, if I can estimate my screen refresh speed by this easy calculation.

Than you, but it’s provided by a lot of contributors too! :slight_smile:

It should be the clock of the FSMC periphery, not the output the clock (clock of the parallel bus). The output clock is typically ~5 MHz for this kind of display. See STM Application note.

The refresh time is the sum of 2 factors:

  • Rendering time: depends on what needs to be rendered.
  • Display refresh time: time send the rendered data to the display

Display refresh time can be easily calculated.
The screen has 480x320 = 153,600 pixel. To send them with 5MHz takes 31 ms (assuming 16 bit-parallel port and 16 color depth).

Rendering time can vary a lot depending on the complexity of the UI. Let’s assume 20 instructions/pixel.
480 x 320 x 20 / 72M = 42 ms.

In total it is rendering time + display refresh time = 31 ms + 42 ms = 73 ms = 14 FPS. It’s when the whole screen is refreshed. If you press a button only its small area will be refreshed (e.g. 100x50 px)

However, if you use more objects, opacity, shadow, and other effects, rendering time can increase dramatically. I could easily measure 100 ms rendering time with an STM32F769 and 800x480 TFT using advanced effects.

You can reduce the total time by using DMA to send the data to the FSMC port. It allows LVGL to render into an other buffer while DMA works in the background. This way a total time will be MAX(rendering time, display refresh time)

1 Like