LittleVGL on Teensy

Why is there so much sex every time?
Your library seemed beautiful to me, but very incomprehensible

It seems to me that the problem you encounter is specific to LVGL and not Teensy related. In particular, my ILI9341_T4 lib has nothing to do with lv_demo. I just wrote a short example to show how to interface the driver with a GUI library...

I think you may have better luck asking for help on the LVGL forum where the actual library developers can answer your questions.
 
I'm not making a claim. I'm just asking for advice.

I understand that and my previous answer was only a suggestion and not meant to be rude :)
As I understand it, you manage to run the LVGL music demo on Teensy 4 with an ILI9341 screen. Your next question now concerns LVGL and its integration into the Arduino environment (i.e. installing LVGL_Arduino). I do not know enough to help you about that. However, by asking for advice on the Arduino forum or, even better, on the LVGL forum you are more likely to reach people who know the answer...
 
I understand that and my previous answer was only a suggestion and not meant to be rude :)
As I understand it, you manage to run the LVGL music demo on Teensy 4 with an ILI9341 screen. Your next question now concerns LVGL and its integration into the Arduino environment (i.e. installing LVGL_Arduino). I do not know enough to help you about that. However, by asking for advice on the Arduino forum or, even better, on the LVGL forum you are more likely to reach people who know the answer...

Good. In any case, thanks!
 
I got the lvgl_touch_minimal to run. However, the code says it should be in landscape, but the ILI9341 is in portrait mode.

I am having difficulty getting the more advanced lvgl_music_demo example to work.

Error message is:
Code:
Arduino: 1.8.19 (Linux), TD: 1.56, Board: "Teensy 4.1, Serial, 600 MHz, Faster, US English"

/home/pi/Arduino/lvgl_music_demo.ino/lvgl_music_demo.ino.ino: In function 'void setup()':
/home/pi/Arduino/lvgl_music_demo.ino/lvgl_music_demo.ino.ino:164:19: error: 'lv_demo_music' was not declared in this scope
     lv_demo_music();
                   ^
Error compiling for board Teensy 4.1.


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
I see that I screwed up the file names with double ino's. Let me fix that first and recompile. I will attach a zip of the folder with all the code. Fixed the double ino, but the compile error remains the same.

Apparently my zip file is too large. I had included all of the assets folder.

It would be better that these examples were completely self contained! Your examples have stuff from all over the place and it is very hard to follow. Header files calling header files from everywhere.
For this example, what are the necessary and sufficient files in /assets? Just the spectrum.h files?

Edit: Finally understood what you meant by copying everything. Got it to compile and run. Now to figure out how on earth to use something like this, for my own application.
Using the baseline configuration, but edited for my PCB, I got 65 FPS at 40 MHz. Unfortunately my DC=9, and my CS=10, because I designed my PCB based on the standard t3 library.
 
Last edited:
I got the lvgl_touch_minimal to run. However, the code says it should be in landscape, but the ILI9341 is in portrait mode.

Yes, that was a typo in the code comments (fixed now) which I probably copy-pasted from another example. This example works in portrait mode.


Edit: Finally understood what you meant by copying everything. Got it to compile and run. Now to figure out how on earth to use something like this, for my own application.
Using the baseline configuration, but edited for my PCB, I got 65 FPS at 40 MHz. Unfortunately my DC=9, and my CS=10, because I designed my PCB based on the standard t3 library.

With the last version of the library, using software DC instead of hardware DC is not so bad. In most case, it just increases the driver's CPU usage by about 20% and the framerate only drop a couple FPS.
I agree the music_demo example is confusing. It is very impressive and showcases the nice things that lvgl can do but it does not help learning how to use it... It think it might be better to start from the lvgl_touch_minimal example and try the snippets of codes there: https://docs.lvgl.io/master/examples.html#. The LVGL documentation seems to be pretty extensive and well maintained.
 
Using the baseline configuration, but edited for my PCB, I got 65 FPS at 40 MHz.

The 65FPS you obtain is related to the framerate set within lvgl:
Code:
disp->refr_timer->period = 15;  // line 158 of lvgl_music_demo.ino
This line tells lvgl refreshes/redraw the UI every 15ms so that the maximum framerate will be around 1000 / 15 = 66 FPS. Thus increasing the SPI speed will not improve anything because getting 65FPS shows that 40mhz is already enough to get the max framerate. However, a higher SPI speed may allow to reduce disp->refr_timer->period even further...
 
I found the frame rate setting. Got it running at 99 fps average.

