Random Crashes ... Cannot figure out why

Hi,

For most part, my code appears to be running smoothly, but every once in a while, especially after screen changes, or end of spinner use, and sometimes while the screen is just displaying some data like the current time, I will get crashes.

From the logs I cannot pinpoint the cause, but appears to be related with LVGLs low level memory block freeing routines.

I’m Using an ESP32-S3, with 8MB Flash and 2 MB PSRAM. (Devkit)
I have an iliI9488 display driver based on the ESP-IDF ESP-LCD drivers.
I’m driving the display using i8080 driver, and 8 Bit Parallel.
The display is really crisp and very responsive.
I’m using LVGL 8.1 as a managed ESP-IDF component, and this is super cool.

I’m attaching the logs below from two separate occasions:
Occasion 1:

Heap summary for capabilities 0x00001000:
  At 0x3de00000 len 2097151 free 2035755 allocated 58980 min_free 2032355
    largest_free_block 2031616 alloc_blocks 49 free_blocks 2 total_blocks 51
  At 0x3fcaace8 len 217880 free 88128 allocated 127336 min_free 78084
    largest_free_block 75776 alloc_blocks 29 free_blocks 3 total_blocks 32
  At 0x3Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x420daef1  PS      : 0x00060b30  A0      : 0x8203d6e8  A1      : 0x3fcb4f60
0x420daef1: remove_free_block at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/misc/lv_tlsf.c:592 (discriminator 2)

A2      : 0x3fc9f038  A3      : 0x3fca1644  A4      : 0x00000003  A5      : 0x00000000
A6      : 0x3fca005c  A7      : 0x00000000  A8      : 0x001f001d  A9      : 0x3fcb4f40
A10     : 0x00000000  A11     : 0x001b0019  A12     : 0x3fcb4f84  A13     : 0x00000168
A14     : 0x3c1351b0  A15     : 0x00000000  SAR     : 0x0000001e  EXCCAUSE: 0x0000001d
EXCVADDR: 0x001b0025  LBEG    : 0x40056f5c  LEND    : 0x40056f72  LCOUNT  : 0xffffffff


Backtrace:0x420daeee:0x3fcb4f600x4203d6e5:0x3fcb4f80 0x4203d831:0x3fcb4fb0 0x4203b35e:0x3fcb4fd0 0x4202b26c:0x3fcb5010 0x4202bb95:0x3fcb5070 0x4204a37a:0x3fcb5090 0x4203e3b9:0x3fcb51f0 0x4204151b:0x3fcb52c0 0x420d98b5:0x3fcb5300 0x42020343:0x3fcb5320 0x420203ee:0x3fcb5340 0x42027d89:0x3fcb5380 0x42027e1a:0x3fcb53d0 0x42027e59:0x3fcb5420 0x42028437:0x3fcb5440 0x42028617:0x3fcb54b0 0x42028702:0x3fcb54e0 0x42028780:0x3fcb5500 0x4203d0cd:0x3fcb5530 0x4203d17e:0x3fcb5550 0x42008a72:0x3fcb5570 0x40382a5d:0x3fcb5590
0x420daeee: remove_free_block at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/misc/lv_tlsf.c:591 (discriminator 2)

0x4203d6e5: block_locate_free at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/misc/lv_tlsf.c:776 (discriminator 2)

0x4203d831: lv_tlsf_malloc at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/misc/lv_tlsf.c:1102

0x4203b35e: lv_mem_alloc at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/misc/lv_mem.c:132

0x4202b26c: circ_calc_aa4 at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/draw/lv_draw_mask.c:1270

0x4202bb95: lv_draw_mask_radius_init at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/draw/lv_draw_mask.c:524

0x4204a37a: lv_draw_arc at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/draw/lv_draw_arc.c:111

0x4203e3b9: lv_arc_draw at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/widgets/lv_arc.c:574

0x4204151b: lv_arc_event at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/widgets/lv_arc.c:542

