Teensy 3.6 ILI9341 TFT display failure

Status
Not open for further replies.

gweep

Member
I have not been able to get any of my ILI9341 spi displays to work with the Teensy 3.6. All I get are white or grey screens with occasional flicker as the graphic test proceeds. (I have tried three different displays, one of which is the PJRC 2.8 touch screen.) Each of these displays works when driven by an arduino or esp8266. I am running Arduino 1.8.0 with Teensy Loader 1.34 on a Macintosh.

Attached is my code which is an slight modification of the ILI9341_t3 graphictest example... Note that I am using the pins suggested for use with the audio board (per the PJRC page for the Color 320x240 TFT Touchscreen, ILI9341). I have tried the normal teensy 3.x spi connections as well with the same result. I am pretty sure my connections are correct. A photo of my connections is also attached.

Your assistance is appreciated.


Code:
/***************************************************
  This is our GFX example for the Adafruit ILI9341 Breakout and Shield
  ----> http://www.adafruit.com/products/1651

  Check out the links above for our tutorials and wiring diagrams
  These displays use SPI to communicate, 4 or 5 pins are required to
  interface (RST is optional)
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 ****************************************************/


#include "SPI.h"
#include "ILI9341_t3.h"


// For optimized ILI9341_t3 library
#define TFT_DC      20
#define TFT_CS      21
#define TFT_RST    255  // 255 = unused, connect to 3.3V
#define TFT_MOSI     7
#define TFT_SCLK    14
#define TFT_MISO    12
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_MISO);



