What do you want to achieve?
Update a label
What have you tried so far?
beginner’s configuration (see below)
I am a newbee with lvgl matter and I intend to update an increasing counter in a lvgl label (LVGL 9.3.0). My screen is an ESP32-4827S043N device (Cheap Yellow Dislay) with following caracteristics:
ESP32 S3 WROOM1
TFT display 480 X 272 pixels, 4,3 inches
ST7262 driver (16 bits parallel interface)
RGB 16 bits depth
No touch function
I have been seeking some time to find the appropriate driver for this card, finally I found it on GitHub - rzeldent/esp32-smartdisplay: PlatformIO library LVGL Drivers for Sunton Smart display boards (CYD Cheap Yellow Display). This library supports these boards without any effort. ESP32-2432S024N/R/C, ESP32-2432S028R/C, ESP32-3248S035R/C, ESP32_8048S070N/C. Now this board is known in my platformio environnment, enabled for lvgl with rzeldent/esp32_smartdisplay and lovyanGFX libraries and I was able to run various examples available in lvgl9.3 documentation.
My environment is VSCode and platformio on a LINUX OS:
VSCode:
Version: 1.103.0
Commit: e3550cfac4b63ca4eafca7b601f0d2885817fd1f
Date: 2025-08-06T21:40:10.271Z
Electron: 37.2.3
ElectronBuildId: 12035395
Chromium: 138.0.7204.100
Node.js: 22.17.0
V8: 13.8.500258-electron.0
OS: Linux x64 6.15.9-201.fc42.x86_64
platformIO version:
$ pio system info
*****************************************************************************
Obsolete PIO Core v6.1.17 is used (previous was 6.1.18)
-------------------------- --------------------------------------------------
PlatformIO Core 6.1.17
Python 3.13.5-final.0
System Type linux_x86_64
Platform Linux-6.15.9-201.fc42.x86_64-x86_64-with-glibc2.41
File System Encoding utf-8
Locale Encoding UTF-8
PlatformIO Core Directory /home/admin/.platformio
PlatformIO Core Executable /usr/bin/platformio
Python Executable /usr/bin/python3
Global Libraries 0
Development Platforms 3
Tools & Toolchains 15
I use the Arduino platform within PLatformIO, not ESP-IDF.
Here is my PlatformIO.ini file:
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html<!-- Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base. -->
[env:esp32-4827S043N]
platform = espressif32
board = esp32-4827S043N
framework = arduino
monitor_speed = 115200
monitor_rts = 0
monitor_dtr = 0
monitor_filters = esp32_exception_decoder
build_flags =
-Ofast
-Wall
'-D LV_CONF_PATH="${platformio.include_dir}/lv_conf.h"'
'-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE'
'-D ESP_LCD_PANEL_IO_ADDITIONS_VER_MAJOR=1'
'-D ESP_LCD_PANEL_IO_ADDITIONS_VER_MINOR=0'
'-D ESP_LCD_PANEL_IO_ADDITIONS_VER_PATCH=1'
lib_deps =
lovyan03/LovyanGFX@^1.2.7
rzeldent/esp32_smartdisplay@^2.1.1
and main.cpp:
#include <Arduino.h>
#include <LGFX_AUTODETECT.hpp>
#include <esp32_smartdisplay.h>
#include "../.pio/libdeps/esp32-4827S043N/lvgl/examples/lv_examples.h"
#define TFT_HOR_RES 480
#define TFT_VER_RES 272
static LGFX tft;
/*LVGL draw into this buffer, 1/10 screen size usually works well. The size is in bytes*/
#define DRAW_BUF_SIZE (TFT_HOR_RES * TFT_VER_RES / 10 * (LV_COLOR_DEPTH / 8))
void *draw_buf_1;
void *draw_buf_2;
float cnt = 1.00;
lv_obj_t * label;
unsigned long lastTickMillis = 0;
// assign a Flush Callback:
void my_flush_cb(lv_display_t *disp, const lv_area_t *area, uint8_t *px_map) {
uint32_t w = lv_area_get_width(area);
uint32_t h = lv_area_get_height(area);
tft.startWrite();
tft.setAddrWindow(area->x1, area->y1, w, h);
tft.writePixels((lgfx::rgb565_t *)px_map, w * h);
tft.endWrite();
lv_disp_flush_ready(disp);
}
void lv_label_display_test(void)
{
lv_obj_t * label = lv_label_create(lv_screen_active());
lv_label_set_text(label, "counter: 1.00 \n");
}
void setup()
{
Serial.begin(115200);
smartdisplay_init();
lv_init();
lv_display_t * display1 = lv_display_create(TFT_HOR_RES, TFT_VER_RES); // create a display
draw_buf_1 = heap_caps_malloc(DRAW_BUF_SIZE, MALLOC_CAP_DMA | MALLOC_CAP_INTERNAL); //assign draw duffer
lv_display_set_buffers(display1, draw_buf_1, NULL, DRAW_BUF_SIZE, LV_DISPLAY_RENDER_MODE_PARTIAL);
lv_display_set_flush_cb(display1, my_flush_cb); //assign a flush callback
auto display = lv_display_get_default(); //
// lv_display_set_rotation(display, LV_DISPLAY_ROTATION_90);
// lv_display_set_rotation(display, LV_DISPLAY_ROTATION_180);
// lv_display_set_rotation(display, LV_DISPLAY_ROTATION_270);
smartdisplay_lcd_set_backlight(0.5); //esp32_smartdisplay command
// 0 no backlight
// 0.5 50%
// 1 full backlight
lv_label_display_test();
}
void loop()
{
// LVGL Tick Interface
unsigned int tickPeriod = millis() - lastTickMillis;
lv_tick_inc(tickPeriod);
lastTickMillis = millis();
// Update the UI
lv_timer_handler();
Serial.printf("counter: %4.2f \n", cnt);
/*
//begin of suspicious code
Serial.printf("lv_label_get_text: %s \n", lv_label_get_text(label));
lv_label_set_text_fmt(label, "counter: %4.2f \n", cnt);
//end of suspicious code
*/
cnt=cnt+1;
delay(2000);
}
I carefully red the display management section of lvgl 9.3 and based myself on informations from the lvgl forum to establish a beginner’s configuration.
As expected, the label “Count: 1.00” is correctly displayed on the screen but… never increments.
So i added a Serial.printf in loop() section and I noticed that this serial display no longer incremented as soon as I validated the suspicious section functions localized in loop().This behaviour is triggered when one (or both) commands of this suspicious section is uncommented. it seems that runtime is hanged upon these functions.
I made no change in my 9.3.0 lv_conf , but just enabled it by changing 0 to 1 at the top of the file.
I would greatly appreciate some clues in order to fix this issue.
Kind regards.
Philippe.