I’m exploring how to make the development process easier for people who want to build their own applications on an ESP32-P4-based LCD display.
One thing that can be confusing for beginners is that downloading LVGL is only part of the process. The display driver, touch input driver, LVGL configuration, and ESP-IDF project also need to work together.
From what I’ve learned, a practical development workflow looks like this:
Set up ESP-IDF and the required toolchain.
Add LVGL to the project using the ESP Component Manager.
Initialize the LCD and capacitive touch controller using the appropriate drivers.
Connect the display and touch input to LVGL.
Create the application interface using LVGL widgets such as buttons, labels, switches, and menus.
Build the firmware, flash it to the ESP32-P4, and test the interface on the display.
The official LVGL documentation for Espressif platforms is a useful starting point. One important detail is that the exact driver configuration depends on the display hardware, so a generic LVGL example may not work without additional integration.
Our team also works with ESP32-P4 LCD development hardware, including this 5-inch ESP32-P4 capacitive touch LCD development kit. The idea is to give developers a hardware platform on which they can build their own interface and application logic.
I’d be interested to hear from people who have worked with LVGL on ESP32-P4:
Do you prefer starting with an existing board support package or integrating the display and touch drivers yourself?
What was the most challenging part of getting LVGL running on your hardware?
Are there any example projects you would recommend for someone building a custom touch-based HMI?
I’d appreciate any practical suggestions or recommendations from the community.
Hi Aptus,
I have used lvgl (9.5) and various ESP32-P4 boards. I have a couple of APPS using the Guition P4 Dev board driving a 5" Rpi V2 touch LCD. I also ran the same APPs on a Waveshare ESP32-P4-NANO without problem.
Lvgl was never a problem but ESP-IDF was a PITA., 750MB+ source files to create a 3MB APP.
I am also running the same APPs on a JC-4880P$43C-I-W with a 4.3" touch lcd. It cam be programmed using Arduino - a much more friendly environment.Lvgl (9.6) has worked flawlessly in that environment too.
I am currently trying to convert the ESP-IDF driver for the 5" Rpi V2 mipi dsi screen to run on Arduino sketches.
Please be more specific about the problems you are having with ESP-IDF. Be careful which LCD’s you try to connect to the ESP32-P4 dsi - the pin configuration rules out a lot of them. Only the Rpi 5" and 7" V2 LCDs are compatible, all of the other Rpi LCDs may damage your ESP32-P4.
This is really interesting to me as I just switched to esp-idf to develop an app for the Waveshare P4, using LVGL.
One thing I am really struggling with is stopping crashes due to some tasks running on Core 1 in the background when I switch screens.
I have all my GUI tasks isolated using RTOS tasks fed by queues, and they are running on Core 0, but in the background some LVGL tasks (LV_DRAW_SW_BLEND) still seem to be on Core 1. (I put all the GUI on one core so I dont have to use Mutexes, but…).
Whilst I am a proficient coder, I am not familiar with either esp-idf, LVGL, or the P4, so I set myself a high bar
I based my code on the LVGL information and examples from Waveshare to get it working on the hardware first, and as a result, used their BSP. This gave me a stable start where I didnt have to worry about specifically understanding the device, or the touch screen as the BSP had it all working for me already.
I then incorporated elements from the online LVGL examples to help me understand the widgets, the lvgl workflow and how mutexes etc could/should be used.
I think that a section in the LVGL docs, front and centre about how to arrange code for both multi-threading and multi cores (with the P4) would be very helpful, along with some examples.
If anyone can tell me how to move all LVGL tasks to Core 0 that would make my day too!
I have all of my actual writes in my app in a single thread that is pinned to core 0 of the MCU.
All traffic is posted via a queue to this single thread, and all my other code is executing on Core 1 (I think).
My crashing seems to be a limit of handles perhaps (?), although I really don’t know why.
If I add a couple more buttons to a tab page, then I get a crash when I move between tabs.
I was wondering of part of the draw task is still being done on Core 1 somewhere that I cant see, hence the question of if I can force LVGL to only use one core.
The only time I have used a mutex (bsp_lock actually) is around the initial screen setup. Once this setup is done I spin up the gui task and everything gets done in there.
I note that you have used the cores the other way around, and are still using the timer.
Instead of the timer, I use:
For a first project I’d start from an existing board support package, if your board has one. Getting the panel and touch running from a BSP or a vendor example first proves the hardware works. After that, you can swap in your own UI.
On the P4, the part that usually takes the most time isn’t LVGL itself. It’s the MIPI-DSI panel init sequence, the buffer setup and getting a stable refresh rate. A wrong init sequence or timing often looks like an LVGL problem when it isn’t. I’d check the panel with a plain colour fill before adding LVGL, then enable touch separately.
Disclosure: I build LCD Ultra Pro, a browser-based LVGL editor for ESP32 displays, so I spend a lot of time on board-specific setup. It doesn’t export for the P4 yet, but P4 support is planned, so I can’t recommend it for this board today. Our free wiki has board pinouts and wiring notes, which may help anyway: ESP32 Display Boards: Specs of 101 LVGL-Ready Boards