Description
Hi, I’m trying to display an image with LVGL on ESP32.
I have set up a proper File System for LVGL. The set source function works. but When I tried to align it somewhere in the middle of the screen, it just fails to do so and crashes.
I have tried to check the problem with the SD card, the path. It works with no problem, I have enabled LVGL debugging, and there was no errors.
Code to reproduce
void initLVGL() {
lv_init();
lv_log_register_print_cb(my_lvgl_debug_print);
lv_port_sd_fs_init(); //This one worked with no problem at all
lv_disp_draw_buf_init(&draw_buf, buf1, NULL, TFT_WIDTH * TFT_HEIGHT / 10); /*Initialize the display buffer.*/
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
disp_drv.flush_cb = my_disp_flush; /*Set your driver function*/
disp_drv.draw_buf = &draw_buf; /*Assign the buffer to the display*/
disp_drv.hor_res = TFT_WIDTH; /*Set the horizontal resolution of the display*/
disp_drv.ver_res = TFT_HEIGHT; /*Set the vertical resolution of the display*/
lv_disp_t *disp = lv_disp_drv_register(&disp_drv);
lv_indev_drv_init(&indev_drv); /*Basic initialization*/
indev_drv.type = LV_INDEV_TYPE_POINTER; /*Touch pad is a pointer-like device*/
indev_drv.read_cb = my_touchpad_read; /*Set your driver function*/
lv_indev_drv_register(&indev_drv); /*Finally register the driver*/
disp->refr_timer->period = (uint32_t)(1000 / FPS);
//Set the background image
lv_obj_t *theme = lv_img_create(lv_scr_act());
lv_img_set_src(theme, "S:images/sir.jpg");
lv_obj_align(theme, LV_ALIGN_CENTER, 0, 0);
}
ESP32 backtrace when crashes
Core 1 register dump:
PC : 0x400ee06c PS : 0x00060930 A0 : 0x800ecad8 A1 : 0x3ffde9f0
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x00000032 A5 : 0x00000009
A6 : 0x00000008 A7 : 0x3ffc9c58 A8 : 0x0000ffff A9 : 0x3ffc9cf4
A10 : 0x0000a759 A11 : 0x00000037 A12 : 0x3ffdea0c A13 : 0x00000022
A14 : 0xffffffff A15 : 0x00000018 SAR : 0x0000001d EXCCAUSE: 0x0000001c
EXCVADDR: 0x0000a75f LBEG : 0x400f4e6d LEND : 0x400f4e90 LCOUNT : 0x00000002
Backtrace: 0x400ee069:0x3ffde9f0 0x400ecad5:0x3ffdea30 0x400edc60:0x3ffdea50 0x400ec014:0x3ffdea70 0x400ec4ce:0x3ffdead0 0x400ec515:0x3ffdeaf0 0x400ec552:0x3ffdeb10 0x400efd8a:0x3ffdeb30 0x400f51f0:0x3ffdeb80 0x400d8c10:0x3ffdebb0 0x40116989:0x3ffdebd0
#0 0x400ee069:0x3ffde9f0 in get_prop_core at .pio/libdeps/esp32doit-devkit-v1/lvgl/src/core/lv_obj_style.c:602
(inlined by) lv_obj_get_style_prop at .pio/libdeps/esp32doit-devkit-v1/lvgl/src/core/lv_obj_style.c:229
#1 0x400ecad5:0x3ffdea30 in lv_obj_get_style_border_width at .pio/libdeps/esp32doit-devkit-v1/lvgl/src/core/lv_obj_style_gen.h:255
(inlined by) lv_obj_get_scroll_bottom at .pio/libdeps/esp32doit-devkit-v1/lvgl/src/core/lv_obj_scroll.c:149
#2 0x400edc60:0x3ffdea50 in lv_obj_readjust_scroll at .pio/libdeps/esp32doit-devkit-v1/lvgl/src/core/lv_obj_scroll.c:640
#3 0x400ec014:0x3ffdea70 in lv_obj_refr_size at .pio/libdeps/esp32doit-devkit-v1/lvgl/src/core/lv_obj_pos.c:203
(inlined by) lv_obj_refr_size at .pio/libdeps/esp32doit-devkit-v1/lvgl/src/core/lv_obj_pos.c:80
#4 0x400ec4ce:0x3ffdead0 in layout_update_core at .pio/libdeps/esp32doit-devkit-v1/lvgl/src/core/lv_obj_pos.c:1144
#5 0x400ec515:0x3ffdeaf0 in layout_update_core at .pio/libdeps/esp32doit-devkit-v1/lvgl/src/core/lv_obj_pos.c:1137 (discriminator 3)
#6 0x400ec552:0x3ffdeb10 in lv_obj_update_layout at .pio/libdeps/esp32doit-devkit-v1/lvgl/src/core/lv_obj_pos.c:316
(inlined by) lv_obj_update_layout at .pio/libdeps/esp32doit-devkit-v1/lvgl/src/core/lv_obj_pos.c:301
#7 0x400efd8a:0x3ffdeb30 in _lv_disp_refr_timer at .pio/libdeps/esp32doit-devkit-v1/lvgl/src/core/lv_refr.c:308
#8 0x400f51f0:0x3ffdeb80 in lv_timer_exec at .pio/libdeps/esp32doit-devkit-v1/lvgl/src/misc/lv_timer.c:313
(inlined by) lv_timer_handler at .pio/libdeps/esp32doit-devkit-v1/lvgl/src/misc/lv_timer.c:109
#9 0x400d8c10:0x3ffdebb0 in loop() at .pio/libdeps/esp32doit-devkit-v1/lvgl/src/lv_api_map.h:37
(inlined by) loop() at src/main.cpp:69
#10 0x40116989:0x3ffdebd0 in loopTask(void*) at C:/Users/Admin/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:50
ELF file SHA256: bc5d3a0d23459708
I appreciate any help!