The screen may stuck


Program Framework:
The system is developed using FREERTOS 10.2+LVGL 7.11. Three tasks are created using FreeRTOS: Task A, responsible for creating LVGL pages with the highest priority, executing every 200ms; Task B, which only executes lv_task_handle, has the second-highest priority, and executes every 10ms; Task C performs other operations, with the lowest priority, executing every 100ms.

Normal Behavior:
Clicking on imgbtn causes its background to change to yellow and then revert to gray, followed by a transition to the next page.

Abnormal Behavior:
Upon clicking the btn_start button, there is a probability of the screen freezing and failing to transition to the next page.

Implementation of Buttons on the Page:
On the current page, there are two controls: imgbtn and cont. Imgbtn has three states: pressed, released, and lost. In its default state, imgbtn is gray. When pressed, imgbtn generates an LV_EVENT_PRESSED event, changing its color to yellow. Upon release, imgbtn generates an LV_EVENT_RELEASED event, restoring its color to gray and transitioning to the next page. When LV_EVENT_PRESS_LOST occurs, imgbtn reverts to gray. Additionally, there is a custom event that, every second, toggles the visibility of the cont control. The cont control has a transparent background with opacity set to 0, border opacity set to 255, and a white border color. It is initially set to be hidden.

What MCU/Processor/Board and compiler are you using?

GD32F470ZKT6 + KEIL5.36

What LVGL version are you using?


What do you want to achieve?

The screen no stuck.

What have you tried so far?

Upon enabling LVGL’s LOG and DEBUG, an invalid pointer error is indicated. The issue is traced to lv_obj_set_state, specifically lv_anim_set_start_cb(&a, trans_anim_start_cb), where the address of pointer ‘a’ changes. Therefore, I would like to inquire about why this pointer is changing and if there are methods to prevent such errors.

LVGL single-threaded design, it is unsafe to use LVGL API directly across threads.
For details, please see the documentation: Operating system and interrupts — LVGL documentation.
If you want to achieve the effect of regularly refreshing the UI, it is recommended to use timer.