How to enable FreeRTOS with LVGL 9.5 running on STM32N6570-DK board?

Hi everyone,

I am working on the STM32N6570-DK board and trying to run LVGL v9.5 with FreeRTOS, but I am facing issues integrating both properly.

What I have done so far:

  • Enabled FreeRTOS (CMSIS-RTOS v2)
  • Integrated LVGL v9.5 into the project
  • Initialized display and LVGL successfully (basic UI works without RTOS)

Issue:

  • When I enable FreeRTOS and run LVGL inside a task, and display behaves unexpectedly
  • It shows garbage pixels on display
  • Suspecting issues with:
    • lv_timer_handler() execution timing
    • Thread safety / mutex handling
    • Tick increment (lv_tick_inc) integration

What I tried:

  • Running lv_timer_handler() in a dedicated task with delay
  • Using mutex (xSemaphore) for LVGL calls
  • Checking stack size and task priority

Questions:

  1. What is the correct way to integrate LVGL 9.5 with FreeRTOS?
  2. How should lv_timer_handler() and lv_tick_inc() be handled in RTOS?
  3. Is there any official or recommended template for STM32N6 series?
  4. Are there any specific configurations required for STM32N6570-DK?

Additional Info:

  • MCU: STM32N657
  • LVGL Version: 9.5
  • RTOS: FreeRTOS (CMSIS v2)

Any guidance or working example would be really helpful.

Thanks in advance!

I mean this is still valid Operating system and interrupts — LVGL documentation

and primary you dont require lv_tick_inc , but hw based timer for lv_tick get
for example in arduino ESP simple is

lv_tick_set_cb(millis);

and main idea is place all lvgl parts in one task. Otherwise as describe docu.

1 Like

Hello,

Speaking from experience using the ThreadX RTOS,
If you are sure that you are initializing LVGL correctly, and your flush callback works, you should call lv_timer_handler() from your thread’s (I suppose FreeRTOS calls them ‘tasks’) main loop.

lv_tick_inc() should be called from an interrupt where you can fairly accurately gaurantee the ticks you need. So lv_tick_inc(1) from a 1000hz timer interrupt for instance.

Do not bother with multithreading LVGL itself, so long as you call all LVGL functions from other LVGL functions, it should work fine.

@Radhika-Changela Have you enabled FreeRTOS on lv_conf.h?

https://docs.lvgl.io/9.5/integration/rtos/freertos.html

Yes! I enabled LV_USE_FREERTOS in lv_conf.h

I have successfully integrated LVGL on the STM32N6570-DK board with FreeRTOS enabled (LV_USE_FREERTOS = 1). The basic UI works correctly.

However, when I run the LVGL benchmark demo, it completes successfully, but I observe tearing artifacts, especially with complex UI objects.

System Setup:

  • MCU: STM32N6570-DK (Cortex-M55)
  • OS: FreeRTOS
  • LVGL: (mention your version here)
  • Display driver: lv_st_ltdc.c
  • Rendering mode: Direct rendering
  • Buffering:
    • Single framebuffer
    • Size: 800 × 480 × 2 (full screen)

LVGL Configuration:

  • LV_USE_FREERTOS = 1
  • LVGL task is created as the default task in app_freertos.c
  • lv_timer_handler() is called inside the idle loop

Issue:

  • No crash or functional issue
  • Benchmark demo runs fully
  • Visible tearing occurs, especially during heavy UI updates

What I Tried:

  • Verified display initialization
  • Using LTDC driver from LVGL (lv_st_ltdc.c)
  • Single full-size buffer with direct mode

Question:

What could be the reason for tearing in this setup, and how can I fix it?


Additional Info:

I have attached the following files for reference:

  • main.c
  • app_freertos.c
  • lvgl_port.c
  • lv_st_ltdc.c

lvgl_port.c (2.7 KB)
main.c (30.4 KB)
lv_st_ltdc.c (11.0 KB)

@Radhika-Changela , great job. Are you interested in creating a tutorial about this integration for the LVGL Blog?

If you’re interested, create documentation in Google Docs and share it with the LVGL Team.

Hello @Radhika-Changela
Could you share app_freertos.c ? It is missing from your last reply.
Best regards
rom_st

this config exactly result to tearing and glitchs…