Using LVGL on threadX

Hi,
I’m trying to add lvgl to a project that runs on threadX RTOS. And I have some questions regarding the optimal/good-practices when using lvgl functions inside threadX, or any other RTOS like FreeRTOS.

  1. Where to place lv_tick_inc(1): On a baremetal project for stm32, it usually placed inside either systick_handler or a dedicated timer isr. When implementing in an rtos, I can place inside a dedicated task that runs every 1ms. In that case I’m puzzled where to put lv_timer_handler(), is it ok to put the lv_timer_handler in the same task that hosts lv_tick_inc?.
  2. What are better strategies to use when updating elements in the UI from another thread(thread other than the thread that hosts key lv functions). Since there are a lot of elements in the UI Its unpractical to have mutexes or queues for each element.

Answers from the perspective of any RTOS is welcome, just want to know good-practices regard to this. Thanks in advance !

Environment

  • MCU/MPU/Board: STM32u5xx
  • LVGL version: 8.3

Hello,

I have used LVGL on ThreadX myself. For me the following works best:

  • Place lv_tick_inc() in a dedicated hardware timer interrupt
  • lv_timer_handler() in the main loop of my main thread

lv_timer_handler() and lv_tick_inc() should not be called in the same function, as your lv_tick_inc should be fairly accurate (i.e. in a hardware timer!)


EDIT:

I missed your second question, I don’t have any experience using LVGL from other threads, I have at times called LVGL functions from interrupts accidentally, and can tell you it just bricks up.
I really recommend keeping all of the UI functionality in one thread if you can, LVGL is not meant to be used in a mutlithreaded manner anyway.

Kind regards

1 Like

Thank you very much for the insight.