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

Thread: Teensy 4 + 2.8" TFT using ILI9341_t3 issues.

  1. #1
    Junior Member KG5NII's Avatar
    Join Date
    Aug 2019
    Location
    Texas
    Posts
    10

    Teensy 4 + 2.8" TFT using ILI9341_t3 issues.

    SETUP:

    Teensy 4 + 2.8 inch ILI9341 TFT display using ILI9341_T3
    Teensyduno-1.47-beta7
    Arduino 1.8.8 on Linux 4.19.27 (Funtoo Linux)

    I've a prototype Teensy TFT display shield PCB I originally designed to be used with Teensy 3.2
    The TFT display pinouts on that PCB are different than the pinouts Teensy 4 needs. Therefore I cut
    the traces between the Teensy and TFT on the PCB and rewired as per the code below with kynar wire.


    ISSUES:

    I'm having issues with display corruption at random times.
    I've tried multiple displays with the same result.
    In the example code below (which originally comes from the library example code)
    it seems to work, BUT, not for long. Usually end up at some point early on with a
    white display, or sometimes just a mass of graphics corruption that ends up as a white screen.
    Displaying text seems to be stable, but in general nothing seems to be rock solid at all.


    Questions:

    • What is the status of ILI9341_T3 on Teensy 4?
    • Could someone verify proper and stable operation on their setup?
    • 2 days of testing and trying different code has left me stumped. If others are experiencing the same issue then frankly I would be happy, It's not the TFT display. Tried 3 of them with same results. At this point I'm almost frustrated and am definitely sleep depraved. Suggestions anyone?
    • A completely different question: AGND (Teensy 3.x) is now GND on Teensy 4 or is that a misprint on the info card?



    In the following code, my TFT is setup with TFT reset pin to teensy pin 8. If your TFT reset pin is connected to the Teensy 3.3v pin then set TFT_RST to 255.


    Code:
    #include <SPI.h>
    #include <ILI9341_t3.h>
    
    
    #define BACKLITE   1                       // 1 = enable if using backlight control,
                                                        // 0 = disable. Display brightness is set via external resistor
                                       
    #define SECONDS 2000                    // Delay in ms
    
    
    const uint8_t TFT_BACKLITE    =    6;  // Backlight brightness control.
                                                        // LED pin of TFT connected to this pin via 100 Ohm resistor.
                                           
    const uint8_t TFT_RST         =    8;    // TFT's RESET pin connects here. A nice way to hw reset the TFT
                                                        // This appears to only occur during a tft.begin() call.
                                                        // Otherwise connect TFT's RESET pin to Teensy 3.3v pin and set value to 255 
    
    
    // Normal SPI Connections 
    const uint8_t TFT_DC          =    9;
    const uint8_t TFT_CS          =   10;
    const uint8_t TFT_MOSI        =   11;
    const uint8_t TFT_MISO        =   12;
    const uint8_t TFT_SCLK        =   13;
    
    
    const char msg[17] = "testTriangles():";
    uint16_t counter = 1;
    
    
    ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_MISO);
    
    
    void setup() {
      Serial.begin(115200);
     #if BACKLITE
        const uint8_t brightness = 7;                               // brightness level 0 - 10      
        analogWrite(TFT_BACKLITE, 5 + 25*brightness);     // resulting values of 5 - 255
     #endif   
      tft.begin();
      tft.setRotation(1);
      tft.setTextColor(ILI9341_CYAN);
      tft.setTextSize(1);
    }
    
    
    
    
    void loop(void) {
       testTriangles();
       counter++;
       delay(SECONDS);
    }
    
    
    void testTriangles(void) {
      int16_t       n,  i,  cx = tft.width()  / 2 - 1,
                            cy = tft.height() / 2 - 1;
    
    
      tft.fillScreen(ILI9341_BLACK);
      tft.setCursor(0,0);
         tft.printf("%s %d",  msg, counter);
      Serial.printf("%s %d\n",msg, counter);
      
      n     = min(cx, cy);
    
    
      for(i=0; i<n; i+=5) {
        tft.drawTriangle(
                          cx    , cy - i,            // peak
                          cx - i, cy + i,           // bottom left
                          cx + i, cy + i,          // bottom right
                          tft.color565(0, 0, i)
                         ); 
      }
    }


    Thanks in advance,
    Ron KG5NII

    Attached Files Attached Files
    Last edited by KG5NII; 08-17-2019 at 06:43 PM. Reason: Correct bogus comments in code

  2. #2
    Junior Member KG5NII's Avatar
    Join Date
    Aug 2019
    Location
    Texas
    Posts
    10
    Code commentary in the file attachment referring TFT_RST is wrong. Instead of the TFT's LED pin it should be the TFT's RESET pin.
    Mistakes are my thing. I'm good at them. Unbelievable the mistakes I can spot once going public with the code.
    It's a big deal cuz someone new reading this could get all confused. I sure did. My apologies for this. I will endeavor
    to be more accurate in the future.

    Ron KG5NII
    Last edited by KG5NII; 08-17-2019 at 06:45 PM. Reason: Clarify which code was wrong

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,421
    Not sure if what you have is working now or not?

    I did the conversion to get it to run on the T4, which has worked for me. Will try yours later. You might change the ili9341_t3 library and lower the MAX SPI speed and see if that helps.

  4. #4
    Junior Member KG5NII's Avatar
    Join Date
    Aug 2019
    Location
    Texas
    Posts
    10
    Kurt,
    Thank you for your reply. Don't bother. Its now working. Turns out that pin 13 (SCLK) had a tad too much flux on it which was causing a high resistance connection. Not your typical brown goo flux. Wasn't that easy to see. Deal is my 12 yo daughter is the one who found the issue less than 60 sec after she started looking. Then I was lectured about keeping my header pins clean. Good grief. Double face palm. I'm going to go get a beer now.

    Cheers,
    Ron, KG5NII

Tags for this Thread

Posting Permissions

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