Adding widgets triggers watchdog

What do you want to achieve?

I have a visualization with 4 screens and more than 80 widgets on a 800*480 display controlled by an ESP32-S2 via SPI. Cycletime of the lv_tick_inc is 10ms. Everything works fine and smooth. Then I add a few extra widgets (a panel with a couple of labels) and the program does not run anymore: the watchdog gets triggered on the ESP32. I only have the lvgl task running, nothing else.

What have you tried so far?

I increased the cycletime to 30ms, then 100ms, but nothing helps: I always get watchdog error. I delete the additional widgets and everything works again. How can two extra labels make such a huge difference??

Screenshot or video

Others

  • **SquareLine Studio version: 1.1.0 (but also 1.0.5)
  • **Operating system: Windows
  • **Target hardware: ESP32-S2

I suggest enabling logging as described here.

Probably it’s an out of memory issue and can be solved by increasing LV_MEM_SIZE. But hopefully the log will tell what the problem is.

Hello Gabor and thank you for your quick reply!

Your observation was correct: I took a log and saw that the problem was memory allocation.

However, when increasing LV_MEM_SIZE from 32 to 48KB I get an error during linking, saying that “dram0.bss will not fit in region dram0_0_seg”, whatever that means…

Any idea on how to fix that? Or is it just the ESP32-S2 that does not have enough RAM?

Thank you so much for your support!!

Here’s the building error:

Solved. I played around with the memory settings and found out that using LV_MEM_CUSTOM = 1 solves the problem.

1 Like

Happy to hear that you could fix it.

The build error said that you were out of memory in the MCU. :frowning:

Well, technically the MCU still has plenty of memory. The problem is that it does not support allocating large static chunks of stack, which is why increasing LV_MEM_SIZE leads to an error. The solution is to allocate that memory dynamically at runtime. For some reasons setting LV_MEM_CUSTOM does that in a good way.

It’s because LV_MEM_CUSTOM makes LVGL to use the system’s malloc/free which works in heat, not in a large pre-allocated array.