Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 10 of 10

Thread: Teensy 4.0/4.1 & ILI9488 LCD

  1. #1
    Junior Member
    Join Date
    Feb 2021
    Location
    Mclean VA -- West of DC
    Posts
    10

    Teensy 4.0/4.1 & ILI9488 LCD

    I’m new to Arduino. I want to use a Teensy 4 for an audio application and I would very much like to have 480x320 graphics (ILI9488.) I’ve been going in circles for weeks, surely doing many things wrong. I’m on Windows 7, Arduino v1.8.13.

    Question #1 How do I build it? (Tried this 3 times!):
    --Download & install Arduino; install lvgl (v7.11.0) and lv_examples (v7.11.0) libraries
    --Get SKPang’s “Teensy40_lvgl_demo_widgets” (5/24/20) from GitHub; unzip to project folder. The folder is called “Teensy40_lvgl_demo_widgets-master”
    --I don’t see any “makefile”, but I see “Teensy40_lvgl_demo_widgets.ino”, so I load that into Arduino. Arduino immediately says that must be inside a folder named “Teensy40_lvgl_demo_widgets.ino”. I allow it to create that and move the file.
    --Compile fails because ..documents\arduino\libraries\lvgl\src\lv_conf_int ernal.h:40:14: fatal error: ../../lv_conf.h: No such file or directory.
    --Snooping around, I see that in (...)\documents\arduino\libraries\lvgl\, there’s a file “lv_conf_template.h” with instructions inside saying to edit to “enable content”, change the name and move it to the (...)/libraries folder. I do that.
    --Compile fails at #include <ILI9488_t3.h>. I search “Manage Libraries” for ILI9488 library. The only good match is “GFX Library for Arduino”(v1.0.8.) No mention of Teensy and it doesn’t seem to install.
    --Searching the web I find https://github.com/mjs513/ILI9488_t3. This specifically warns that “Teensy LC is not supported at this time.” What about the 4? What the heck -- I download and “add .ZIP library”. Now compile fails at #include <DMAChannel.h>
    --Searching libraries for “Teensy dma” there is exactly one hit: TsyDMASPI. This doesn’t look right. I install it anyway. No change
    --I see SKPang has a link to Teensy40_LittlevGL_ILI9488_demo_create-master (May 24, ‘20). Download & unzip. New .ino and READNE says to edit lv_ex_conf.h, which I don’t have. But there’s one under lv_examples, so I edit it and put it back in (...)/libraries. No change. Give up/retry.

    Question #2. Earlier, I got something to compile but the LCD remained blank (I got the USB monitor to work and it said it couldn’t start the touchscreen controller, which I expect, since mine is resistive and not hooked up! But debug messages indicated that the application was alive.) One issue is the SPI CLK line, which is also the LED. I removed R1, and there is no external load. The clock is fine when low, but the high oscillates between 0.6 and 2.7 Volts at 33 MHz. Exact same seen on Teensy 4.1 with R1 & LED intact. Can the SPI CLK pin be reassigned? What did SKPang do?

    I appreciate all the hard work done by the Teensy team and by SKPang. I'm very eager to build on this foundation.
    Last edited by Bewing; 03-25-2021 at 04:29 AM.

  2. #2

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,022
    The Ili9488_t3 works for T4.x as well as T3.x

    It has worked on unmodified T4s (i.e. the led works). As for Blank, could be anything, like wrong wiring, like backlight not correct for the hardware setup...

    With things like this it really helps to give us additional information, like, which display? The Ebay one, the BuyDisplay one...

    Show the wiring...

    Show what code you are trying to run. ...

  4. #4
    Junior Member
    Join Date
    Feb 2021
    Location
    Mclean VA -- West of DC
    Posts
    10
    Quote Originally Posted by KurtE View Post
    The Ili9488_t3 works for T4.x as well as T3.x

    It has worked on unmodified T4s (i.e. the led works). As for Blank, could be anything, like wrong wiring, like backlight not correct for the hardware setup...

    With things like this it really helps to give us additional information, like, which display? The Ebay one, the BuyDisplay one...

    Show the wiring...

    Show what code you are trying to run. ...
    I greatly appreciate your help (and your collie's).
    I am using several 14-pin LCD panels with ILI9488 (SPI) and resistive touch (I2C?) controllers -- from Amazon and (yes, it's true) Ali Express. But until I see a clock, this definitely isn't my problem.
    I start from a fresh Arduino install. Within Arduino, I use "Manage Libraries" to install lvgl (v7.11.0) and lv_examples (v7.11.0)
    I get SK Pang's code from https://github.com/skpang/Teensy40_lvgl_demo_widgets
    I get ILI9488_t3 from https://github.com/mjs513/ILI9488_t3
    I believe these are all the right components; now it's a question of putting them together. I now realize that code (e.g. .c files) in the same directory as the .ino are automatically included. (Where are the binaries?)
    My current dilemma is that sketch compile fails with ..."Arduino\libraries\ILI9488_t3-master\src/ILI9488_t3.h:61:10: fatal error: DMAChannel.h: No such file or directory:
    Last edited by Bewing; 03-26-2021 at 04:40 AM.

  5. #5
    Junior Member
    Join Date
    Feb 2021
    Location
    Mclean VA -- West of DC
    Posts
    10
    I figured this out -- I didn't install Teensyduino.
    It also appears that I should (possibly?) get ILI9488_t3 from the library, not from the .ZIP file. I'll try that. At the moment, I'm stuck with:
    Teensy40_LittlevGL_ILI9488_demo_create: In function 'void setup()':
    Teensy40_LittlevGL_ILI9488_demo_create:184: error: 'demo_create' was not declared in this scope
    demo_create(); // Create the demo in /lv_example/lv_apps/demo/demo.c
    ^
    Teensy40_LittlevGL_ILI9488_demo_create: In function 'void lv_ex_btn_1()':
    Teensy40_LittlevGL_ILI9488_demo_create:244: error: 'lv_btn_set_toggle' was not declared in this scope
    lv_btn_set_toggle(btn2, true);
    ^
    'demo_create' was not declared in this scope

    But this may be easy to solve. It's late and I must stop. I just wanted to clear up my last post -- I can edit this one but not that one.

  6. #6
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,022
    Yes you can get the ILI9488_t3 with the installs. It is usually reasonably up to date. Especially depending on which version of Teensyduino you have installed. I am using our latest beta build.

    Again assuming one like:
    https://smile.amazon.com/Wondiwe-3-5.../dp/B08MQLSCRP

    I have a couple of ones (not from the link above), I think I got both of mine on ebay... but.

    Personally I would start off with one of our example sketches without LVGL just to make sure it all works for you. Like the graphicstest9488 or I often use one of my own like: Kurts_...
    Or I use the font test 4... But hopefully one of them, just to verify you get pixels on the screen.

    Warning: with all of such contributed sketches, you may need to double check that the sketch is setup for the IO pins you are using.

    And again it helps to see pictures of your wiring. Example sometimes we can pick out things like, you are off by one pin, or one of the solder joints does not look good, or a few cases where people were trying to rely on friction fit of pins to the Teensy pressed into breadboard.

    Good luck

  7. #7
    Junior Member
    Join Date
    Feb 2021
    Location
    Mclean VA -- West of DC
    Posts
    10
    Solid suggestions, Kurt -- thanks, thanks, thanks!
    1) I tried graphicstest9488 and got it to work. (I had to remove splitter resistors because Teensy signals are 3.3V.)
    I thought the clock was moving between logic 0 and floating with oscillations. It is in fact an extremely weak clock (see scope image)
    Click image for larger version. 

Name:	Clock-Signal-Teensy-ILI9488-20210326_205224-Web.jpg 
Views:	17 
Size:	280.3 KB 
ID:	24191
    As shown the clock is 30MHz and oscillating between about 2.76V and 0.54. I have the impression that the author ran the clock as fast as possible and left it there, so there is zero margin. In fact, most of the time, it doesn't work, unless I freeze-mist the Teensy. The problem must be with initialization, because once it starts, it's fine until reset (i.e., USB power cycle). Anyway, GREAT! I would now like to slow the clock down so things are reliable. Is that easy?
    2) Regarding SKPang's code... I now realize I have two different downloads: Teensy40_LittlevGL_ILI9488_demo_create-master.zip and Teensy40_lvgl_demo_widgets-master.zip -- let's call them "create" and "widgets".
    "create" warns that "lvgl.h" is found in 2 libraries: lvgl and lv_arduino. But it fails compilation because " 'lv_btn_set_toggle' was not declared in this scope" -- by which I think it means there is no prototype. Can that be because the wrong .h file is being included, which is related to the warning?
    3) "widgets" compiles. I haven't really tried it (with freeze-mist!) -- I need to reboot because Arduino lost contact with the USB monitor and the display says "Waiting for Arduino Serial Monitor..." -- is that graphics9488 or widgets talking? And so, I have to let this post go. Thanks again, Kurt.

  8. #8
    Junior Member
    Join Date
    Feb 2021
    Location
    Mclean VA -- West of DC
    Posts
    10

    Teensy 4.0/4.1 with ILI9488 and XPT2046 -- working!

    I want to report back that I have SKPang's Teensy40_lvgl_demo_widgets-master working (with many changes). I'm posting this because it might help somebody trying to do the same thing. (In my mind, 480x320 is the smallest practical LCD size for most interactive products. Capacitive touch probably works better but most available, cheap LCDs -- e.g. via ALI -- have resistive controllers. Worse, they don't specify!)
    I now realize that "demo_widgets" is an lv_example and it is amazing -- all kinds of animation and working example buttons, sliders, animations, etc. I'll go further and say the entire lv_examples package and Arduino in general is extremely helpful -- usable, reliable, thorough and well written. I'm about to enter proprietary-development mode, but I'm happy to release this working example (along with a tutorial) -- would that help/should I bother? Thanks again for your help, Kurt.
    Here's the schematic:
    Click image for larger version. 

Name:	Wiring-Screenshot-Web.jpg 
Views:	19 
Size:	181.8 KB 
ID:	24392

  9. #9
    Junior Member
    Join Date
    Feb 2021
    Location
    Mclean VA -- West of DC
    Posts
    10
    Mistakes in that schematic (wish I could delete) -- MISO & MOSI confused. Here's the corrected schematic:
    Click image for larger version. 

Name:	Wiring-Screenshot-Web.jpg 
Views:	13 
Size:	196.1 KB 
ID:	24425

  10. #10
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    6,972
    Looking the schematic I see that you have MISO/MOSI shared between the touch and LCD. Can't remember but you may have a tristate buffer issue. Take a look at step 2 of PJRC's Better SPI Bus Design in 3 Steps. You could try putting touch on SPI1 and see if that works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •