ESP32-S3 crashes when switching between screens

What do you want to achieve?

Switch between screen 1 and 2 with a button

What have you tried so far?

Create a button and adding an event to change between screen 1 and 2

Screenshot or video

Others

  • SquareLine Studio version:
    1.2.0
  • Operating system:
    Ubuntu 20.04.5 LTS
  • Target hardware:
    ESP32-S3

I have a custom PCB with an ESP32-S3 MCU on it. I want to swap between screen 1 and screen 2 with a button, and I have added a button for each screen to trigger an event to swap between the screens. Inside the SquareLine editor, it works as expected, but when I export te UI code to my project and try to press the button, the MCU goes into panic mode. Is there a known bug with swapping between screens? Any suggestions on what to try next? I am using a RGB LCD with this example code for esp-idf: esp-idf/examples/peripherals/lcd/rgb_panel at master · espressif/esp-idf · GitHub

Best regards,
Marcus

Please enable the logging of LVGL. Hopefully it will show something useful.

Thank you, I was not aware that this is an option. I will try it and get back to you.

Ok, so I have tried turning on the logging. When I did, I got a lot of error messages, similar to those described here [IDF 5.0] type 'uint32_t' {aka 'long unsigned int'} (IDFGH-8001) · Issue #9511 · espressif/esp-idf · GitHub. Anyways, I fixed the issues by casting all the variables as integers, and it compiled successfully. Unfortunately, no relevant logging info showed up before the system crashed again.

Forgot to mention this earlier, but I was running LVGL 8.2.0, so I thought I’d try upgrading to 8.3.0 to see if that would resolve the issue. Now I am able to switch back and fourth between the two screens once, but then the same happens. When I comment out the “lv_scr_load_anim” function, nothing happens and the system is stable, so I’m guessing it has something to do with the integration of what happens in lv_scr_load_anim and the ESP32-S3 that is not working very well together… Any further suggestions?

EDIT: seems to be related to this issue:

Can you send an example project here or via email (contact@squareline.io) so that we can reproduce the issue? I think it will crash in the simulator too.

Sure! I have added you to my Github repository, and will send you a link with the repo on email. Thank you for looking at this.

I’ve just tried it out in a simulator on PC but unfortunately it haven’t crashed for me. :frowning:

I’ve noticed that you are using LVGL v8.2.0. SLS already supports v8.3.4. So please try out with the latest version too. You can easily select the LVGL version in project settings menu:

Ok, so that would indicate that I have not done something bad/illegal in the SquareLine editor. It has also been working for me inside of the SquareLine editor when I use the simulator there.

I will have a go with the 8.3.4 version and see if that does anything.

While testing a bit, I sometimes manage to go back and fourth a few times before it crashes, so it seems to be working initially. Maybe the crashes are caused by a memory leakage, bad timing or something along those lines?

I don’t think it’s a memory leak, because it’d show an “out of memory” error in LVGL’s log.

I rather think that it’s some kind of memory config issue, like using non DMA-able with DMA or so.

I have some ideas to test:

  1. Create a long list like in lv_example_list_1, make it really large with a lot of elements, and start to scroll it like crazy. If it crashes, then the issue is related to refreshing large areas and not the screen change.
  2. Run lv_demo_stress(). There is no screen change here either, just a lot of redraws.
  3. Make the screen change buttons very large and in the flush_cb call only lv_disp_flush_ready(drv);.
  4. Disable display rotation.
  5. Increase the stack size of the gui task. 4096 should be enough, but it’s worth a try
  6. Increase LV_MEM_SIZE.

Thank you for your suggestions, here is a report from my testing:

  1. Updated LVGL to 8.3.4, seems to have made no difference.
  2. Used the example from lv_example_1 and added a huge amount of elements. Can scroll trough the list without any problems.
  3. When running lv_demo_stress(), it crashes after about 5 seconds.
  4. When I only call lv_disp_flush_ready(drv); here, nothing is drawn obviously, but when I press the display in order to trigger the change of screens, the log output is as shown below.
  5. Tried disabling rotation, no difference.
  6. Increased the stack size of the gui task by a factor of 4, no difference.

Log output when doing 3. is shown below:

