Touch screen lock up on ESP32-P4-WIFI6-Touch-LCD-5

Description

I am trying to create my first lvgl user interface. I am able to compile and run the demo programs, and the hardware appears to be working correctly.

Using Squareline I have created a ui with a couple of buttons that swap screens, report button presses, and reports a slider position. This is the result of piecing together info from several separate tutorials, as I was unable to find a single tutorial for the whole process using vscode IDF.

Knowing no better, my starting point was the 08_lvgl_demo_v9 demo program, and I have managed to add the Squareline ui to that, not without difficulty since I lacked an end-to-end tutorial.

My problem is that while the ui appears and initially works, after a short time the touchscreen stops responding, and the lv_timer_handler() call in the main loop appears to have hung. This appears to be happening when I touch the screen.

What MCU/Processor/Board and compiler are you using?

ESP32-P4-WIFI6-Touch-LCD-5
ESP32-IDF in vscode under Linux - fresh install
lvgl version 9.5

This is my main loop:

while(1){
        lv_timer_handler();

        vTaskDelay(10 /portTICK_PERIOD_MS);

}

What do you want to achieve?

I want to know how to modify my project, or discover an better starting point to recreate my project, so that the touch screen does not hang.

I also want to understand the how and where to properly set the lvlg memory size.

What have you tried so far?

I have tried altering the loop delay. I know the recommended loop delay is 5ms, but deviating from the 10ms I have, just makes the ui lock up sooner.

I have tried turning on lvgl logging, but it has not reported an issue when the program hangs.

After various web searches, including the FAQ, I suspect a memory setting may need altering.

I tried copying lvgl__lvgl/lv_conf_template.h to lvgl__lvgl/lv_conf.h and changing #if 0 to #if 1 as instructed. However, the compiler does not recognise LV_MEM, or LV_MEM_SIZE when I try to print them out.
I do find the instruction “Copy lvgl/lv_conf_template.h as lv_conf.h next to the lvgl folder” a bit ambiguous. ‘next to’? Perhaps I have misunderstood the instruction?

It may be that what I need is proper instruction on how to set the memory LV_MEM.

Code to reproduce

Add the relevant code snippets here.

The code block(s) should be between ```c and ``` tags:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

Hi @Rob359

Thanks for starting this discussion. Well, the LVGL documentation provides details on integrating the IDF with LVGL. Since you are just getting started, the best approach, in my opinion, is to verify that the demos are working correctly.

Since you will be using LVGL as a component within the IDF, Espressif has created a comprehensive API for LCD panels.

HI,
I got this working. I did look at halyssonJr’s link, thanks for that, but thought there were too many places where I could go wrong without a more detailed tutorial for my exact board and IDE.

What I did was:

  1. Copy lvgl__lvgl/lv_conf_template.h to lvgl__lvgl/lv_conf.h and edit it.
  • Change #if0 to #if1 at the start.
  • Comment out //#define LV_USE_DEMO_MUSIC 0 to avoid redefinition error
  • In the FONT USAGE section, enable the font I was using, since enabling it in the SDK Configuration Editor no longer worked.
  1. The most important step that I was missing. In SDK Configuration Editor, turn off the option:
    LVGL configuration: “Check this to not use custom lv_conf.h”
    That’s why my previous attempt to use lv_conf.h failed.

With these changes, I can now print out LV_MEM_SIZE which is 64kbytes, and the screen no longer crashes.

This does not feel like the BEST way to do it, but it’s got me going for now.