I am repeatedly hitting the following assertion in LVGL 9.5.0:
LV_ASSERT_MSG(!disp->rendering_in_progress,
"Invalidate area is not allowed during rendering.");
The assertion occurs from inside my dedicated LVGL thread/task.
Enviroment
- Version: 9.5.0
- Color depth: 32-bit
- Doubled buffered
- Forked from Riverdies Repository
- Screen Generated with Squareline Studio
Hardware
- MCU: STM32H7
- Resolution: 1024x600
- Display: Riverdi RVT70HSSNWC00
Software Stack
- RTOS: FreeRTOS
- HAL: STM32 HAL
- Compiler: arm-none-eabi-gcc
- IDE: STM32CubeIDE
Problem Statement
I have a dedicated LVGL task that periodically calls:
lv_timer_handler();
The same task also updates several labels/widgets using functions like:
DashboardUI_SetSpeed(speed);
DashboardUI_SetRPM(rpm);
DashboardUI_SetBrake(brake);
Eventually the system hits:
LV_ASSERT_MSG(!disp->rendering_in_progress,
"Invalidate area is not allowed during rendering.");
From debugging, it appears the invalidation originates from inside the LVGL task itself.
Stack Trace
lv_inv_area() at lv_refr.c:286 0x80183ca
invalidate_area_core() at lv_obj_pos.c:1,448 0x8013ea0
lv_obj_invalidate_area() at lv_obj_pos.c:945 0x8013eec
lv_obj_invalidate() at lv_obj_pos.c:975 0x8013f74
lv_label_mark_need_refr_text() at lv_label.c:1,070 0x8044fd0
lv_label_set_text_vfmt() at lv_label.c:181 0x8045272
lv_label_set_text_fmt() at lv_label.c:153 0x8045294
DashboardUI_SetSpeed() at dashboard_ui.c:22 0x804c8b4
LVGLTimer() at freertos.c:316 0x8001392 0x800ee10
The assertion occurs while lv_label_set_text_fmt() attempts to invalidate the label after updating text.
Current LVGL thread
void LVGLTimer(void *argument)
{
TickType_t lastWake = xTaskGetTickCount();
for (;;)
{
uint16_t speed = VehicleState_GetSpeed();
uint16_t rpm = VehicleState_GetRPM();
...
lv_lock();
DashboardUI_SetSpeed(speed);
DashboardUI_SetRPM(rpm);
...
lv_unlock();
lv_lock();
lv_timer_handler();
lv_unlock();
vTaskDelayUntil(&lastWake, pdMS_TO_TICKS(66));
}
}
Additional Notes
I’ve also experimented with adding lv_lock()/lv_unlock() calls inside functions such as:
void DashboardUI_SetSpeed(uint16_t speed_kmh)
{
lv_lock();
lv_label_set_text_fmt(
ui_SpeedBaseTag,
"%u",
speed_kmh
);
lv_unlock();
}
However, this did not change the behavior.
Additional Symptoms
Once the assertions occurs, the system becomes unstable and other subsystems appear affected as well. for example:
- CAN interrupts eventually stop firing
- The debug UI element still seems to be updating despite the assertion being triggered.
Questions
- What should my next debugging steps be?
- Is my LVGL thread wrong? I believed I was following the correct structure with having only that thread touch the lv objects
- Has anyone else encountered this issue before?