[Info]  (2.058, +30)     indev_proc_press: pressed at x:271 y:171       (in lv_indev.c line #819)
[Info]  (2.084, +26)     indev_proc_release: released   (in lv_indev.c line #967)
[Info]  (2.092, +8)      lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #314)
Guru Meditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x42002b54: 000000f0 0c00a136 89018908

Updating this continuously as I get around to test everything. Just noticed I did not actually activate the LV logger before, so now I actually have some output from it. Will add output in separate reply.

LV log output from stress lv_demo_stress():

[Trace] (90.908, +10)    event_send_core: Sending event 44 to 0x3fcf53d8 with 0x3fcedd10 param  (in lv_event.c line #428)
[Trace] (90.918, +10)    event_send_core: Sending event 41 to 0x3fcf53d8 with 0x3fcedd70 param  (in lv_event.c line #428)
[Trace] (90.928, +10)    event_send_core: Sending event 34 to 0x3fcf53b0 with 0x3fcf53d8 param  (in lv_event.c line #428)
[Trace] (90.938, +10)    event_send_core: Sending event 44 to 0x3fcf53d8 with 0x3fcedd00 param  (in lv_event.c line #428)
[Trace] (90.950, +12)    event_send_core: Sending event 44 to 0x3fcf53d8 with 0x3fcedd00 param  (in lv_event.c line #428)
[Trace] (90.960, +10)    event_send_core: Sending event 19 to 0x3fcf53d8 with 0x3fcedd40 param  (in lv_event.c line #428)
[Trace] (90.970, +10)    event_send_core: Sending event 44 to 0x3fcf53b0 with 0x3fcedd30 param  (in lv_event.c line #428)
[Trace] (90.980, +10)    event_send_core: Sending event 41 to 0x3fcf53b0 with 0x3fcedd90 param  (in lv_event.c line #428)
[Trace] (90.990, +10)    event_send_core: Sending event 34 to 0x3fcf4004 with 0x3fcf53b0 param  (in lv_event.c line #428)
[Trace] (91.004, +14)    event_send_core: Sending event 44 to 0x3fcf53b0 with 0x3fcedd20 param  (in lv_event.c line #428)
[Trace] (91.014, +10)    event_send_core: Sending event 44 to 0x3fcf53b0 with 0x3fcedd20 param  (in lv_event.c line #428)
[Trace] (91.024, +10)    event_send_core: Sending event 44 to 0x3fcf4004 with 0x3fcedca0 param  (in lv_event.c line #428)
[Trace] (91.034, +10)    event_send_core: Sending event 44 to 0x3fcf4004 with 0x3fcedca0 param  (in lv_event.c line #428)
[Trace] (91.044, +10)    event_send_core: Sending event 19 to 0x3fcf53b0 with 0x3fcedd60 param  (in lv_event.c line #428)
[Trace] (91.054, +10)    event_send_core: Sending event 44 to 0x3fcf4004 with 0x3fcedd50 param  (in lv_event.c line #428)
[Info]  (91.064, +10)    flex_update: update 0x3fcf4004 container       (in lv_flex.c line #211)
[Trace] (91.074, +10)    lv_mem_buf_get: begin, getting 20 bytes        (in lv_mem.c line #280)
[Trace] (91.080, +6)     lv_mem_buf_get: returning already allocated buffer (buffer id: 0, address: 0x3fcf5608)         (in lv_mem.c line #302)
[Trace] (91.094, +14)    lv_mem_buf_release: begin (address: 0x3fcf5608)        (in lv_mem.c line #334)
[Trace] (91.100, +6)     lv_mem_buf_release: begin (address: 0x0)       (in lv_mem.c line #334)
[Trace] (91.108, +8)     lv_mem_buf_release: begin (address: 0x0)       (in lv_mem.c line #334)
[Trace] (91.118, +10)    event_send_core: Sending event 44 to 0x3fcf4004 with 0x3fcedcd0 param  (in lv_event.c line #428)
[Trace] (91.128, +10)    event_send_core: Sending event 44 to 0x3fcf3fc8 with 0x3fcedc40 param  (in lv_event.c line #428)
[Trace] (91.138, +10)    event_send_core: Sending event 44 to 0x3fcf3fc8 with 0x3fcedc40 param  (in lv_event.c line #428)
[Trace] (91.148, +10)    event_send_core: Sending event 41 to 0x3fcf4004 with 0x3fcedd30 param  (in lv_event.c line #428)
[Trace] (91.158, +10)    event_send_core: Sending event 34 to 0x3fcf3fc8 with 0x3fcf4004 param  (in lv_event.c line #428)
[Trace] (91.168, +10)    event_send_core: Sending event 44 to 0x3fcf4004 with 0x3fcedcc0 param  (in lv_event.c line #428)
[Trace] (91.178, +10)    event_send_core: Sending event 44 to 0x3fcf4004 with 0x3fcedcc0 param  (in lv_event.c line #428)
[Trace] (91.188, +10)    event_send_core: Sending event 19 to 0x3fcf4004 with 0x3fcedd00 param  (in lv_event.c line #428)
[Trace] (91.200, +12)    event_send_core: Sending event 43 to 0x3fcf4004 with 0x0 param         (in lv_event.c line #428)
[Trace] (91.210, +10)    flex_update: finished  (in lv_flex.c line #311)
[Trace] (91.218, +8)     lv_obj_update_layout: Layout update end        (in lv_obj_pos.c line #317)
[Info]  (91.224, +6)     lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #314)
[Trace] (91.234, +10)    event_send_core: Sending event 44 to 0x3fcf408c with 0x3fcedd30 param  (in lv_event.c line #428)
[Trace] (91.244, +10)    event_send_core: Sending event 44 to 0x3fcf53d8 with 0x3fcedd10 param  (in lv_event.c line #428)
[Trace] (91.254, +10)    event_send_core: Sending event 44 to 0x3fcf53b0 with 0x3fcedd30 param  (in lv_event.c line #428)
[Trace] (91.264, +10)    event_send_core: Sending event 44 to 0x3fcf4004 with 0x3fcedd50 param  (in lv_event.c line #428)
[Trace] (91.274, +10)    event_send_core: Sending event 44 to 0x3fcf3fc8 with 0x3fcedc70 param  (in lv_event.c line #428)
[Trace] (91.284, +10)    event_send_core: Sending event 44 to 0x3fcf3fc8 with 0x3fcedc70 param  (in lv_event.c line #428)
[Trace] (91.294, +10)    event_send_core: Sending event 34 to 0x3fcf3fc8 with 0x3fcf4004 param  (in lv_event.c line #428)
[Trace] (91.304, +10)    event_send_core: Sending event 44 to 0x3fcf3fc8 with 0x3fcedc70 param  (in lv_event.c line #428)
[Trace] (91.318, +14)    event_send_core: Sending event 44 to 0x3fcf3fc8 with 0x3fcedc70 param  (in lv_event.c line #428)
[Info]  (91.328, +10)    flex_update: update 0x3fcf4004 container       (in lv_flex.c line #211)
[Trace] (91.334, +6)     lv_mem_buf_get: begin, getting 20 bytes        (in lv_mem.c line #280)
[Trace] (91.344, +10)    lv_mem_buf_get: returning already allocated buffer (buffer id: 0, address: 0x3fcf5608)         (in lv_mem.c line #302)
[Trace] (91.354, +10)    lv_mem_buf_release: begin (address: 0x3fcf5608)        (in lv_mem.c line #334)
[Trace] (91.364, +10)    lv_mem_buf_release: begin (address: 0x0)       (in lv_mem.c line #334)
[Trace] (91.370, +6)     lv_mem_buf_release: begin (address: 0x0)       (in lv_mem.c line #334)
[Trace] (91.378, +8)     event_send_core: Sending event 44 to 0x3fcf4004 with 0x3fcedcd0 param  (in lv_event.c line #428)
[Trace] (91.388, +10)    event_send_core: Sending event 43 to 0x3fcf4004 with 0x0 param         (in lv_event.c line #428)
[Trace] (91.398, +10)    flex_update: finished  (in lv_flex.c line #311)
[Trace] (91.404, +6)     lv_obj_update_layout: Layout update end        (in lv_obj_pos.c line #317)
[Info]  (91.414, +10)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #314)
[Trace] (91.420, +6)     event_send_core: Sending event 44 to 0x3fcf39c4 with 0x3fcedd70 param  (in lv_event.c line #428)
[Trace] (91.430, +10)    event_send_core: Sending event 44 to 0x3fcf39c4 with 0x3fcedd70 param  (in lv_event.c line #428)
[Trace] (91.444, +14)    lv_obj_update_layout: Layout update end        (in lv_obj_pos.c line #317)
[Trace] (91.450, +6)     event_send_core: Sending event 18 to 0x3fcf37ec with 0x3fcedd80 param  (in lv_event.c line #428)
[Trace] (91.460, +10)    event_send_core: Sending event 20 to 0x3fcf37ec with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (91.470, +10)    event_send_core: Sending event 21 to 0x3fcf37ec with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (91.480, +10)    event_send_core: Sending event 26 to 0x3fcf37ec with 0x3fcedb90 param  (in lv_event.c line #428)
Guru Meditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x42002d50: 000000f0 0c00a136 89018908
0x42002d50: frame_to_panic_info at /home/marcus/esp/esp-idf/components/esp_system/port/panic_handler.c:119

Core  1 register dump:
PC      : 0x42002d54  PS      : 0x00060035  A0      : 0x403757d3  A1      : 0x3fcf4bf0  
0x42002d54: panic_handler at /home/marcus/esp/esp-idf/components/esp_system/port/panic_handler.c:122

0x403757d3: xt_highint4 at /home/marcus/esp/esp-idf/components/esp_system/port/soc/esp32s3/highint_hdl.S:110

A2      : 0x3fcf4c10  A3      : 0x00000000  A4      : 0x8203ca26  A5      : 0x40375794  
0x40375794: xt_highint4 at /home/marcus/esp/esp-idf/components/esp_system/port/soc/esp32s3/highint_hdl.S:68

A6      : 0x00000000  A7      : 0x00000000  A8      : 0x803759b0  A9      : 0x3fcf4bd0  
A10     : 0x3fcf4c10  A11     : 0x00000001  A12     : 0x8203ca1c  A13     : 0x3fcf4c70  
A14     : 0x3fc97400  A15     : 0x3fcf4ca0  SAR     : 0x00000000  EXCCAUSE: 0x00000000  
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  


Backtrace: 0x42002d51:0x3fcf4bf0 0x403757d0:0x3fcf4c10 0x00040022:0x3fcf4cd0 |<-CORRUPTED
0x42002d51: frame_to_panic_info at panic_handler.c:?

0x403757d0: xt_highint4 at /home/marcus/esp/esp-idf/components/esp_system/port/soc/esp32s3/highint_hdl.S:108





ELF file SHA256: 888d856833f5a61e

Rebooting...

LV log output from UI with two buttons switching between two screens:

[Trace] (10.804, +10)    lv_mem_buf_get: begin, getting 80 bytes        (in lv_mem.c line #280)
[Trace] (10.810, +6)     lv_mem_realloc: reallocating 0x0 with 80 size  (in lv_mem.c line #196)
[Trace] (10.818, +8)     lv_mem_realloc: allocated at 0x3fcf3a18        (in lv_mem.c line #215)
[Trace] (10.828, +10)    lv_mem_buf_get: allocated (buffer id: 0, address: 0x3fcf3a18)  (in lv_mem.c line #318)
[Trace] (10.838, +10)    lv_mem_buf_release: begin (address: 0x3fcf3a18)        (in lv_mem.c line #334)
[Trace] (10.844, +6)     lv_mem_buf_get: begin, getting 80 bytes        (in lv_mem.c line #280)
[Trace] (10.850, +6)     lv_mem_buf_release: begin (address: 0x3fcf3a18)        (in lv_mem.c line #334)
[Trace] (10.860, +10)    lv_mem_buf_get: begin, getting 80 bytes        (in lv_mem.c line #280)
[Trace] (10.868, +8)     lv_mem_buf_release: begin (address: 0x3fcf3a18)        (in lv_mem.c line #334)
[Trace] (10.878, +10)    lv_mem_buf_get: begin, getting 90 bytes        (in lv_mem.c line #280)
[Trace] (10.884, +6)     lv_mem_realloc: reallocating 0x3fcf3a18 with 90 size   (in lv_mem.c line #196)
[Trace] (10.894, +10)    lv_mem_realloc: allocated at 0x3fcf4070        (in lv_mem.c line #215)
[Trace] (10.900, +6)     lv_mem_buf_get: allocated (buffer id: 0, address: 0x3fcf4070)  (in lv_mem.c line #318)
[Trace] (10.910, +10)    lv_mem_buf_release: begin (address: 0x3fcf4070)        (in lv_mem.c line #334)
[Trace] (10.918, +8)     lv_mem_buf_get: begin, getting 90 bytes        (in lv_mem.c line #280)
[Trace] (10.928, +10)    lv_mem_buf_release: begin (address: 0x3fcf4070)        (in lv_mem.c line #334)
[Trace] (10.934, +6)     lv_mem_buf_get: begin, getting 80 bytes        (in lv_mem.c line #280)
[Trace] (10.944, +10)    lv_mem_buf_get: returning already allocated buffer (buffer id: 0, address: 0x3fcf4070)         (in lv_mem.c line #302)
[Trace] (10.954, +10)    lv_mem_buf_release: begin (address: 0x3fcf4070)        (in lv_mem.c line #334)
[Trace] (10.964, +10)    lv_mem_buf_get: begin, getting 90 bytes        (in lv_mem.c line #280)
[Trace] (10.970, +6)     lv_mem_buf_release: begin (address: 0x3fcf4070)        (in lv_mem.c line #334)
[Trace] (10.978, +8)     lv_mem_buf_get: begin, getting 120 bytes       (in lv_mem.c line #280)
[Trace] (10.988, +10)    lv_mem_realloc: reallocating 0x3fcf4070 with 120 size  (in lv_mem.c line #196)
[Trace] (10.994, +6)     lv_mem_realloc: allocated at 0x3fcf4070        (in lv_mem.c line #215)
[Trace] (11.004, +10)    lv_mem_buf_get: allocated (buffer id: 0, address: 0x3fcf4070)  (in lv_mem.c line #318)
[Trace] (11.014, +10)    lv_mem_buf_release: begin (address: 0x3fcf4070)        (in lv_mem.c line #334)
[Trace] (11.020, +6)     lv_mem_buf_get: begin, getting 100 bytes       (in lv_mem.c line #280)
[Trace] (11.028, +8)     lv_mem_buf_get: returning already allocated buffer (buffer id: 0, address: 0x3fcf4070)         (in lv_mem.c line #302)
[Trace] (11.040, +12)    lv_mem_buf_release: begin (address: 0x3fcf4070)        (in lv_mem.c line #334)
[Trace] (11.048, +8)     lv_mem_buf_get: begin, getting 90 bytes        (in lv_mem.c line #280)
[Trace] (11.058, +10)    lv_mem_buf_get: returning already allocated buffer (buffer id: 0, address: 0x3fcf4070)         (in lv_mem.c line #302)
[Trace] (11.068, +10)    lv_mem_buf_release: begin (address: 0x3fcf4070)        (in lv_mem.c line #334)
[Trace] (11.078, +10)    lv_mem_buf_get: begin, getting 90 bytes        (in lv_mem.c line #280)
[Trace] (11.084, +6)     lv_mem_buf_get: returning already allocated buffer (buffer id: 0, address: 0x3fcf4070)         (in lv_mem.c line #302)
[Trace] (11.094, +10)    lv_mem_buf_release: begin (address: 0x3fcf4070)        (in lv_mem.c line #334)
[Trace] (11.104, +10)    event_send_core: Sending event 22 to 0x3fcf3c84 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.114, +10)    event_send_core: Sending event 23 to 0x3fcf3c84 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.124, +10)    event_send_core: Sending event 24 to 0x3fcf3c84 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.134, +10)    event_send_core: Sending event 44 to 0x3fcf3c84 with 0x3fced930 param  (in lv_event.c line #428)
[Trace] (11.148, +14)    event_send_core: Sending event 44 to 0x3fcf3c84 with 0x3fced930 param  (in lv_event.c line #428)
[Trace] (11.158, +10)    event_send_core: Sending event 25 to 0x3fcf3c84 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.168, +10)    event_send_core: Sending event 23 to 0x3fcf3884 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.178, +10)    event_send_core: Sending event 24 to 0x3fcf3884 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.188, +10)    event_send_core: Sending event 25 to 0x3fcf3884 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.198, +10)    call_flush_cb: Calling flush_cb on (720;433)(799;479) area with 0x3c153418 image pointer       (in lv_refr.c line #1228)
[Trace] (11.284, +86)    event_send_core: Sending event 18 to 0x3fcf37b4 with 0x3fcedd80 param  (in lv_event.c line #428)
[Trace] (11.284, +0)     event_send_core: Sending event 20 to 0x3fcf37b4 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.296, +12)    event_send_core: Sending event 21 to 0x3fcf37b4 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.306, +10)    event_send_core: Sending event 26 to 0x3fcf37b4 with 0x3fcedb90 param  (in lv_event.c line #428)
[Trace] (11.316, +10)    event_send_core: Sending event 27 to 0x3fcf37b4 with 0x3fcedb90 param  (in lv_event.c line #428)
[Trace] (11.326, +10)    event_send_core: Sending event 22 to 0x3fcf37b4 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.336, +10)    event_send_core: Sending event 20 to 0x3fcf39d0 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.346, +10)    event_send_core: Sending event 21 to 0x3fcf39d0 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.362, +16)    event_send_core: Sending event 26 to 0x3fcf39d0 with 0x3fcedb00 param  (in lv_event.c line #428)
[Trace] (11.368, +6)     lv_mem_buf_get: begin, getting 104 bytes       (in lv_mem.c line #280)
[Trace] (11.376, +8)     lv_mem_buf_get: returning already allocated buffer (buffer id: 0, address: 0x3fcf4070)         (in lv_mem.c line #302)
[Trace] (11.388, +12)    lv_mem_alloc: allocating 84 bytes      (in lv_mem.c line #127)
[Trace] (11.396, +8)     lv_mem_alloc: allocated at 0x3fcf3d90  (in lv_mem.c line #160)
[Trace] (11.402, +6)     lv_mem_buf_get: begin, getting 112 bytes       (in lv_mem.c line #280)
[Trace] (11.412, +10)    lv_mem_realloc: reallocating 0x0 with 112 size         (in lv_mem.c line #196)
[Trace] (11.418, +6)     lv_mem_realloc: allocated at 0x3fcf3de8        (in lv_mem.c line #215)
[Trace] (11.426, +8)     lv_mem_buf_get: allocated (buffer id: 1, address: 0x3fcf3de8)  (in lv_mem.c line #318)
[Trace] (11.436, +10)    lv_mem_buf_release: begin (address: 0x3fcf3de8)        (in lv_mem.c line #334)
[Trace] (11.446, +10)    lv_mem_buf_release: begin (address: 0x3fcf4070)        (in lv_mem.c line #334)
[Trace] (11.452, +6)     event_send_core: Sending event 27 to 0x3fcf39d0 with 0x3fcedb00 param  (in lv_event.c line #428)
[Trace] (11.462, +10)    event_send_core: Sending event 22 to 0x3fcf39d0 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.476, +14)    event_send_core: Sending event 23 to 0x3fcf39d0 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.486, +10)    event_send_core: Sending event 24 to 0x3fcf39d0 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.496, +10)    event_send_core: Sending event 25 to 0x3fcf39d0 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.506, +10)    event_send_core: Sending event 23 to 0x3fcf37b4 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.516, +10)    event_send_core: Sending event 24 to 0x3fcf37b4 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.526, +10)    event_send_core: Sending event 25 to 0x3fcf37b4 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.536, +10)    event_send_core: Sending event 20 to 0x3fcf3840 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.546, +10)    event_send_core: Sending event 21 to 0x3fcf3840 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.558, +12)    event_send_core: Sending event 26 to 0x3fcf3840 with 0x3fcedb90 param  (in lv_event.c line #428)
[Trace] (11.568, +10)    event_send_core: Sending event 27 to 0x3fcf3840 with 0x3fcedb90 param  (in lv_event.c line #428)
[Trace] (11.578, +10)    event_send_core: Sending event 22 to 0x3fcf3840 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.588, +10)    event_send_core: Sending event 23 to 0x3fcf3840 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.602, +14)    event_send_core: Sending event 24 to 0x3fcf3840 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.612, +10)    event_send_core: Sending event 25 to 0x3fcf3840 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.622, +10)    event_send_core: Sending event 20 to 0x3fcf3884 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.632, +10)    event_send_core: Sending event 21 to 0x3fcf3884 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.642, +10)    event_send_core: Sending event 26 to 0x3fcf3884 with 0x3fcedb90 param  (in lv_event.c line #428)
[Trace] (11.652, +10)    event_send_core: Sending event 27 to 0x3fcf3884 with 0x3fcedb90 param  (in lv_event.c line #428)
[Trace] (11.662, +10)    event_send_core: Sending event 22 to 0x3fcf3884 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.672, +10)    event_send_core: Sending event 23 to 0x3fcf3884 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.686, +14)    event_send_core: Sending event 24 to 0x3fcf3884 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.696, +10)    event_send_core: Sending event 25 to 0x3fcf3884 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (11.706, +10)    call_flush_cb: Calling flush_cb on (61;50)(174;145) area with 0x3c12c314 image pointer         (in lv_refr.c line #1228)
[Trace] (11.774, +68)    lv_mem_free: freeing 0x3fcf4070        (in lv_mem.c line #171)
[Trace] (11.774, +0)     lv_mem_free: freeing 0x3fcf3de8        (in lv_mem.c line #171)
[Trace] (11.778, +4)     lv_mem_free: freeing 0x3fcf3d90        (in lv_mem.c line #171)
[Trace] (11.784, +6)     lv_mem_free: freeing 0x3fcf3d7c        (in lv_mem.c line #171)
[Trace] (11.790, +6)     lv_mem_alloc: allocating 15 bytes      (in lv_mem.c line #127)
[Trace] (11.798, +8)     lv_mem_alloc: allocated at 0x3fcf3a18  (in lv_mem.c line #160)
[Trace] (11.804, +6)     _lv_disp_refr_timer: finished  (in lv_refr.c line #437)
[Trace] (11.814, +10)    lv_timer_exec: timer callback 0x42013228 finished      (in lv_timer.c line #314)
0x42013228: _lv_disp_refr_timer at /home/marcus/git/BT_ESP_FC_2/BT_ESP_FC_2/build/../components/lvgl/src/core/lv_refr.c:287

[Trace] (11.820, +6)     lv_timer_handler: finished (0 ms until the next timer call)    (in lv_timer.c line #144)
[Trace] (11.840, +20)    lv_timer_handler: begin        (in lv_timer.c line #69)
[Trace] (11.840, +0)     lv_timer_exec: calling timer callback: 0x4200b670      (in lv_timer.c line #312)
0x4200b670: lv_indev_read_timer_cb at /home/marcus/git/BT_ESP_FC_2/BT_ESP_FC_2/build/../components/lvgl/src/core/lv_indev.c:65

[Trace] (11.844, +4)     lv_indev_read_timer_cb: begin  (in lv_indev.c line #66)
[Trace] (11.854, +10)    _lv_indev_read: calling indev_read_cb  (in lv_hal_indev.c line #185)
[Info]  (11.864, +10)    indev_proc_release: released   (in lv_indev.c line #967)
[Trace] (11.868, +4)     event_send_core: Sending event 8 to 0x3fcf39d0 with 0x3fcf3910 param   (in lv_event.c line #428)
[Trace] (11.878, +10)    lv_mem_buf_get: begin, getting 640 bytes       (in lv_mem.c line #280)
[Trace] (11.884, +6)     lv_mem_realloc: reallocating 0x0 with 640 size         (in lv_mem.c line #196)
[Trace] (11.894, +10)    lv_mem_realloc: allocated at 0x3fcf3d7c        (in lv_mem.c line #215)
[Trace] (11.900, +6)     lv_mem_buf_get: allocated (buffer id: 0, address: 0x3fcf3d7c)  (in lv_mem.c line #318)
[Trace] (11.910, +10)    lv_mem_realloc: reallocating 0x3fcf4014 with 88 size   (in lv_mem.c line #196)
[Trace] (11.920, +10)    lv_mem_realloc: allocated at 0x3fcf4014        (in lv_mem.c line #215)
[Trace] (11.928, +8)     lv_mem_alloc: allocating 8 bytes       (in lv_mem.c line #127)
[Trace] (11.934, +6)     lv_mem_alloc: allocated at 0x3fcf3ce4  (in lv_mem.c line #160)
[Trace] (11.944, +10)    lv_mem_alloc: allocating 28 bytes      (in lv_mem.c line #127)
[Trace] (11.948, +4)     lv_mem_alloc: allocated at 0x3fcf3a2c  (in lv_mem.c line #160)
[Trace] (11.958, +10)    lv_anim_start: begin   (in lv_anim.c line #78)
[Trace] (11.964, +6)     lv_mem_alloc: allocating 76 bytes      (in lv_mem.c line #127)
[Trace] (11.970, +6)     lv_mem_alloc: allocated at 0x3fcf4070  (in lv_mem.c line #160)
[Trace] (11.978, +8)     lv_anim_start: finished        (in lv_anim.c line #113)
[Trace] (11.984, +6)     lv_mem_alloc: allocating 12 bytes      (in lv_mem.c line #127)
[Trace] (11.990, +6)     lv_mem_alloc: allocated at 0x3fcf4000  (in lv_mem.c line #160)
[Trace] (11.998, +8)     lv_mem_alloc: allocating 28 bytes      (in lv_mem.c line #127)
[Trace] (12.004, +6)     lv_mem_alloc: allocated at 0x3fcf3a4c  (in lv_mem.c line #160)
[Trace] (12.014, +10)    lv_anim_start: begin   (in lv_anim.c line #78)
[Trace] (12.018, +4)     lv_mem_alloc: allocating 76 bytes      (in lv_mem.c line #127)
[Trace] (12.028, +10)    lv_mem_alloc: allocated at 0x3fcf40c0  (in lv_mem.c line #160)
[Trace] (12.034, +6)     lv_anim_start: finished        (in lv_anim.c line #113)
[Trace] (12.040, +6)     lv_mem_realloc: reallocating 0x3fcf4000 with 18 size   (in lv_mem.c line #196)
[Trace] (12.048, +8)     lv_mem_realloc: allocated at 0x3fcf4110        (in lv_mem.c line #215)
[Trace] (12.058, +10)    lv_mem_alloc: allocating 28 bytes      (in lv_mem.c line #127)
[Trace] (12.064, +6)     lv_mem_alloc: allocated at 0x3fcf5024  (in lv_mem.c line #160)
[Trace] (12.070, +6)     lv_anim_start: begin   (in lv_anim.c line #78)
[Trace] (12.078, +8)     lv_mem_alloc: allocating 76 bytes      (in lv_mem.c line #127)
[Trace] (12.084, +6)     lv_mem_alloc: allocated at 0x3fcf5044  (in lv_mem.c line #160)
[Trace] (12.090, +6)     lv_anim_start: finished        (in lv_anim.c line #113)
[Trace] (12.098, +8)     lv_mem_realloc: reallocating 0x3fcf4110 with 24 size   (in lv_mem.c line #196)
[Trace] (12.108, +10)    lv_mem_realloc: allocated at 0x3fcf4110        (in lv_mem.c line #215)
[Trace] (12.114, +6)     lv_mem_alloc: allocating 28 bytes      (in lv_mem.c line #127)
[Trace] (12.120, +6)     lv_mem_alloc: allocated at 0x3fcf5094  (in lv_mem.c line #160)
[Trace] (12.128, +8)     lv_anim_start: begin   (in lv_anim.c line #78)
[Trace] (12.134, +6)     lv_mem_alloc: allocating 76 bytes      (in lv_mem.c line #127)
[Trace] (12.144, +10)    lv_mem_alloc: allocated at 0x3fcf50b4  (in lv_mem.c line #160)
[Trace] (12.150, +6)     lv_anim_start: finished        (in lv_anim.c line #113)
[Trace] (12.158, +8)     lv_mem_buf_release: begin (address: 0x3fcf3d7c)        (in lv_mem.c line #334)
[Trace] (12.164, +6)     event_send_core: Sending event 19 to 0x3fcf39d0 with 0x3fcedca0 param  (in lv_event.c line #428)
[Trace] (12.174, +10)    event_send_core: Sending event 7 to 0x3fcf39d0 with 0x3fcf3910 param   (in lv_event.c line #428)
[Trace] (12.184, +10)    lv_mem_realloc: reallocating 0x3fcf3b00 with 32 size   (in lv_mem.c line #196)
[Trace] (12.194, +10)    lv_mem_realloc: allocated at 0x3fcf5104        (in lv_mem.c line #215)
[Trace] (12.204, +10)    lv_mem_alloc: allocating 8 bytes       (in lv_mem.c line #127)
[Trace] (12.208, +4)     lv_mem_alloc: allocated at 0x3fcf4000  (in lv_mem.c line #160)
[Trace] (12.218, +10)    event_send_core: Sending event 42 to 0x3fcf3ac0 with 0x0 param         (in lv_event.c line #428)
[Trace] (12.228, +10)    lv_mem_alloc: allocating 12 bytes      (in lv_mem.c line #127)
[Trace] (12.234, +6)     lv_mem_alloc: allocated at 0x3fcf3b00  (in lv_mem.c line #160)
[Trace] (12.240, +6)     event_send_core: Sending event 42 to 0x3fcf3ac0 with 0x0 param         (in lv_event.c line #428)
[Trace] (12.250, +10)    event_send_core: Sending event 37 to 0x3fcf37b4 with 0x0 param         (in lv_event.c line #428)
[Trace] (12.260, +10)    event_send_core: Sending event 38 to 0x3fcf3ac0 with 0x0 param         (in lv_event.c line #428)
[Trace] (12.270, +10)    event_send_core: Sending event 39 to 0x3fcf3ac0 with 0x0 param         (in lv_event.c line #428)
[Trace] (12.280, +10)    event_send_core: Sending event 40 to 0x3fcf37b4 with 0x0 param         (in lv_event.c line #428)
[Trace] (12.290, +10)    lv_indev_read_timer_cb: finished       (in lv_indev.c line #120)
[Trace] (12.298, +8)     lv_timer_exec: timer callback 0x4200b670 finished      (in lv_timer.c line #314)
0x4200b670: lv_indev_read_timer_cb at /home/marcus/git/BT_ESP_FC_2/BT_ESP_FC_2/build/../components/lvgl/src/core/lv_indev.c:65

[Trace] (12.308, +10)    lv_timer_exec: calling timer callback: 0x42013228      (in lv_timer.c line #312)
0x42013228: _lv_disp_refr_timer at /home/marcus/git/BT_ESP_FC_2/BT_ESP_FC_2/build/../components/lvgl/src/core/lv_refr.c:287

[Trace] (12.314, +6)     _lv_disp_refr_timer: begin     (in lv_refr.c line #288)
[Info]  (12.324, +10)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #314)
[Trace] (12.330, +6)     event_send_core: Sending event 41 to 0x3fcf3b1c with 0x3fceddd0 param  (in lv_event.c line #428)
[Trace] (12.340, +10)    event_send_core: Sending event 34 to 0x3fcf3ac0 with 0x3fcf3b1c param  (in lv_event.c line #428)
[Trace] (12.350, +10)    event_send_core: Sending event 44 to 0x3fcf3b1c with 0x3fcedd60 param  (in lv_event.c line #428)
[Trace] (12.360, +10)    event_send_core: Sending event 44 to 0x3fcf3b1c with 0x3fcedd60 param  (in lv_event.c line #428)
[Trace] (12.374, +14)    event_send_core: Sending event 19 to 0x3fcf3b1c with 0x3fcedda0 param  (in lv_event.c line #428)
[Trace] (12.384, +10)    event_send_core: Sending event 34 to 0x3fcf3ac0 with 0x3fcf3b1c param  (in lv_event.c line #428)
[Trace] (12.394, +10)    lv_obj_update_layout: Layout update end        (in lv_obj_pos.c line #317)
[Info]  (12.400, +6)     lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #314)
[Trace] (12.408, +8)     lv_obj_update_layout: Layout update end        (in lv_obj_pos.c line #317)
[Info]  (12.418, +10)    lv_obj_update_layout: Layout update begin      (in lv_obj_pos.c line #314)
[Trace] (12.424, +6)     event_send_core: Sending event 44 to 0x3fcf3c84 with 0x3fcedd70 param  (in lv_event.c line #428)
[Trace] (12.438, +14)    event_send_core: Sending event 44 to 0x3fcf3c84 with 0x3fcedd70 param  (in lv_event.c line #428)
[Trace] (12.448, +10)    lv_obj_update_layout: Layout update end        (in lv_obj_pos.c line #317)
[Trace] (12.454, +6)     event_send_core: Sending event 18 to 0x3fcf3ac0 with 0x3fcedd80 param  (in lv_event.c line #428)
[Trace] (12.464, +10)    event_send_core: Sending event 20 to 0x3fcf3ac0 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (12.474, +10)    event_send_core: Sending event 21 to 0x3fcf3ac0 with 0x3fceebf4 param  (in lv_event.c line #428)
[Trace] (12.484, +10)    event_send_core: Sending event 26 to 0x3fcf3ac0 with 0x3fcedb90 param  (in lv_event.c line #428)
Guru Meditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x42002d10: 000000f0 0c00a136 89018908
0x42002d10: frame_to_panic_info at /home/marcus/esp/esp-idf/components/esp_system/port/panic_handler.c:119

Core  1 register dump:
PC      : 0x42002d14  PS      : 0x00060035  A0      : 0x403757d3  A1      : 0x3fcf4bf0  
0x42002d14: panic_handler at /home/marcus/esp/esp-idf/components/esp_system/port/panic_handler.c:122

0x403757d3: xt_highint4 at /home/marcus/esp/esp-idf/components/esp_system/port/soc/esp32s3/highint_hdl.S:110

A2      : 0x3fcf4c10  A3      : 0x00000000  A4      : 0x8203b416  A5      : 0x40375794  
0x40375794: xt_highint4 at /home/marcus/esp/esp-idf/components/esp_system/port/soc/esp32s3/highint_hdl.S:68

A6      : 0x00000000  A7      : 0x00000000  A8      : 0x803759b0  A9      : 0x3fcf4bd0  
A10     : 0x3fcf4c10  A11     : 0x00000001  A12     : 0x8203b40c  A13     : 0x3fcf4c70  
A14     : 0x3fc973f0  A15     : 0x3fcf4ca0  SAR     : 0x00000000  EXCCAUSE: 0x00000000  
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  


Backtrace: 0x42002d11:0x3fcf4bf0 0x403757d0:0x3fcf4c10 0x00040022:0x3fcf4cd0 |<-CORRUPTED
0x42002d11: frame_to_panic_info at panic_handler.c:?

0x403757d0: xt_highint4 at /home/marcus/esp/esp-idf/components/esp_system/port/soc/esp32s3/highint_hdl.S:108





ELF file SHA256: 693b3fc56c1c6ff7

Rebooting...

I figured out what was causing the issues I’ve had. The lv_disp_draw_buf_init() function takes in the uint32_t size_in_px_cnt parameter, which I believe is the draw buffer size (?). This number was set to 480 * 10000 = 4.8MB if my thinking and math is correct. So I guess since the .flags.fb_in_psram = true, // allocate frame buffer in PSRAM flag was set, and the PSRAM on the ESP32-S3 module I am using is 2MB, I allocated more memory than available. Had an identical PCB (which I had some trouble with before, thus the long wait before testing the code on it) with a 8MB PSRAM MCU, where the code with 4.8MB buffer size ran without problems. I am not super familiar with how LVGL is built and how the memory allocation etc works, so I’d be very happy if you would comment on my thoughts here and maybe give a short explanation @kisvegabor. Also thank you for all the ideas you presented before, I have learned a lot by trying your suggestions.

I’m also not super familiar with how the ESP drivers are built, but it you want to save some RAM, partial buffering can be an option too. Like this:

    ESP_LOGI(TAG, "Allocate separate LVGL draw buffers from PSRAM");
    buf1 = heap_caps_malloc(EXAMPLE_LCD_H_RES * 100 * sizeof(lv_color_t), MALLOC_CAP_SPIRAM);
    assert(buf1);
    buf2 = heap_caps_malloc(EXAMPLE_LCD_H_RES * 100 * sizeof(lv_color_t), MALLOC_CAP_SPIRAM);
    assert(buf2);
    // initialize LVGL draw buffers
    lv_disp_draw_buf_init(&disp_buf, buf1, buf2, EXAMPLE_LCD_H_RES * 100);

Yes I have seen that been done. Thanks for the feedback.

1 Like