void setup() {
  int led = 13;
  pinMode(led, OUTPUT);
  
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(200);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(200);               // wait for a second
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(200);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW


  delay(2000);
  tft.begin();

  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(200);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(200);               // wait for a second
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(200);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW


  tft.fillScreen(ILI9341_BLACK);
  tft.setTextColor(ILI9341_YELLOW);
  tft.setTextSize(2);

  
  tft.println("Waiting for Arduino Serial Monitor...");

  Serial.begin(9600);
  while (!Serial) ; // wait for Arduino Serial Monitor
  Serial.println("ILI9341 Test!");


  // read diagnostics (optional but can help debug problems)
  uint8_t x = tft.readcommand8(ILI9341_RDMODE);
  Serial.print("Display Power Mode: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDMADCTL);
  Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDPIXFMT);
  Serial.print("Pixel Format: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDIMGFMT);
  Serial.print("Image Format: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDSELFDIAG);
  Serial.print("Self Diagnostic: 0x"); Serial.println(x, HEX);

  Serial.println(F("Benchmark                Time (microseconds)"));

  Serial.print(F("Screen fill              "));
  Serial.println(testFillScreen());
  delay(200);

  Serial.print(F("Text                     "));
  Serial.println(testText());
  delay(600);

  Serial.print(F("Lines                    "));
  Serial.println(testLines(ILI9341_CYAN));
  delay(200);

  Serial.print(F("Horiz/Vert Lines         "));
  Serial.println(testFastLines(ILI9341_RED, ILI9341_BLUE));
  delay(200);

  Serial.print(F("Rectangles (outline)     "));
  Serial.println(testRects(ILI9341_GREEN));
  delay(200);

  Serial.print(F("Rectangles (filled)      "));
  Serial.println(testFilledRects(ILI9341_YELLOW, ILI9341_MAGENTA));
  delay(200);

  Serial.print(F("Circles (filled)         "));
  Serial.println(testFilledCircles(10, ILI9341_MAGENTA));

  Serial.print(F("Circles (outline)        "));
  Serial.println(testCircles(10, ILI9341_WHITE));
  delay(200);

  Serial.print(F("Triangles (outline)      "));
  Serial.println(testTriangles());
  delay(200);

  Serial.print(F("Triangles (filled)       "));
  Serial.println(testFilledTriangles());
  delay(200);

  Serial.print(F("Rounded rects (outline)  "));
  Serial.println(testRoundRects());
  delay(200);

  Serial.print(F("Rounded rects (filled)   "));
  Serial.println(testFilledRoundRects());
  delay(200);

  Serial.println(F("Done!"));

}


void loop(void) {
  for (uint8_t rotation = 0; rotation < 4; rotation++) {
    tft.setRotation(rotation);
    testText();
    delay(1000);


    int led = 13;
    pinMode(led, OUTPUT);
    digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
    delay(500);               // wait for a second
    digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW

  }
}

unsigned long testFillScreen() {
  unsigned long start = micros();
  tft.fillScreen(ILI9341_BLACK);
  tft.fillScreen(ILI9341_RED);
  tft.fillScreen(ILI9341_GREEN);
  tft.fillScreen(ILI9341_BLUE);
  tft.fillScreen(ILI9341_BLACK);
  return micros() - start;
}

unsigned long testText() {
  tft.fillScreen(ILI9341_BLACK);
  unsigned long start = micros();
  tft.setCursor(0, 0);
  tft.setTextColor(ILI9341_WHITE);  tft.setTextSize(1);
  tft.println("Hello World!");
  tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2);
  tft.println(1234.56);
  tft.setTextColor(ILI9341_RED);    tft.setTextSize(3);
  tft.println(0xDEADBEEF, HEX);
  tft.println();
  tft.setTextColor(ILI9341_GREEN);
  tft.setTextSize(5);
  tft.println("Groop");
  tft.setTextSize(2);
  tft.println("I implore thee,");
  tft.setTextSize(1);
  tft.println("my foonting turlingdromes.");
  tft.println("And hooptiously drangle me");
  tft.println("with crinkly bindlewurdles,");
  tft.println("Or I will rend thee");
  tft.println("in the gobberwarts");
  tft.println("with my blurglecruncheon,");
  tft.println("see if I don't!");
  return micros() - start;
}

unsigned long testLines(uint16_t color) {
  unsigned long start, t;
  int           x1, y1, x2, y2,
                w = tft.width(),
                h = tft.height();

  tft.fillScreen(ILI9341_BLACK);

  x1 = y1 = 0;
  y2    = h - 1;
  start = micros();
  for (x2 = 0; x2 < w; x2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = w - 1;
  for (y2 = 0; y2 < h; y2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  t     = micros() - start; // fillScreen doesn't count against timing

  tft.fillScreen(ILI9341_BLACK);

  x1    = w - 1;
  y1    = 0;
  y2    = h - 1;
  start = micros();
  for (x2 = 0; x2 < w; x2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = 0;
  for (y2 = 0; y2 < h; y2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;

  tft.fillScreen(ILI9341_BLACK);

  x1    = 0;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  for (x2 = 0; x2 < w; x2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = w - 1;
  for (y2 = 0; y2 < h; y2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;

  tft.fillScreen(ILI9341_BLACK);

  x1    = w - 1;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  for (x2 = 0; x2 < w; x2 += 6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = 0;
  for (y2 = 0; y2 < h; y2 += 6) tft.drawLine(x1, y1, x2, y2, color);

  return micros() - start;
}

unsigned long testFastLines(uint16_t color1, uint16_t color2) {
  unsigned long start;
  int           x, y, w = tft.width(), h = tft.height();

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for (y = 0; y < h; y += 5) tft.drawFastHLine(0, y, w, color1);
  for (x = 0; x < w; x += 5) tft.drawFastVLine(x, 0, h, color2);

  return micros() - start;
}

unsigned long testRects(uint16_t color) {
  unsigned long start;
  int           n, i, i2,
                cx = tft.width()  / 2,
                cy = tft.height() / 2;

  tft.fillScreen(ILI9341_BLACK);
  n     = min(tft.width(), tft.height());
  start = micros();
  for (i = 2; i < n; i += 6) {
    i2 = i / 2;
    tft.drawRect(cx - i2, cy - i2, i, i, color);
  }

  return micros() - start;
}

unsigned long testFilledRects(uint16_t color1, uint16_t color2) {
  unsigned long start, t = 0;
  int           n, i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  n = min(tft.width(), tft.height()) - 1;
  for (i = n; i > 0; i -= 6) {
    i2    = i / 2;
    start = micros();
    tft.fillRect(cx - i2, cy - i2, i, i, color1);
    t    += micros() - start;
    // Outlines are not included in timing results
    tft.drawRect(cx - i2, cy - i2, i, i, color2);
  }

  return t;
}

unsigned long testFilledCircles(uint8_t radius, uint16_t color) {
  unsigned long start;
  int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for (x = radius; x < w; x += r2) {
    for (y = radius; y < h; y += r2) {
      tft.fillCircle(x, y, radius, color);
    }
  }

  return micros() - start;
}

unsigned long testCircles(uint8_t radius, uint16_t color) {
  unsigned long start;
  int           x, y, r2 = radius * 2,
                      w = tft.width()  + radius,
                      h = tft.height() + radius;

  // Screen is not cleared for this one -- this is
  // intentional and does not affect the reported time.
  start = micros();
  for (x = 0; x < w; x += r2) {
    for (y = 0; y < h; y += r2) {
      tft.drawCircle(x, y, radius, color);
    }
  }

  return micros() - start;
}

unsigned long testTriangles() {
  unsigned long start;
  int           n, i, cx = tft.width()  / 2 - 1,
                      cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  n     = min(cx, cy);
  start = micros();
  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));
  }

  return micros() - start;
}

unsigned long testFilledTriangles() {
  unsigned long start, t = 0;
  int           i, cx = tft.width()  / 2 - 1,
                   cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for (i = min(cx, cy); i > 10; i -= 5) {
    start = micros();
    tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
                     tft.color565(0, i, i));
    t += micros() - start;
    tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
                     tft.color565(i, i, 0));
  }

  return t;
}

unsigned long testRoundRects() {
  unsigned long start;
  int           w, i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  w     = min(tft.width(), tft.height()) - 1;
  start = micros();
  for (i = 0; i < w; i += 6) {
    i2 = i / 2;
    tft.drawRoundRect(cx - i2, cy - i2, i, i, i / 8, tft.color565(i, 0, 0));
  }

  return micros() - start;
}

unsigned long testFilledRoundRects() {
  unsigned long start;
  int           i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for (i = min(tft.width(), tft.height()) - 1; i > 20; i -= 6) {
    i2 = i / 2;
    tft.fillRoundRect(cx - i2, cy - i2, i, i, i / 8, tft.color565(0, i, 0));
  }

  return micros() - start;
}



image1.jpg



Also here are the results of the tft diagnostics from the graphicstest sketch. Some how I expect all the 0xFF's to be errors?


ILI9341 Test!
Display Power Mode: 0xFF
MADCTL Mode: 0xFF
Pixel Format: 0xFF
Image Format: 0xFF
Self Diagnostic: 0xFF
Benchmark Time (microseconds)
Screen fill 224742
Text 11347
Lines 58363
Horiz/Vert Lines 18381
Rectangles (outline) 11683
Rectangles (filled) 461663
Circles (filled) 69358
Circles (outline) 53755
Triangles (outline) 14107
Triangles (filled) 153778
Rounded rects (outline) 24568
Rounded rects (filled) 504110
Done!
 

Attachments

  • graphicstest_PJRC_Teensy36_ILI9431.ino
    10.9 KB · Views: 137
Last edited:
Hi All,

I am still struggling to get my spi ILI9341 display to work with my Teensy 3.6. I put my old oscilloscope on each of the display pins. As best as I can see, the signals are ranging from just above 0V to just below 3.3V. Adding pull-up and pull-down resistors did little to change the signals. I have read a few posts in the forum that suggest slowing down the cpu to see if the display works. Not sure how to do that. In the long run slowing the cpu down is counter to the reason for purchasing a faster cpu.

At this point I am willing to try anything.

Perhaps I have a bad Teensy 3.6?
 
I would double check your wiring. Also I assume your headers are soldered to the Teensy? I would double check your soldering.

Sometimes I have had displays that did not work without reset pin connected up. So try connecting to IO pin and change the number in the define.

I have that display working with a few different T3.6 boards, so it should work.

But it is hard to see for sure in the picture where all of the wires are that plug into display. Example between: CS Reset DC pins hard to be sure they are all plugged in correctly.

If you have an old scope, does it have two channels? If so if you connect to MOSI and SCK, does it look like SCK is doing a good regular clock like pulse andthe MOSI pin showing some some different values depending on what data is being sent?

Sorry don't have anything specific...
 
I also have several of these displays working with several Teensy 3.6 boards.

Your code seems typical but your picture of the connections is a bit hard to trace.

I would start by double checking your connections against the "connections" table found at
https://www.pjrc.com/store/display_ili9341_touch.html

One connection that is different from the table and is different from my working displays is that you appear to feed the backlight LED Resistor (100ohm) from the Teensy 3.3v supply rather than the more common VIN (5v) pin. I would be surprised to find this would make a big difference but it is a 'difference' between the usual 'working' examples and your 'troublesome' display.
 
Last edited:
Look at the menu on your IDE where you choose the teensy. There will be a selection for cpu speed. I don't know about yours, but the teensy 3.2 has overclock 9x then 72? then a bunch others. I have to run on 72 to get the tft to work. And that's better than the Arduino at what? 16?

-jim lee
 
Again on my T3.6m I typically use the default speed of 180mhz sometimes I push the processor faster and it has not caused any issues with the display.

So again I wonder about wiring. Again things like are the headers soldered onto the teensy? There have been a couple of cases lately where someone thought that the friction between the headers and the Teensy would work...

Sometimes if I wonder if the IO pins are working, I remove all of the wires running to things like the display. I run a simple sketch like:
Code:
int current_pin = 13;
int next_pin_number = 0;
void setup() {
  // Blink any pin.  Note: I put pin 13 as input to see if we can
  // jumper to it to see if we can find the pin...
  while (!Serial && millis() < 5000);
  Serial.begin(115200);
  delay (250);
  Serial.println("Find Pin by blinking");
  Serial.println("Enter pin number or Pin Name (Example E4) to blink");
  pinMode(13, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (Serial.available()) {
    int ch;
    while ((ch = Serial.read()) != -1) {
      if ((ch >= '0') && (ch <= '9')) {
        next_pin_number = next_pin_number * 10 + (ch - '0');
      } else {
        if (next_pin_number != 0) {
          digitalWrite(current_pin, LOW); // turn the previous pin to low...
          current_pin = next_pin_number;
          pinMode(current_pin, OUTPUT);
          if (current_pin != 13)
            pinMode(13, INPUT);
          digitalWrite(current_pin, HIGH);
          next_pin_number = 0;  // setup to enter next pin
          Serial.printf("Now Blinking pin %d\n\r", current_pin);
        }
      }
    }

  } else {
    digitalWrite(current_pin, !digitalRead(current_pin));
    delay(250);
  }
}
Note: this program is nothing special and has a bug that it probably does not work for pin 0...
What it does is to blink any pin. You simply type in the pin number into the serial terminal. If the pin is not 13(LED), it turns pin 13 to input.

I then hook up a jumper from pin 13. and type in a pin number I am wondering about, in this case all of your IO pins that you are using for display.
Example type in on of the pins you are using, ie one of these: 20, 21, 7, 14, 12

Example 20. Now run your jumper for pin 20 to pin 13 and the led on the board show now be blinking steady on then off. Now type in another one 21, the pin 20 jumper should stay low but if you then move jumper to have it from 13 to 21, the led should start blinking again...

If all of the Pins are working correctly, I would then try hooking up your display again.
 
Thanks for the code, all of my pins (21, 20, 7, 14, 12 and 10, 9, 11, 13, 12) are working. The LED was flashing nice and bright. I did reheat all of my solder joints, they all look good. Wiring still looks correct.

One thing that I have been doing all along is supplying 5V regulated via an external supply (LM7805) at VIN and GND (near pin 0). I do have the external supply isolated from the USB supply as I have cut the trace on the backside of the board. I have recently added a 10uF and a 0.1uF capacitor at the output of my LM7805 supply. This seems to have improved things just a bit as it has added just a hint of flickering on the screen. The flickering tells me that communication is being attempted, however, all the hex diagnostics still come back as 0xFF.

I have also removed the protoboard from the signal connections and am now using straight jumpers between the display and the Teensy. No real improvement there.

Not sure what to try next.
 
Here is what I would do. Not sure if it would help.

I would try using my version of the library: https://github.com/KurtE/ILI9341_t3n
It also uses my SPIN library.

I would move the code to init Serial to the top with the while (!Serial) ;
stuff and the Serial.begin before the init of the display... I would then try running it again. Note: with my library you need to change the object type as well as the include file names...

I may have additional diagnostic prints in that may print something during the tft.begin call.

I also double check that I did not mix up MISO with MOSI and likewise DC with CS...

And again if it were me, I would hook up logic analyzer up to all of the main pins (CS, DC, MISO, MOSI, SCK and reset) and try to see what the signals are doing, but I know that is cheating ;)

I might also double check with voltmeter that your voltage regulator is putting out 5v and that you have 3.3v on the 3.3v pins...

Not sure what else to recommend.
 
Moving the serial statements did not improve results. Voltages correct. I am connecting CS to CS, DC to DC, MOSI to MOSI, and MISO to MISO.

I was unable to execute with your ILI9341 and SPI libraries. It was unable to find the file "font_ArialBoldX.h"

I measured the current supplied to the circuit. 135 mA total with 55 mA to the display, leaving 80 mA used by the Teensy 3.6. Does this sound correct? My LM7805 is dropping voltage down to 5V from 13.8V. I calculate 1.2W dissipated by the 7805; which does get good and warm. It will need a heat sink before I am done.
 
Yes - sorry always fun dealing with things like font files. The problem is suppose two (or three) libraries have the fond_AarialBold.h file as part of them, the Arduino compiler appears to not always choose the one I want to use. That is if it finds the file in the library ili9341_t3 and it finds it in ili9341_t3n, the Arduino compiler might choose to include it from ili9341_t3 folder even though it already knows to include the ili9341_t3n folder. So then it compiles in tries to add both these directories to the build and you end up with duplicate symbols... Not sure best way to handle this.

Again I assume you have tried connecting up the RESET pin of the display to an IO pin, which you configure in. I have had a display or two that was not happy without being properly reset... Now on my own board I have it tied to the reset signal of the Teensy, so it resets as the board boots...

Also it looks like in your first picture like you do have a PU resistor going to the LED pin. I can not tell from your picture how many ohms it is? If I looked correctly it appears like you are connecting it up to +3.3v whereas the hook guide (https://www.pjrc.com/store/display_ili9341_touch.html) shows an 100 ohm resistor hooked up to VIN (+5v). Hopefully it is not something as simple as you don't have enough voltage going to the LED, so you are not seeing the output...
 
Well let that be a lesson to everyone. I just discovered that three of my brand new jumper leads were open! I tested all leads for opens and replaced as required....

HURRAY! All 4 of my displays are now working with the Adafruit_ILI9341 Library. Three of them work with the optimized ILI9341_t3 Library. My 3.2" Raspberry Pi display does not like the ILI9341_t3 Library. The speed difference between the two libraries is amazing.

I would like to try your ILI9341_t3n Library to see if it will work with the Raspberry Pi display. Where can I find a copy of that font?

Now I have to dig through my jumper lead box one-by-one to find all of the open jumpers from the new batch that I just mixed into the box... I guess I am going to need a better source for jumpers. It is always something!
 
Good to hear you have things working.

Looks like an update did not get pushed up to ili9341_t3n library, when i renamed the font files in the library.
The one font file change has been pushed up now. Simply changes the #include in the file to the right name.
Sorry about that.
 
Thanks for the quick update to your ili9341_t3n library. My Raspberry Pi 3.2" display does not like the ili9341_t3n library either. At this point I assume the problem is a speed of communication issue.

Is there a way to slow down the communication speed and still remain faster than the Adafruit library?
 
I will see if I can dig out my display to get an idea why it might not be working. Wonder if it may be some init value or the like.
 
Thanks for the quick update to your ili9341_t3n library. My Raspberry Pi 3.2" display does not like the ili9341_t3n library either. At this point I assume the problem is a speed of communication issue.

Is there a way to slow down the communication speed and still remain faster than the Adafruit library?
How do you have it hooked up? My assumption is you need to hook up 3.3v and 5v (1 and 2) plus GND (4), MOSI(19), MISO(21), MOSI(23), TFT DC(22), TFT CS(24)
Maybe RT_CS(26). Looks like the background lighting defaults to not need hook up). Reset pin looks sort of interesting in the schematic: https://cdn-learn.adafruit.com/asse...riginal/raspberry_pi_piplussch.png?1431968295

I know I ran this earlier (don't remember which library), but may not get around to trying it again yet today.
 
I am using a Canakit.com breakout board for the RPI GPIO header, a nice accessory but it is marked with GPIO numbers not pin numbers. I will translate to pin numbers. I have a cheap eBay display. I noted that the pin usage varies from display to display and that many vendors are offering their own RPI driver software because of it. Mine is marked "version 3.1", but I don't think that standardizes the pin usage.

Currently only using 5v(2), it does work on 3.3v(1) alone. Powered both for a while, did not seem to make a difference. GND(4). Background LED self powered.

Other pins: MOSI(19), MISO(21), SCLK(23), TFT DC(15), TFT CS(24), Reset(13). The only difference that I see is the TFT DC pin. For me that works out to TFT DC(Pin 15/GPIO 22), While Adafruit is using TFT DC(Pin 22/GPIO 25).

Looks like Adafruit is letting the display board manage the RESET. My Reset(13) is run straight to 3.3v. I have run it to a pin on the Teensy with no change in performance.
 
Last edited:
Well let that be a lesson to everyone. I just discovered that three of my brand new jumper leads were open! I tested all leads for opens and replaced as required....

Some of these jumpers have a thin plastic coating over the pin. You can scratch if off with your finger nails. Whenever I use new ones, I do that or I twist it while inserting it several times into my breadboard.
 
Did you get this working?


I have the same issues. My screen lights up but thats all there is.

I have the exact same output you have
 
Did you get this working?


I have the same issues. My screen lights up but thats all there is.

I have the exact same output you have
Might help if there was some additional information.

Like Which display you are using. How exactly it is hooked up... Pictures showing this can help a lot.
What other hardware...

T3.6? Which version of Arduino/Teensyduino?

What Library are you using...

Also what software you are trying to use. Again example program showing your settings and which libraries you are using,
and the startup sequence...
 
Might help if there was some additional information.

Like Which display you are using. How exactly it is hooked up... Pictures showing this can help a lot.
What other hardware...

T3.6? Which version of Arduino/Teensyduino?

What Library are you using...

Also what software you are trying to use. Again example program showing your settings and which libraries you are using,
and the startup sequence...


I am unable to upload images so I have described the connections, code and result to the best of my knowledge.

Here are my connections:
Adfruit 2.4" TFT breakout board ILI9341 Teensy 3.6
VIN 3v3
GND GND
CS 10
D/C 9

My code: graphicstest (ILI9341_t3)
Code:
/***************************************************
  This is our GFX example for the Adafruit ILI9341 Breakout and Shield
  ----> http://www.adafruit.com/products/1651

  Check out the links above for our tutorials and wiring diagrams
  These displays use SPI to communicate, 4 or 5 pins are required to
  interface (RST is optional)
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 ****************************************************/


#include "SPI.h"
#include "ILI9341_t3.h"

// For the Adafruit shield, these are the default.
#define TFT_DC  9
#define TFT_CS 10

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);

void setup() {
  tft.begin();
  tft.fillScreen(ILI9341_BLACK);
  tft.setTextColor(ILI9341_YELLOW);
  tft.setTextSize(2);
  tft.println("Waiting for Arduino Serial Monitor...");

  Serial.begin(9600);
  while (!Serial) ; // wait for Arduino Serial Monitor
  Serial.println("ILI9341 Test!"); 

  // read diagnostics (optional but can help debug problems)
  uint8_t x = tft.readcommand8(ILI9341_RDMODE);
  Serial.print("Display Power Mode: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDMADCTL);
  Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDPIXFMT);
  Serial.print("Pixel Format: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDIMGFMT);
  Serial.print("Image Format: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDSELFDIAG);
  Serial.print("Self Diagnostic: 0x"); Serial.println(x, HEX); 
  
  Serial.println(F("Benchmark                Time (microseconds)"));

  Serial.print(F("Screen fill              "));
  Serial.println(testFillScreen());
  delay(200);

  Serial.print(F("Text                     "));
  Serial.println(testText());
  delay(600);

  Serial.print(F("Lines                    "));
  Serial.println(testLines(ILI9341_CYAN));
  delay(200);

  Serial.print(F("Horiz/Vert Lines         "));
  Serial.println(testFastLines(ILI9341_RED, ILI9341_BLUE));
  delay(200);

  Serial.print(F("Rectangles (outline)     "));
  Serial.println(testRects(ILI9341_GREEN));
  delay(200);

  Serial.print(F("Rectangles (filled)      "));
  Serial.println(testFilledRects(ILI9341_YELLOW, ILI9341_MAGENTA));
  delay(200);

  Serial.print(F("Circles (filled)         "));
  Serial.println(testFilledCircles(10, ILI9341_MAGENTA));

  Serial.print(F("Circles (outline)        "));
  Serial.println(testCircles(10, ILI9341_WHITE));
  delay(200);

  Serial.print(F("Triangles (outline)      "));
  Serial.println(testTriangles());
  delay(200);

  Serial.print(F("Triangles (filled)       "));
  Serial.println(testFilledTriangles());
  delay(200);

  Serial.print(F("Rounded rects (outline)  "));
  Serial.println(testRoundRects());
  delay(200);

  Serial.print(F("Rounded rects (filled)   "));
  Serial.println(testFilledRoundRects());
  delay(200);

  Serial.println(F("Done!"));

}


void loop(void) {
  for(uint8_t rotation=0; rotation<4; rotation++) {
    tft.setRotation(rotation);
    testText();
    delay(1000);
  }
}

unsigned long testFillScreen() {
  unsigned long start = micros();
  tft.fillScreen(ILI9341_BLACK);
  tft.fillScreen(ILI9341_RED);
  tft.fillScreen(ILI9341_GREEN);
  tft.fillScreen(ILI9341_BLUE);
  tft.fillScreen(ILI9341_BLACK);
  return micros() - start;
}

unsigned long testText() {
  tft.fillScreen(ILI9341_BLACK);
  unsigned long start = micros();
  tft.setCursor(0, 0);
  tft.setTextColor(ILI9341_WHITE);  tft.setTextSize(1);
  tft.println("Hello World!");
  tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2);
  tft.println(1234.56);
  tft.setTextColor(ILI9341_RED);    tft.setTextSize(3);
  tft.println(0xDEADBEEF, HEX);
  tft.println();
  tft.setTextColor(ILI9341_GREEN);
  tft.setTextSize(5);
  tft.println("Groop");
  tft.setTextSize(2);
  tft.println("I implore thee,");
  tft.setTextSize(1);
  tft.println("my foonting turlingdromes.");
  tft.println("And hooptiously drangle me");
  tft.println("with crinkly bindlewurdles,");
  tft.println("Or I will rend thee");
  tft.println("in the gobberwarts");
  tft.println("with my blurglecruncheon,");
  tft.println("see if I don't!");
  return micros() - start;
}

unsigned long testLines(uint16_t color) {
  unsigned long start, t;
  int           x1, y1, x2, y2,
                w = tft.width(),
                h = tft.height();

  tft.fillScreen(ILI9341_BLACK);

  x1 = y1 = 0;
  y2    = h - 1;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = w - 1;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t     = micros() - start; // fillScreen doesn't count against timing

  tft.fillScreen(ILI9341_BLACK);

  x1    = w - 1;
  y1    = 0;
  y2    = h - 1;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = 0;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;

  tft.fillScreen(ILI9341_BLACK);

  x1    = 0;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = w - 1;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t    += micros() - start;

  tft.fillScreen(ILI9341_BLACK);

  x1    = w - 1;
  y1    = h - 1;
  y2    = 0;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2    = 0;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);

  return micros() - start;
}

unsigned long testFastLines(uint16_t color1, uint16_t color2) {
  unsigned long start;
  int           x, y, w = tft.width(), h = tft.height();

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(y=0; y<h; y+=5) tft.drawFastHLine(0, y, w, color1);
  for(x=0; x<w; x+=5) tft.drawFastVLine(x, 0, h, color2);

  return micros() - start;
}

unsigned long testRects(uint16_t color) {
  unsigned long start;
  int           n, i, i2,
                cx = tft.width()  / 2,
                cy = tft.height() / 2;

  tft.fillScreen(ILI9341_BLACK);
  n     = min(tft.width(), tft.height());
  start = micros();
  for(i=2; i<n; i+=6) {
    i2 = i / 2;
    tft.drawRect(cx-i2, cy-i2, i, i, color);
  }

  return micros() - start;
}

unsigned long testFilledRects(uint16_t color1, uint16_t color2) {
  unsigned long start, t = 0;
  int           n, i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  n = min(tft.width(), tft.height()) - 1;
  for(i=n; i>0; i-=6) {
    i2    = i / 2;
    start = micros();
    tft.fillRect(cx-i2, cy-i2, i, i, color1);
    t    += micros() - start;
    // Outlines are not included in timing results
    tft.drawRect(cx-i2, cy-i2, i, i, color2);
  }

  return t;
}

unsigned long testFilledCircles(uint8_t radius, uint16_t color) {
  unsigned long start;
  int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(x=radius; x<w; x+=r2) {
    for(y=radius; y<h; y+=r2) {
      tft.fillCircle(x, y, radius, color);
    }
  }

  return micros() - start;
}

unsigned long testCircles(uint8_t radius, uint16_t color) {
  unsigned long start;
  int           x, y, r2 = radius * 2,
                w = tft.width()  + radius,
                h = tft.height() + radius;

  // Screen is not cleared for this one -- this is
  // intentional and does not affect the reported time.
  start = micros();
  for(x=0; x<w; x+=r2) {
    for(y=0; y<h; y+=r2) {
      tft.drawCircle(x, y, radius, color);
    }
  }

  return micros() - start;
}

unsigned long testTriangles() {
  unsigned long start;
  int           n, i, cx = tft.width()  / 2 - 1,
                      cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  n     = min(cx, cy);
  start = micros();
  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));
  }

  return micros() - start;
}