Apparently Eclipse is 64 bit only these days. For reasons that I won't bore everyone with, I can't use my Linux laptop to program T4's due to a persistent kernel fault. Can't get any one to help me on that. I can find no reports of this error on the kernel issue website. I also can't duplicate it at will and have an instantaneous result. Some time after USB use, like within 10 minutes, after programming a Teensy, my laptop freezes and turns off the power in a hard shutdown. There's no record in the journal files, so there's nothing for anyone to debug. All I know is kernel 5.15.0-25 worked and every kernel after that, up to the most current kernel fails in an identical fashion - hard shutdown 0-10 minutes after programming a Teensy.

So I have to use an RPI to program a Teensy 4.1. I have only 1 64bit RPI4. It makes learning and applying lvgl a bit more tedious than I prefer. RPI4's are not speedy, even if you over clock them. Guess I should get working on the RPI4-64bit to install Eclipse for the simulator.
 
Before doing that, I tried on my pc for the simulator. I do not know where to get Eclipse CDT. I tried the eclipse installer, and there is no mention of CDT in any of the choices. I picked the C/C++ developers IDE. Eventually I found a CDT plug-in. Did all that and tried compiling the lvgl project they tell you to download. The buttons on the IDE don't work, ie Hammer. But the project build accessed from the right button mouse does. The build works. But running results in all sorts of errors. Quite honestly, a mal-documented mess. The links from lvgl do not go directly to where you need to go, or they offer ambiguous choices that are not obvious to a new user.

I found a just Eclipse CDT project on github. https://github.com/eclipse-cdt/cdt Tried downloading that. It used mvn to build. The build fails, after 14 minutes on an i7. Very little clue on what to do when the build fails. Why on earth, after downloading the moon, they couldn't also get the prerequisites - or print out what was needed, is beyond me.

The lvgl page is full of marketing fluff, and incredibly short of detail on how to actually get everything set up correctly. There is no obvious complete tutorial. Clearly written by people who are very familiar with all these tools - but have no idea how to tell new users what to do. Unless someone kindly helps out here, I can't see using these tools at all. The barrier to entry seems very high, requiring far more prerequisite knowledge than indicated in the description. Feel like I wasted my morning.
 
Before doing that, I tried on my pc for the simulator. I do not know where to get Eclipse CDT. I tried the eclipse installer, and there is no mention of CDT in any of the choices. I picked the C/C++ developers IDE. Eventually I found a CDT plug-in. Did all that and tried compiling the lvgl project they tell you to download. The buttons on the IDE don't work, ie Hammer. But the project build accessed from the right button mouse does. The build works. But running results in all sorts of errors. Quite honestly, a mal-documented mess. The links from lvgl do not go directly to where you need to go, or they offer ambiguous choices that are not obvious to a new user.

I found a just Eclipse CDT project on github. https://github.com/eclipse-cdt/cdt Tried downloading that. It used mvn to build. The build fails, after 14 minutes on an i7. Very little clue on what to do when the build fails. Why on earth, after downloading the moon, they couldn't also get the prerequisites - or print out what was needed, is beyond me.

The lvgl page is full of marketing fluff, and incredibly short of detail on how to actually get everything set up correctly. There is no obvious complete tutorial. Clearly written by people who are very familiar with all these tools - but have no idea how to tell new users what to do. Unless someone kindly helps out here, I can't see using these tools at all. The barrier to entry seems very high, requiring far more prerequisite knowledge than indicated in the description. Feel like I wasted my morning.

This once again confirms "Woe from Wit".
A generic product will never work well!
 
I just updated the example in the library to work with LVGL's latest version (the main branch on github).