0x420d98b5: lv_obj_event_base at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_event.c:97

0x42020343: event_send_core at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_event.c:415

0x420203ee: lv_event_send at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_event.c:74

0x42027d89: lv_refr_obj at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_refr.c:708

0x42027e1a: lv_refr_obj at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_refr.c:745

0x42027e59: lv_refr_obj_and_children at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_refr.c:643

0x42028437: lv_refr_area_part at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_refr.c:578

0x42028617: lv_refr_area at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_refr.c:484 (discriminator 2)

0x42028702: lv_refr_areas at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_refr.c:395

0x42028780: _lv_disp_refr_timer at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_refr.c:216

0x4203d0cd: lv_timer_exec at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/misc/lv_timer.c:313 (discriminator 2)

0x4203d17e: lv_timer_handler at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/misc/lv_timer.c:109

0x42008a72: lv_task_handler at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/lv_api_map.h:37
 (inlined by) guiTask at C:\ESP32\Projects\loadassist-s3\build/../main/main.c:381

0x40382a5d: vPortTaskWrapper at C:/esp/esp-idf/components/freertos/port/xtensa/port.c:131

Occasion 2:

I (1116844) loadassist_gui: Battery MV from Queue = 13900, Now branch and update icon...
W (1116854) Loadassist Wifi: WIFI rssi:-23

I (1116854) loadassist_gui: Scale Battery Icon Set for corresponding mVolts: 13900
I (1116864) loadassist_gui: SetBattIconTask High Water Mark --- 2048
I (1116874) loadassist_gui: WifiStatus Queue = -23, Now branch and update icon...
I (1116884) loadassist_gui: WIFI SIGNAL Excellent -23 dBm
I (1116884) loadassist_gui: SetWifiIconTask High Water Mark --- 2036
I (1126844) loadassist_adc: Raw: 1527   Voltage: 1270mV

I (1126844) loadassist_adc: Converted Voltage: 13868mV

I (1126844) loadassist_gui: Battery MV from Queue = 13868, Now branch and update icon...
W (1126854) Loadassist Wifi: WIFI rssi:-24

I (1126854) loadassist_gui: Scale Battery Icon Set for corresponding mVolts: 13868
I (1126864) loadassist_gui: SetBattIconTask High Water Mark --- 2048
I (1126874) loadassist_gui: WifiStatus Queue = -24, Now branch and update icon...
I (1126884) loadassist_gui: WIFI SIGNAL Excellent -24 dBm
I (1126884) loadassist_gui: SetWifiIconTask High Water Mark --- 2036
I (1136844) loadassist_adc: Raw: 1558   Voltage: 1296mV

I (1136844) loadassist_adc: Converted Voltage: 14152mV

I (1136844) loadassist_gui: Battery MV from Queue = 14152, Now branch and update icon...
W (1136854) Loadassist Wifi: WIFI rssi:-25

I (1136854) loadassist_gui: Scale Battery Icon Set for corresponding mVolts: 14152
I (1136864) loadassist_gui: SetBattIconTask High Water Mark --- 2048
I (1136864) loadassist_gui: WifiStatus Queue = -25, Now branch and update icon...
I (1136884) loadassist_gui: WIFI SIGNAL Excellent -25 dBm
I (1136884) loadassist_gui: SetWifiIconTask High Water Mark --- 2036
I (1146844) loadassist_adc: Raw: 1570   Voltage: 1307mV

I (1146844) loadassist_adc: Converted Voltage: 14272mV

I (1146844) loadassist_gui: Battery MV from Queue = 14272, Now branch and update icon...
W (1146854) Loadassist Wifi: WIFI rssi:-22