unsigned long testFilledTriangles() {
  unsigned long start, t = 0;
  int           i, cx = tft.width()  / 2 - 1,
                   cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(i=min(cx,cy); i>10; i-=5) {
    start = micros();
    tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
      tft.color565(0, i, i));
    t += micros() - start;
    tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
      tft.color565(i, i, 0));
  }

  return t;
}

unsigned long testRoundRects() {
  unsigned long start;
  int           w, i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  w     = min(tft.width(), tft.height()) - 1;
  start = micros();
  for(i=0; i<w; i+=6) {
    i2 = i / 2;
    tft.drawRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(i, 0, 0));
  }

  return micros() - start;
}

unsigned long testFilledRoundRects() {
  unsigned long start;
  int           i, i2,
                cx = tft.width()  / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(i=min(tft.width(), tft.height()) - 1; i>20; i-=6) {
    i2 = i / 2;
    tft.fillRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(0, i, 0));
  }

  return micros() - start;
}


My output:
Code:
ILI9341 Test!
Display Power Mode: 0xFF
MADCTL Mode: 0xFF
Pixel Format: 0xFF
Image Format: 0xFF
Self Diagnostic: 0xFF
Benchmark                Time (microseconds)
Screen fill              934753
Text                     52103
Lines                    491277
Horiz/Vert Lines         77642
Rectangles (outline)     49629
Rectangles (filled)      1940775
Circles (filled)         286666
Circles (outline)        214885
Triangles (outline)      155777
Triangles (filled)       645894
Rounded rects (outline)  99129
Rounded rects (filled)   2124065
Done!

My display shows a lit up screen and nothing else. What should i do?
 
Double check wiring. I know this library works with T3.6 as I have boards that do it... I do not have one of these displays, I have a couple of their 2.8" touch screens as well as several PJRC displays.

Again pictures would help as there have been a few cases in the last few months where people had issues and it turned out that they had not soldered the pins into the T3.6 but were relying on friction fit which did not work.

I am assuming you are using one of these: https://www.adafruit.com/product/2478 ? Or was it an earlier one?
If so I assume you looked at their learn page for hookups? https://learn.adafruit.com/adafruit-2-4-color-tft-touchscreen-breakout/spi-wiring-and-test
In particular are the solder jumpers set properly for SPI mode?


I know that tcottle was half joking here, but again the assumption here is that: you also connected MISO, MOSI, and SCLK...
Also make sure that MISO/MOSI are not reversed.
 
Status
Not open for further replies.
Back
Top