Hi,
I’m working on a project using LVGL 8.3 on a Raspberry Pi Pico 2W with HSTX for DVI/HDMI output. The UI is generated with LVGL, and the framebuffer is sent to the display using DMA via the HSTX peripheral.
Problem
When updating UI elements (e.g., labels), the screen turns blank.
- LVGL’s timer is running, and
flush_cb()is called as expected. - However, after the update, nothing appears on the display.
I’m using a single framebuffer(640*480) as the source for HDMI output. The HSTX peripheral with DMA continuously reads this framebuffer to generate the DVI/HDMI signal.
When LVGL updates the UI, it renders into a small draw buffer and then, flush_cb(), copies the updated region into the same framebuffer that HSTX is scanning out.
Because the Raspberry Pi Pico 2W has only about 520 KB of SRAM, a single framebuffer at 640×480 even in 8‑bit RGB332 format already consumes roughly 300 KB. Allocating a second full framebuffer for double buffering would exceed the available memory, so the design uses only one active framebuffer for scanout, which is why LVGL updates happen directly on the buffer being read by the HSTX peripheral.
below is our code snippet:
int main(void)
{
uint32_t counter = 0;
stdio_init_all();
init_hstx();
lv_init();
init_lvgl();
char buf[32];
// test_ui_init();
ui_init();
/* LVGL tick (1ms) */
static repeating_timer_t timer;
add_repeating_timer_ms(-1, lv_tick_cb, NULL, &timer);
// _ui_label_set_property(ui_speedtext,_UI_LABEL_PROPERTY_TEXT,"calling from main through helper"); //helper
// lv_label_set_text(ui_speedtext, "Hi"); //direct lvgl_call
init_dma();
while (true) {
// Update UI counter
if (counter % 100 == 0) {
char buf[32];
sprintf(buf, "%d\n", counter/100);
printf("no updates form main \n");
//lv_label_set_text(ui_Label1,buf);
//lv_arc_set_value(ui_Arc1,counter/2);
//directly calling lvgl
}
counter = counter > 1000 ? 0 : counter ++;
lv_timer_handler();
sleep_ms(100);
//counter++;
}
}
How can we safety update ui without causing any blank screen issues ?