I (1146854) loadassist_gui: Scale Battery Icon Set for corresponding mVolts: 14272
I (1146864) loadassist_gui: SetBattIconTask High Water Mark --- 2048
I (1146874) loadassist_gui: WifiStatus Queue = -22, Now branch and update icon...
I (1146884) loadassist_gui: WIFI SIGNAL Excellent -22 dBm
I (1146884) loadassist_gui: SetWifiIconTask High Water Mark --- 2036
Guru Meditation Error: Core  1 panic'ed (StoreProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x420daef1  PS      : 0x00060e30  A0      : 0x8203d6e8  A1      : 0x3fcb4f20  
0x420daef1: remove_free_block at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/misc/lv_tlsf.c:592 (discriminator 2)

A2      : 0x3fc9f038  A3      : 0x3fca19e4  A4      : 0x00000000  A5      : 0x00000013
A6      : 0x00000170  A7      : 0x3fca19ec  A8      : 0x3fc9f038  A9      : 0x00000000  
A10     : 0x00000001  A11     : 0x0082a4ee  A12     : 0x80382d0d  A13     : 0x3fcf6210
A14     : 0x00060023  A15     : 0x00000003  SAR     : 0x0000000f  EXCCAUSE: 0x0000001d
EXCVADDR: 0x0082a4fa  LBEG    : 0x40056f5c  LEND    : 0x40056f72  LCOUNT  : 0xffffffff


Backtrace:0x420daeee:0x3fcb4f200x4203d6e5:0x3fcb4f40 0x4203d831:0x3fcb4f70 0x4203b35e:0x3fcb4f90 0x4202b26c:0x3fcb4fd0 0x4202bb95:0x3fcb5030 0x4202be81:0x3fcb5050 0x4202c14e:0x3fcb50a0 0x4202e189:0x3fcb5160 0x420225db:0x3fcb5180 0x4202301a:0x3fcb5230 0x420d98b5:0x3fcb5260 0x42020343:0x3fcb5280 0x420203ee:0x3fcb52a0 0x42027d89:0x3fcb52e0 0x42027e1a:0x3fcb5330 0x42027e1a:0x3fcb5380 0x42027e1a:0x3fcb53d0 0x42027e59:0x3fcb5420 0x4202842a:0x3fcb5440 0x42028617:0x3fcb54b0 0x42028702:0x3fcb54e0 0x42028780:0x3fcb5500 0x4203d0cd:0x3fcb5530 0x4203d17e:0x3fcb5550 0x42008a72:0x3fcb5570 0x40382a5d:0x3fcb5590
0x420daeee: remove_free_block at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/misc/lv_tlsf.c:591 (discriminator 2)

0x4203d6e5: block_locate_free at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/misc/lv_tlsf.c:776 (discriminator 2)

0x4203d831: lv_tlsf_malloc at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/misc/lv_tlsf.c:1102

0x4203b35e: lv_mem_alloc at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/misc/lv_mem.c:132

0x4202b26c: circ_calc_aa4 at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/draw/lv_draw_mask.c:1270

0x4202bb95: lv_draw_mask_radius_init at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/draw/lv_draw_mask.c:524

0x4202be81: shadow_draw_corner_buf at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/draw/lv_draw_rect.c:894

0x4202c14e: draw_shadow at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/draw/lv_draw_rect.c:501

0x4202e189: lv_draw_rect at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/draw/lv_draw_rect.c:105

0x420225db: lv_obj_draw at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_obj.c:540

0x4202301a: lv_obj_event at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_obj.c:843

0x420d98b5: lv_obj_event_base at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_event.c:97

0x42020343: event_send_core at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_event.c:415

0x420203ee: lv_event_send at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_event.c:74

0x42027d89: lv_refr_obj at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_refr.c:708

0x42027e1a: lv_refr_obj at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_refr.c:745

0x42027e1a: lv_refr_obj at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_refr.c:745

0x42027e1a: lv_refr_obj at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_refr.c:745

0x42027e59: lv_refr_obj_and_children at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_refr.c:643

0x4202842a: lv_refr_area_part at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_refr.c:575

0x42028617: lv_refr_area at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_refr.c:484 (discriminator 2)

0x42028702: lv_refr_areas at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_refr.c:395

