Description
I am displaying an image file and after 8 similar actions I get an error. I increased the LV_Z_MEM_POOL_SIZE and it happened the 23rd time. It’s basically switching back and forth between two screens. The error is:
[00:05:10.079,772] lvgl: (310.079, +310079) lv_mem_realloc: couldn’t allocate memory (in lv_mem.c line #211)
[00:05:10.080,017] lvgl: (310.079, +0) lv_mem_buf_get: Asserted at expression: buf != NULL (Out of memory, can’t allocate a new buffer (increase your LV_MEM_SIZE/heap size)) (in lv_mem.c line #312)
I then get:
[00:05:14.020,324] lvgl: (314.020, +3941) _lv_inv_area: detected modifying dirty areas in render (in lv_refr.c line #212)
[00:05:14.020,538] lvgl: (314.020, +0) _lv_inv_area: detected modifying dirty areas in render (in lv_refr.c line #212)
[00:05:14.020,751] lvgl: (314.020, +0) _lv_inv_area: detected modifying dirty areas in render (in lv_refr.c line #212)
[00:05:14.020,996] lvgl: (314.020, +0) _lv_inv_area: detected modifying dirty areas in render (in lv_refr.c line #212)
[00:05:14.021,179] lvgl: (314.021, +1) _lv_inv_area: detected modifying dirty areas in render (in lv_refr.c line #212)
and finally:
[00:05:14.021,209] os: ***** BUS FAULT *****
[00:05:14.021,209] os: Precise data bus error
[00:05:14.021,209] os: BFAR Address: 0x22
[00:05:14.021,240] os: r0/a1: 0x00000000 r1/a2: 0x0000000a r2/a3: 0x00000001
[00:05:14.021,240] os: r3/a4: 0x000004c0 r12/ip: 0x200181f0 r14/lr: 0x000623f7
[00:05:14.021,270] os: xpsr: 0x41000000
[00:05:14.021,270] os: Faulting instruction address (r15/pc): 0x00062cce
[00:05:14.021,301] os: >>> ZEPHYR FATAL ERROR 25: Unknown error on CPU 0
[00:05:14.021,331] os: Current thread: 0x200092d0 (sysworkq)
[00:05:14.682,312] fatal_error: Resetting system
What MCU/Processor/Board and compiler are you using?
nRF5340 Development Kit
Zephyr w/nRF Connect for VS Code Add-In
What LVGL version are you using?
8.3
What do you want to achieve?
Switching screens without a crash.
What have you tried so far?
Increased from:
CONFIG_LV_Z_MEM_POOL_SIZE=16384
To:
CONFIG_LV_Z_MEM_POOL_SIZE=32768
Code to reproduce
There isn’t anything special about the code, but maybe I’m doing something wrong. In all but the last time I run this I see the icon. On the last one, I don’t see it.
screen_token = lv_obj_create(NULL);
lv_scr_load_anim(screen_token, LV_SCR_LOAD_ANIM_NONE, 0, 0, true);
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_black(), LV_PART_MAIN);
lv_obj_set_style_text_color(lv_scr_act(), lv_color_white(), LV_PART_MAIN);
screen_token_label = lv_label_create(lv_scr_act());
lv_obj_set_align(screen_token_label, LV_ALIGN_TOP_MID);
lv_obj_set_style_text_font(screen_token_label, &lv_font_montserrat_24, LV_PART_MAIN);
lv_label_set_text(screen_token_label, label);
screen_token_icon = lv_img_create(lv_scr_act());
lv_obj_set_align(screen_token_icon, LV_ALIGN_CENTER);
lv_obj_set_width(screen_token_icon, 150);
lv_obj_set_height(screen_token_icon, 150);
LOG_DBG("Setting image from file: %s", file_name);
lv_img_set_src(screen_token_icon, file_name);
LOG_DBG("Image set");