Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 2 1 2 LastLast
Results 1 to 25 of 30

Thread: ILI9341 not working on Teensy 4.1

  1. #1
    Member
    Join Date
    Jan 2023
    Location
    София
    Posts
    41

    ILI9341 not working on Teensy 4.1

    Hello, I am attempting to use the ILI9341_t3 library on my Teensy 4.1, but I get only a white screen and nothing else. The code used is the graphics test, but the display shows nothing but white. For a moment, it did work, but instantly went white again. All the wiring is the same as it s ays to wire it up in the demo, but I have changed the CS pin to GPIO 9 and the D/C pin to GPIO 10.

  2. #2
    Senior Member
    Join Date
    May 2022
    Posts
    279
    Please post your code per the website rules. It helps us help you! Please use the code tag, indicated by the # so your formatting stays intact. It's hard to tell what you have done, if you don't show everything.

  3. #3
    Member
    Join Date
    Jan 2023
    Location
    София
    Posts
    41
    As I said, the code is identical as the one found in Examples -> ILI9341_t3 -> graphicstest, but just swapped CS and DC to #define TFT_DC 10 & #define TFT_CS 9

  4. #4
    It looks like you may have pin #6 tied to RESET on the display? If so, unless you are modifying the program to drive that pin high, the reset pin will be floating which could give intermittent operation. You can just tie the RESET pin to 3.3V to see if that is the problem.

  5. #5
    Member
    Join Date
    Jan 2023
    Location
    София
    Posts
    41
    Well, there's an improvement. Now it displays some unusual stripes:


  6. #6
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,556
    never tried it to see what happens but it looks like you have vcc tied to 5v? try tieing it to 3.3v and bl to 5v, set tft.rst to your rst pin. Usually when I get blank screens it because I dont have RST set.

  7. #7
    Member
    Join Date
    Jan 2023
    Location
    София
    Posts
    41
    There is a different library that doesn't have any GFX, but it works. Yesterday for some reason in the morning it was working with 3.3v, but later that day it only wanted to work with 5v.

    Giving the display 3v and with RST pin set I get a grey screen.

    EDIT: I tried an ST7789 240x320 with ST7789_t3 and it works, but this ILI doesn't want to work with ILI9341_t3

  8. #8
    Senior Member
    Join Date
    May 2022
    Posts
    279
    Strange. I have used 4 of these ILI9341 displays and haven't had a problem. However, I used the following defines.
    Code:
    #define TFT_DC  9
    #define TFT_CS 10
    #define TFT_RST -1
    #define TFT_SCK 13
    #define TFT_MISO 12
    #define TFT_MOSI 11
    #define TOUCH_CS  8
    I tied reset to +3.3V. The back light is tied to +5V through a 100 ohm resistor, per some recommendations I have read.
    Constructors are:
    Code:
    XPT2046_Touchscreen ts(TOUCH_CS);
    ILI9341_t3n tft = ILI9341_t3n(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCK, TFT_MISO);
    I use the ILI9341_t3n library and haven't had any significant issues with it. I have built an Electronic Lead Screw for my lathe around this display. All my boards come right up and into the application. The display is powered by +5V since it has its own 3.3V regulator. Touch works great as well, although you do have to match the touch rotation to your screen rotation. That information is right on the sticker on the PJRC DISPLAY_ILI9341_TOUCH_32 that I use.
    Last edited by clinker8; 01-13-2023 at 09:19 PM. Reason: add clarifying information

  9. #9
    Member
    Join Date
    Jan 2023
    Location
    София
    Posts
    41
    What's the difference between ILI9341_t3n and ILI9341_t3?

  10. #10
    Senior Member
    Join Date
    May 2022
    Posts
    279
    Different authors. I'm sure a couple of features. Seemed like the t3n fit better with what I wanted to do. I needed to do strings, and floats with the correct number of digits in my display.
    t3 is the baseline library. It should work for you. I think you should check your wiring. It's quite hard to tell if you got it right, from the photos. I initially had problems with mine, but once I got it wired correctly, everything worked great.

    This is what I would do, since you are not using a PCB. Remove all the wires. Wire it exactly like the original example. Shouldn't take but a couple of minutes. Use the original example code. What happens? It's real easy to miscount pins, so take it slow and easy when rewiring.

  11. #11
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    11,417
    ili9341_t3n is my extended version of the ili9341_t3 library. It has things like DMA screen updates, Can be used on all of the SPI busses...

  12. #12
    Senior Member
    Join Date
    May 2022
    Posts
    279
    Quote Originally Posted by KurtE View Post
    ili9341_t3n is my extended version of the ili9341_t3 library. It has things like DMA screen updates, Can be used on all of the SPI busses...
    Was hoping you would jump in.

  13. #13
    Member
    Join Date
    Jan 2023
    Location
    София
    Posts
    41
    Quote Originally Posted by clinker8 View Post
    Remove all the wires. Wire it exactly like the original example. Shouldn't take but a couple of minutes. Use the original example code. What happens? It's real easy to miscount pins, so take it slow and easy when rewiring.
    Still not working, only stripes
    Last edited by Windorey; 01-13-2023 at 09:54 PM. Reason: Add quote

  14. #14
    Member
    Join Date
    Jan 2023
    Location
    София
    Posts
    41
    Quote Originally Posted by KurtE View Post
    ili9341_t3n is my extended version of the ili9341_t3 library. It has things like DMA screen updates, Can be used on all of the SPI busses...
    Do you have such a library for ST7789 that supports the DMA? It could be useful with LittlevGL to get a nice rotary encoder UI.
    Last edited by Windorey; 01-13-2023 at 09:52 PM. Reason: Add quote

  15. #15
    It still looks like you have reset connected to a digital pin (D8?) rather than 3.3V, but hard to tell for sure from the pic.

  16. #16
    Member
    Join Date
    Jan 2023
    Location
    София
    Posts
    41
    It was connected to such a pin, but configured for it in the constructor for the display.

  17. #17
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,656
    Do you have a voltmeter? Maybe try the LED blink program. Its default is pin 13. Upload and then touch your voltmeter to GND and SCK on the top of the display, to check that pin 13 really is changing voltage connected all the way to the display. Then edit pin number, upload again, and measure another pin, and repeat for all the signals. Yeah, tedious, but simple and effective for checking if one of the wires isn't actually connected.

  18. #18
    Member
    Join Date
    Jan 2023
    Location
    София
    Posts
    41
    Tested all pins individually, every single one works.

  19. #19
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    11,417
    Couple of things:

    a) I have found these displays more reliable when you setup a Reset pin which is passed into constructor.

    b) If I find it not working well, I try to drop the SPI speed. I believe this library defaults to 30mhz.
    #define ILI9341_SPICLOCK 30000000

    I would try lowering it to 20mhz and see if that makes a difference. You can either do it by edigint the define.
    Or you could add a call in to tft.setClock(20000000);

    c) I don't remember what hardware CS pin requirement this library has for CS or more likely DC. That is with T3.x they both need to be hardware CS pins. But our T4.x boards only have one CS pin on the main SPI object.
    I know with _t3n, I removed the requirement. We might get a slight change in speed if the DC uses the hardware CS pin.

  20. #20
    Member
    Join Date
    Jan 2023
    Location
    София
    Posts
    41
    Quote Originally Posted by KurtE View Post
    Couple of things:

    a) I have found these displays more reliable when you setup a Reset pin which is passed into constructor.

    b) If I find it not working well, I try to drop the SPI speed. I believe this library defaults to 30mhz.
    #define ILI9341_SPICLOCK 30000000

    I would try lowering it to 20mhz and see if that makes a difference. You can either do it by edigint the define.
    Or you could add a call in to tft.setClock(20000000);

    c) I don't remember what hardware CS pin requirement this library has for CS or more likely DC. That is with T3.x they both need to be hardware CS pins. But our T4.x boards only have one CS pin on the main SPI object.
    I know with _t3n, I removed the requirement. We might get a slight change in speed if the DC uses the hardware CS pin.
    My display has no trouble running with 115 MHz at all, and I have tried adding the reset pin to the constructor, with the same error. I am also previously aware of the speed increase by using DC on the hardware CS pin from a different library.

  21. #21
    Member
    Join Date
    Jan 2023
    Location
    София
    Posts
    41
    New thing, the display no longer works at all.
    I tried the old library which works, no results. Just stripes on the display and nothing else.
    Is there any way I could revive it?

  22. #22
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,556
    Quote Originally Posted by Windorey View Post
    New thing, the display no longer works at all.
    I tried the old library which works, no results. Just stripes on the display and nothing else.
    Is there any way I could revive it?
    You might have unconnected a wire by accident. Had the wiring on these displays but when have to sometimes pulling all the wire off and reconnecting them works for me. As for libraries I usually use the ILI9341_t3n library with the following connections:
    Code:
    #define TFT_DC  9
    #define TFT_CS 10
    #define TFT_RST 9
    #define TFT_SCK 13
    #define TFT_MISO 12
    #define TFT_MOSI 11
    VCC = 3.3v, BL = 5v, gnd to gnd.

    Using the following constructor:
    Code:
    ILI9341_t3n tft = ILI9341_t3n(TFT_CS, TFT_DC, TFT_RST)
    Pretty much identical to @clinker8. Usually when I get the wiring right it works. I always using the Graphicstest sketch in the lib to make sure.

  23. #23
    Member
    Join Date
    Jan 2023
    Location
    София
    Posts
    41
    Well, Iíve tried different breadboards, different MCU boards, different wires and even new headers for the LCD and nothing worked. ESP32, STM32F401 and the Teensy all canít get it to work, only the stripes.

  24. #24
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,556
    Did you check pin 13 as @Paul suggested in post #17.

  25. #25
    Member
    Join Date
    Jan 2023
    Location
    София
    Posts
    41
    I checked all pins of all the boards I used. Every single one worked fine.

Posting Permissions

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