0x42028780: _lv_disp_refr_timer at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_refr.c:216

0x4203d0cd: lv_timer_exec at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/misc/lv_timer.c:313 (discriminator 2)

0x4203d17e: lv_timer_handler at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/misc/lv_timer.c:109

0x42008a72: lv_task_handler at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/lv_api_map.h:37
 (inlined by) guiTask at C:\ESP32\Projects\loadassist-s3\build/../main/main.c:381

0x40382a5d: vPortTaskWrapper at C:/esp/esp-idf/components/freertos/port/xtensa/port.c:131

If you need some code to help with getting to the bottom of this, please let me know.
Thx

I suggest enabling Logging and asserts in lv_conf.h.
Hopefully they will show an issues.

Thx @kisvegabor , I increased the Log levels substantially and ticked all LVGL Asserts in KConfig, as I’m using ESP-IDF.

It looks to be a memory issue with lv_mem_alloc.
I included the heap summary in the log, just prior to the crash.
Any ideas, or suggestions.

[Info]  (233.420, +258)  lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
W (239223) packhouse_weigh: Adding Home EventCB to NavButton
I (239223) packhouse_weigh: Starting vADS1231ReadBitBangIntrTask on Core 0-------------------
I (239223) packhouse_weigh: Create UART Event Task on Core 1---------------------------
I (239233) packhouse_weigh: Now we are weighing ........
[Info]  (233.520, +100)  lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (233.526, +6)    flex_update: update 0x3fca01c0 container       (in lv_flex.c line #211)
[Info]  (233.540, +14)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (233.954, +414)  lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (234.144, +190)  lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (234.646, +502)  lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (235.146, +500)  lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (235.148, +2)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (235.468, +320)  indev_proc_press: pressed at x:14 y:42         (in lv_indev.c line #782)
[Info]  (235.538, +70)   indev_proc_press: pressed at x:14 y:42         (in lv_indev.c line #782)
[Info]  (235.588, +50)   indev_proc_release: released   (in lv_indev.c line #930)
I (241523) packhouse_weigh: WEIGH task usage stats ...
W (241523) packhouse_weigh: xADS1231ReadBitBangIntrTask 80 of 724
W (241523) packhouse_weigh: xRefreshDateTimeTask 300 of 1148
W (241533) packhouse_weigh: xUartRfidEventTask 1340 of 2048
W (241543) packhouse_weigh: xCalcScaleParamsTask 352 of 1024
W (241543) packhouse_weigh: xSetScaleReadoutTask 1360 of 2048
W (241553) packhouse_weigh: xManageRFIDTask 1352
W (241563) packhouse_weigh: xSetScaleIndicatorTask 368 of 1024
W (241563) packhouse_weigh: xSetScaleDateTimeTask 464 of 1024
I (241573) packhouse_weigh: GLOBAL task usage stats ...
W (241583) packhouse_weigh: xBatteryReadout 5524 of 2048
W (241583) packhouse_weigh: xRSSIReadout 5524 of 2048
W (241583) packhouse_weigh: xLCDTouchBacklightGPIOTask 5524 of 2048
W (241603) packhouse_weigh: xSetBatteryIconTask 656 of 2048
W (241603) packhouse_weigh: xSetWifiIconTask 592 of 2048
Heap summary for capabilities 0x00001000:
  At 0x3de00000 len 2097151 free 2035571 allocated 59164 min_free 2028771
    largest_free_block 2031616 alloc_blocks 50 free_blocks 2 total_blocks 52
  At 0x3fcaacf0 len 217872 free 90688 allocated 124768 min_free 70588
    largest_free_block 69632 alloc_blocks 33 free_blocks 16 total_blocks 49
  At 0x3fce0000 len 60980 free 840 allocated 57724 min_free 840
    largest_free_block 0 alloc_blocks 209 free_blocks 0 total_blocks 209
  At 0x3fcf0000 len 32768 free 6536 allocated 23816 min_free 244
    largest_free_block 2368 alloc_blocks 50 free_blocks 5 total_blocks 55
  At 0x600fe028 len 8136 free 5720 allocated 0 min_free 5720
    largest_free_block 5632 alloc_blocks 0 free_blocks 1 total_blocks 1
  Totals:
    free 2139355 allocated 265472 min_free 2106163 largest_free_block 2031616
W (241683) packhouse_home: Adding PowerDownEventCB
[Info]  (235.960, +372)  lv_btn_create: begin   (in lv_btn.c line #51)
[Info]  (235.968, +8)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (235.980, +12)   lv_btn_create: begin   (in lv_btn.c line #51)
[Info]  (235.982, +2)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (235.986, +4)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (236.010, +24)   lv_label_create: begin         (in lv_label.c line #75)
[Info]  (236.012, +2)    lv_btn_create: begin   (in lv_btn.c line #51)
[Info]  (236.014, +2)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (236.030, +16)   lv_label_create: begin         (in lv_label.c line #75)
[Info]  (236.032, +2)    lv_meter_create: begin         (in lv_meter.c line #56)
[Info]  (236.034, +2)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (236.050, +16)   lv_label_create: begin         (in lv_label.c line #75)
I (241773) packhouse_home: Create RefreshDateTimeTask on Core 0---------------------------
I (241783) packhouse_home: Create vSetScaleDateTimeTask on Core 1---------------------------
[Info]  (236.080, +30)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (236.086, +6)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (236.100, +14)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (236.556, +456)  lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (237.056, +500)  lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (237.058, +2)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (237.556, +498)  lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (237.658, +102)  indev_proc_press: pressed at x:239 y:123       (in lv_indev.c line #782)
[Info]  (237.728, +70)   indev_proc_press: pressed at x:239 y:123       (in lv_indev.c line #782)
[Info]  (237.788, +60)   indev_proc_release: released   (in lv_indev.c line #930)
I (243513) loadassist_gui: ShowSpinnerTask High Water Mark on visible --- 2616
[Info]  (237.800, +12)   lv_dropdown_create: begin      (in lv_dropdown.c line #93)
[Info]  (237.802, +2)    lv_btn_create: begin   (in lv_btn.c line #51)
[Info]  (237.806, +4)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (237.820, +14)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (237.822, +2)    flex_update: update 0x3fca01c0 container       (in lv_flex.c line #211)
[Info]  (237.840, +18)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (237.840, +0)    lv_btn_create: begin   (in lv_btn.c line #51)
[Info]  (237.844, +4)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (237.860, +16)   lv_dropdown_create: begin      (in lv_dropdown.c line #93)
[Info]  (237.862, +2)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (237.866, +4)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (237.880, +14)   lv_label_create: begin         (in lv_label.c line #75)
[Info]  (237.882, +2)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (237.888, +6)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (237.900, +12)   lv_label_create: begin         (in lv_label.c line #75)
[Info]  (237.902, +2)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (237.920, +18)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (237.922, +2)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (237.926, +4)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (237.940, +14)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (237.942, +2)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (237.948, +6)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (237.960, +12)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (237.964, +4)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (237.980, +16)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (237.982, +2)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (237.988, +6)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (238.000, +12)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.002, +2)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.020, +18)   lv_label_create: begin         (in lv_label.c line #75)
[Info]  (238.022, +2)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (238.024, +2)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.040, +16)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.042, +2)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (238.046, +4)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.060, +14)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.062, +2)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (238.068, +6)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.080, +12)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.084, +4)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (238.100, +16)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.102, +2)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.108, +6)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (238.120, +12)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.122, +2)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.140, +18)   lv_label_create: begin         (in lv_label.c line #75)
[Info]  (238.142, +2)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.144, +2)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.154, +10)   lv_label_create: begin         (in lv_label.c line #75)
[Info]  (238.170, +16)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.170, +0)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.176, +6)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (238.190, +14)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.192, +2)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.208, +16)   lv_label_create: begin         (in lv_label.c line #75)
[Info]  (238.210, +2)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.214, +4)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.230, +16)   lv_obj_create: begin   (in lv_obj.c line #210)
[Info]  (238.232, +2)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (238.234, +2)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (238.250, +16)   lv_obj_create: begin   (in lv_obj.c line #210)
[Info]  (238.252, +2)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (238.254, +2)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (238.270, +16)   lv_obj_create: begin   (in lv_obj.c line #210)
[Info]  (238.272, +2)    lv_label_create: begin         (in lv_label.c line #75)
[Info]  (238.272, +0)    lv_textarea_create: begin      (in lv_textarea.c line #87)
[Info]  (238.288, +16)   lv_label_create: begin         (in lv_label.c line #75)
[Info]  (238.290, +2)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.298, +8)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.312, +14)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.314, +2)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.318, +4)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (238.330, +12)   lv_btnmatrix_create: begin     (in lv_btnmatrix.c line #83)
[Error] (238.332, +2)    lv_mem_alloc: couldn't allocate memory (56 bytes)      (in lv_mem.c line #138)
[Error] (238.350, +18)   lv_mem_alloc: used:  32712 (100 %), frag:  36 %, biggest free:     36  (in lv_mem.c line #143)
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x420242c1  PS      : 0x00060030  A0      : 0x82023a5d  A1      : 0x3fcb5380  
0x420242c1: lv_obj_mark_layout_as_dirty at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_obj_pos.c:287

A2      : 0x00000000  A3      : 0x00000000  A4      : 0x3c146bc0  A5      : 0x3c146d90
A6      : 0x0000000c  A7      : 0x3c147c00  A8      : 0x8203c52c  A9      : 0x3fcb52f0
A10     : 0x00000000  A11     : 0x3c146bc0  A12     : 0x0000008f  A13     : 0x3c146d90
A14     : 0x3c146c40  A15     : 0x0000002a  SAR     : 0x00000004  EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000022  LBEG    : 0x400556d5  LEND    : 0x400556e5  LCOUNT  : 0xfffffffe


Backtrace:0x420242be:0x3fcb53800x42023a5a:0x3fcb53a0 0x4204408a:0x3fcb53c0 0x420120d6:0x3fcb53e0 0x4200edaa:0x3fcb5410 0x4202096d:0x3fcb5440 0x420209f6:0x3fcb5460 0x42020d8a:0x3fcb54a0 0x42021c4a:0x3fcb54c0 0x42021d9d:0x3fcb54e0 0x4203e349:0x3fcb5520 0x4203e422:0x3fcb5550 0x42009026:0x3fcb5570 0x40382a5d:0x3fcb5590
0x420242be: lv_obj_mark_layout_as_dirty at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_obj_pos.c:286

0x42023a5a: lv_obj_class_init_obj at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_obj_class.c:105

0x4204408a: lv_btnmatrix_create at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/widgets/lv_btnmatrix.c:85

0x420120d6: packhouse_weigh_open at C:\ESP32\Projects\loadassist-s3\build/../main/packhouse_weigh.c:389

0x4200edaa: packhouse_weigh_open_event_cb at C:\ESP32\Projects\loadassist-s3\build/../main/packhouse_home.c:219

0x4202096d: event_send_core at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_event.c:421

0x420209f6: lv_event_send at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_event.c:74

0x42020d8a: indev_proc_release at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_indev.c:943

0x42021c4a: indev_pointer_proc at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_indev.c:368

0x42021d9d: lv_indev_read_timer_cb at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/core/lv_indev.c:100

0x4203e349: lv_timer_exec at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/misc/lv_timer.c:313 (discriminator 2)

0x4203e422: lv_timer_handler at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/misc/lv_timer.c:109

0x42009026: lv_task_handler at C:\ESP32\Projects\loadassist-s3\build/../managed_components/lvgl__lvgl/src/lv_api_map.h:37
 (inlined by) guiTask at C:\ESP32\Projects\loadassist-s3\build/../main/main.c:381

0x40382a5d: vPortTaskWrapper at C:/esp/esp-idf/components/freertos/port/xtensa/port.c:131

I also got an assert a while later:

I (25273) loadassist_gui: ShowSpinnerTask High Water Mark on invisible --- 2628
[Info]  (17.500, +570)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (17.560, +60)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
W (25473) packhouse_weigh: Adding Home EventCB to NavButton
I (25473) packhouse_weigh: Starting vADS1231ReadBitBangIntrTask on Core 0-------------------
I (25473) packhouse_weigh: Create UART Event Task on Core 1---------------------------
I (25483) packhouse_weigh: Now we are weighing ........
[Info]  (17.740, +180)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (17.772, +32)    flex_update: update 0x3fca01c0 container       (in lv_flex.c line #211)
[Info]  (17.776, +4)     lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Error] (17.924, +148)   lv_tlsf_check: Asserted at expression: block_is_prev_free(block_next(block)) && "block should be free"         (in lv_tlsf.c line #873)
I (26843) loadassist_adc: Raw: 1537     Voltage: 1279mV

Also:

[Info]  (110.602, +2)    lv_textarea_create: begin      (in lv_textarea.c line #87)
[Info]  (110.618, +16)   lv_label_create: begin         (in lv_label.c line #75)
[Info]  (110.618, +0)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (110.626, +8)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Info]  (110.640, +14)   lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #311)
[Error] (110.642, +2)    lv_mem_realloc: couldn't allocate memory       (in lv_mem.c line #199)
[Error] (110.646, +4)    get_local_style: Asserted at expression: obj->styles != NULL (Out of memory)   (in lv_obj_style.c line #488)
W (124953) Loadassist Wifi: WIFI rssi:-23

I (124953) loadassist_gui: WifiStatus Queue = -23, Now branch and update icon...

Just increase LV_MEM_SIZE in menuconfig or lv_conf.h

Hi, @kisvegabor
I raised my LV_MEM_SIZE to 64kB from 32kB and sorted the problem.

Before you made the suggestion, I actually tried using custom malloc/free, and not the built-in lv_mem_alloc() and lv_mem_free().

This also solved the problem, and I managed more than 12 hours of weighing without any crashes :grinning:, and not only solved the problem, but dramatically increased the responsiveness of the screen, so that scrolling now very fast, and keyboard nice and fast too.

Why would this be the case, as surely your memory management routines lv_mem_alloc are optimized for LVGL?

1 Like

So with standard malloc/free it’s faster then with lv_mem_alloc/free? If so it’s possible. LVGL’s memory manager is generally good, but there can be better platform specific implementations.

Are you using ESP32? I’ve never worked with the hardware personally, but if I understand correctly it has more than one type of RAM available. It’s possible the LVGL heap got put in a slower RAM area. Just an educated guess.

Hi there

I did spend some hours in this problem without success and after implement your correction (custom mem alloc/free) it worked! No more crashes! Thank you for share.

Regards,
Leonardo

Hi @wreyford @leonardo96
Can you please share you stdlib.h that has the custom mem alloc in it.
I am having the same issue but I can not manage to use the custom option. Where do you set the memory size when in custom option? I do not see anything in menuconfig.

Thanks

Hi @kisvegabor

I am having the same issue in Keil IDE, but it works fine in stm32cube ide. how to edit these two functions (lv_mem_alloc, lv_mem_free) to get rid of this problem. I used malloc(size) & free(data) from stdlib but it didn’t work in both IDE.

I’m quite confident that the built-in malloc/free works in a reliable way and the problem is in the application code somewhere.

So I suggest trying to fing that error by

  • enabling LV_USE_ASSERT_*s
  • in lv_mem.c enable LV_MEM_ADD_JUNK

The ultimate debug option is to develop the UI on PC and use ASAN.

If you really want to use the standard malloc/free you should just set LV_MEM_CUSTOM 1.