Beginner problems - LVGL with Arduino

I’ve tried many times over the past couple of years to get LVGL running with Arduino. I usually give up after a couple hours, but today I’m trying again. I’m a reasonably experienced programmer and have successfully used Arduino for many projects in the past, but can’t even get the LVGL examples to compile. Something dumb I’m missing - to be sure.

My current setup is:
Arduino running on Windows 11, targeting Seeed Xiao RP2040 with a ILI9341 TFT, running TFT_eSPI graphics library. I am able to use these with success. Now I want to add LVGL for all the widgets it offers.

I have LVGL 9.0 installed but getting compile errors that I don’t understand how to fix:
///////////////////////
c:\users\dsloc\documents\arduino\libraries\lvgl\lv_conf.h:399:10: fatal error: lvgl/lv_conf_checker.h: No such file or directory
399 | #include “lvgl/lv_conf_checker.h”
| ^~~~~~~~~~~~~~~~~~~~~~~~
/////////////////////

That file is clearly in my lvgl folder so I’m not sure why it can’t find it.

Any pointers appreciated.

Doug

1 Like

You’re not alone @dslocum :joy:
I hope somebody gives an advise and it helps to me too !

I dont use 9 now , but i mean is same as in 8

 * Configuration file for v8.3.7
 */

/*
 * Copy this file as `lv_conf.h`
 * 1. simply next to the `lvgl` folder
 * 2. or any other places and
 *    - define `LV_CONF_INCLUDE_SIMPLE`
 *    - add the path as include path
 */

then when you read this template instruction lv_conf.h need place under libraries not in lvgl or as described

Thank you, but I’m pretty new to this. Sorry I don’t understand.

Could you try to explain differently please?

Hi,
Open Arduino File ->Prefrences-> Then make a new Sketchbook location.
After that Download LVGL library -Tools-Manage librarys- Type LVGL (im using 8.3.7) - The newer one had some missing code in the config library.

  • Also install tft_espi library for you display drivers ( if you are using tft_espi)

Then you need to configure the LVGL
Open File Explorer->Locate your Arduino Sketch folder->libraries-lvgl
There you will find a file “lv_conf_template”
Copy it and paste it
File Explorer-Locate your Arduino Sketch folder->libraries (paste here)
Re-name the file to “lv_conf”
Right click on it open with text editor and find these lines of code
On top of the code
/* clang-format off /
#if 0 /Set it to “1” to enable content/
you change it to
/
clang-format off */
#if 1 /Set it to “1” to enable content/

then
#Define LV_TICK_CUSTOM 0
change it
#Define LV_TICK CUSTOM 1

On the bottom you also need to find the

#define LV_FONT_MONTSERRAT_8  0
#define LV_FONT_MONTSERRAT_10 1
#define LV_FONT_MONTSERRAT_12 0
#define LV_FONT_MONTSERRAT_14 1
#define LV_FONT_MONTSERRAT_16 0
#define LV_FONT_MONTSERRAT_18 0
#define LV_FONT_MONTSERRAT_20 0
#define LV_FONT_MONTSERRAT_22 0
#define LV_FONT_MONTSERRAT_24 0
#define LV_FONT_MONTSERRAT_26 0
#define LV_FONT_MONTSERRAT_28 0
#define LV_FONT_MONTSERRAT_30 0
#define LV_FONT_MONTSERRAT_32 0
#define LV_FONT_MONTSERRAT_34 0
#define LV_FONT_MONTSERRAT_36 0
#define LV_FONT_MONTSERRAT_38 0
#define LV_FONT_MONTSERRAT_40 0
#define LV_FONT_MONTSERRAT_42 0
#define LV_FONT_MONTSERRAT_44 0
#define LV_FONT_MONTSERRAT_46 0
#define LV_FONT_MONTSERRAT_48 1

To defin the font size that you will use in your project.
Save the config file.

-Configure tft_espi user setup for you display settings.

In SquareLineStudio when you design your project and finish it-Export->Create template Project
save it somewhere on your desktop like folder name “my project”
you open then the folder name “my project”->SquareLine_Project->libraries
there you will find “ui” folder
you need to copy it here
Open File Explorer->Locate your Arduino Sketch folder->libraries

Ok now in
desktop like folder name “my project”
you open then the folder name “my project”->SquareLine_Project->ui folder

you have ui (arduino file) just open it an you can flash it onto your microcontroler

@dslocum

Hi and thank you so much for your detailed explanation.

I did what you said up to when you mentioned SquareLineStudio. I do not use this. I manually create my UI using Arduino UDE.

I now want to test using the LVGL_Arduino example, but fails to compile giving a lot of errors.
I see that the LVGL_Arduino example .INO file has a note at the top:

/*To use the built-in examples and demos of LVGL uncomment the includes below respectively.
*You also need to copy lvgl/examples to lvgl/src/examples. Similarly for the demos lvgl/demos to lvgl/src/demos.
Note that the lv_examples library is for LVGL v7 and you shouldn’t install it for this version (since LVGL v8)
as the examples and demos are now part of the main LVGL library. */

…so per the instructions, I copied the “lv_examples” folder into a new “/src” folder. But for the next step, I don’t have a folder “lvgl/demos”, so again I’m confused.

The compiler errors have a bunch of “warnings” and “notes” for things like LV_COLOR_MAKE that I don’t understand. But the real “errors” start:

C:\Users\dsloc\Documents\Arduino2\libraries\arduino_208754\examples\arduino\LVGL_Arduino\LVGL_Arduino.ino: At global scope:
LVGL_Arduino:16:8: error: ‘lv_disp_draw_buf_t’ does not name a type; did you mean ‘lv_disp_drv_t’?
16 | static lv_disp_draw_buf_t draw_buf;
| ^~~~~~~~~~~~~~~~~~
| lv_disp_drv_t
C:\Users\dsloc\Documents\Arduino2\libraries\arduino_208754\examples\arduino\LVGL_Arduino\LVGL_Arduino.ino: In function ‘void my_disp_flush(lv_disp_t*, const lv_area_t*, lv_color_t*)’:
LVGL_Arduino:41:5: error: ‘lv_disp_flush_ready’ was not declared in this scope; did you mean ‘lv_flush_ready’?
41 | lv_disp_flush_ready( disp );
| ^~~~~~~~~~~~~~~~~~~
| lv_flush_ready
// there are many more

Using library lvgl in folder: C:\Users\dsloc\Documents\Arduino2\libraries\lvgl (legacy)
Using library TFT_eSPI at version 2.5.34 in folder: C:\Users\dsloc\Documents\Arduino2\libraries\TFT_eSPI
Using library SPI at version 1.0 in folder: C:\Users\dsloc\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.6.0\libraries\SPI
Using library LittleFS at version 0.1.0 in folder: C:\Users\dsloc\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\3.6.0\libraries\LittleFS
exit status 1
‘lv_disp_draw_buf_t’ does not name a type; did you mean ‘lv_disp_drv_t’?
Invalid library found in C:\Users\dsloc\Documents\Arduino2\libraries\src: no headers files (.h) found in C:\Users\dsloc\Documents\Arduino2\libraries\src

Any ideas why I’m having SOOOO many problems?
Thanks

Anyone??? HELP

Check the other topic you opened up. I will help you out in that topic.

I have found that relative links are used for header file locations, eg, …/…/dir_name/dir_name/header_name.h

Arduino compiler cannot handle relative paths, it needs absolute paths. Unfortunately, a number of headers have includes to other header files, so it is a can or worms trying to sort this out.

Something I am thinking about is to have all .h and .cpp files in one place and write some code to remove relative paths from all the files. Then again …

I have seen some people using Arduino, so I assume there is a way of getting lvgl working, but there’s not much information out there.

It looks like the issue only happens if you place LVGL directly into the same folder that the sketch is in. If you place LVGL into the libraries folder then it doesn’t happen.

I had lvgl in the libraries folder, moved the examples folder etc as instructed. The compiler would not complete.

I tested by giving explicit paths to some headers and compilation was successful, though these headers did not have included to other header files in order to keep things simple.

If lvgl works with Arduino, and I have found one demo from someone on YouTube, then there’s something I and others are missing.

Where yuo place lv_conf.h?

Outside the lvgl folder in Arduino. Reading further it seems as though the relative paths should be ok, but it’s a matter of getting the hierarchy correct, see Improvements with handling includes · Issue #200 · lvgl/lvgl · GitHub. However, it would be useful if instructions were clarified and explicit as there seems to be a number of people encountering compiler issues.

Can you clarify this:

/*

  • Copy this file as lv_conf.h
    1. simply next to the lvgl folder
    1. or any other places and
    • define LV_CONF_INCLUDE_SIMPLE
    • add the path as include path
      */
      the header is outside the lvgl folder, but I am not clear what is meant in 2.

thanks.