I just tested it from a freshly installed Windows 10 (64 bits) machine and followed the steps:

  1. Installed Arduino 1.8.19 with default options.
  2. Installed Teensyduino 1.57 with default options.
  3. Downloaded file https://github.com/lvgl/lvgl/archive/refs/heads/master.zip and extracted it into "...\Documents\Arduino\libraries\" folder.
  4. Downloaded file https://github.com/vindar/ILI9341_T4/archive/refs/heads/main.zip and extracted it into "...\Documents\Arduino\libraries\" folder.
  5. Copied and renamed file '...\Documents\Arduino\libraries\lvgl-master\lv_conf_template.h' to '...\Documents\Arduino\libraries\lv_conf.h' (the base library folder).
  6. Edited file '...\Documents\Arduino\libraries\lv_conf.h' with the following changes:
    • [line 15] #if 1
    • [line 76] #define LV_TICK_CUSTOM 1
    • [line 256] #define LV_USE_PERF_MONITOR 1
    • [line 348] #define LV_FONT_MONTSERRAT_12 1
    • [line 349] #define LV_FONT_MONTSERRAT_14 1
    • [line 350] #define LV_FONT_MONTSERRAT_16 1
  7. Set hardware: Teensy 4.1 with the following wiring from the ILI9341 screen:
    • SCK to Teensy pin 13
    • SDO (MISO) to Teensy pin 12
    • SDI (MOSI) to Teensy pin 11
    • DC to Teensy pin 10
    • CS to Teensy pin 9
    • RESET to Teensy pin 6
    • VCC and LED to +5V, GND to ground
  8. Opened Arduino IDE and loaded example: [File]->[Examples]->[ILI9341_T4]->[lvgl_music_demo]. The example compiled and uploaded without trouble.
  9. Loaded [lvgl_minimal_touch] example. Set additional wiring:
    • T_CLK to Teensy pin 13
    • T_CS to Teesny pin 4
    • T_DIN to Teensy pin 11
    • T_DO to Teensy pin 12
    • T_IRQ to Teensy pin 3
    The example compiled and uploaded without trouble again.

Hopefully someone will find this guide useful !

@vindar

Thank you very much for your guide . . . it is excellent !! After following it & executing the steps as you described them, I can now compile the examples with absolutely no problem (I cannot test, as I am out of town & brought my T4.x experimentation platform, which currently includes my 7" 800x480 RA8875 display, but forgot to pack my PJRC ILI9341 display) !!

One additional note: I keep all of my sketches located in a "...\Documents\Arduino\MJCfiles\" folder, so the libraries were installed in the "...\Documents\Arduino\MJCfiles\libraries\" folder, but everything still worked exactly as you described.

Thank you once again for your work & for your clear & complete guide !!

Mark J Culross
KD5RXT
 
I want to apologize to the forum for my rant on lvgl. I have not been able to get the simulator to run, but that is not a reason to vent like I did. It would seem the product is for developers more advanced than I am. Perhaps at another time, I will make an attempt to get the simulator to work.
 
I want to apologize to the forum for my rant on lvgl. I have not been able to get the simulator to run, but that is not a reason to vent like I did. It would seem the product is for developers more advanced than I am. Perhaps at another time, I will make an attempt to get the simulator to work.

I feel your pain!
Used LVGL for a RaspberryPi project, with framebuffer touchscreen (no X)... even just have everything properly configured has been a pain.
Then there's the question of the continuous updating without backwards compatibility: I started on 5.x and painfully worked my way up to 7.x, having to rewrite various pieces of code... then I gave up.
That's too bad because it's so powerful!
 
Yes, every major version breaks backward compatibility. This is a real pain.

The SquareLine Studio to do the layout is pretty good and works on the macOS is well.
 
@vindar: I cannot thank you enough!!

Following your instructions, I managed to have the "lvgl_music_demo" up&running on my T4.1. :D

I got 145fps at about 84% CPU load with refresh=5 and SPI at 80 MHz. And CPU clock speed was only 528 MHz.

Now, I am trying to figure how to start a new project using your ILI9341_T4 library + touch + LVGL and using SquareLine Studio to design the GUI... I think I'm headed to source path hell...! Any advice?
 
@vindar: I cannot thank you enough!!

Following your instructions, I managed to have the "lvgl_music_demo" up&running on my T4.1. :D

I got 145fps at about 84% CPU load with refresh=5 and SPI at 80 MHz. And CPU clock speed was only 528 MHz.

Now, I am trying to figure how to start a new project using your ILI9341_T4 library + touch + LVGL and using SquareLine Studio to design the GUI... I think I'm headed to source path hell...! Any advice?

I'm happy I could help :)

Beware that the framerate shown is a bit misleading. The max refresh rate for the ILI9341 screen is around 130Hz/140Hz so getting a higher FPS will not improve smoothness anyway. Also, the FPS lvgl displays is an average that counts all the frames whether or not changes occurred in between.. So in fact, the drop between the expected framerate (200FPS at refresh=5) and the actual 145 FPS happens when "it really counts". In practice, the real stable framerate is quite a bit lower but this does not really matter as long as animations remain smooth.

As for your question I do not know anything about Squareline studio (and don't know much about LVGL either...). It might be worth asking for advice on the LVGL forum ? Anyway, good luck with your project ! :)
 
Hi, I have ILI9341 with 8-bit parallel interface, ILI9342C with SPI interface and I have no idea how to get either working. Any ideas? I need quite high performance.

Also, sorry to revive old topic.
 
Back
Top