ILI9341 colour display debugging

Status
Not open for further replies.

johnty

Member
I'm currently trying to get the color display to work. First, trying it on an arduino duemilanove, I manage to get the following via the serial console using the built in graphics test:

Code:
ILI9341 Test!
Display Power Mode: 0x9C
MADCTL Mode: 0x48
Pixel Format: 0x5
Image Format: 0x9C
Self Diagnostic: 0xC0
Benchmark                Time (microseconds)
Screen fill              2560992
Text                     291960
... etc

which seem to be expected values. however, the screen is completely white. as far as i can tell everything is working - if i remove any of the pins, the diagnostics don't return the proper values.

could i have damaged/fried parts of the screen? i'm running it on 3.3V. also tried it on 5, and the only difference is that the backlight is quite a bit brighter. i also noticed that it gets a bit hot near the ribbon cable.

i'll try it with the teensy soon, but have a feeling it shouldn't make any difference?

p.s. on the teensy side, i've been looking at processing real time audio. did some timing of the FFT code - totally impressed by the amount of power it has! :D
 
The ILI9341 is not 5V tolerant.

Well, the ones PJRC sells are not. Some more expensive ones like Adafruit's have 5 to 3V buffers, so allow them to wire directly to 5V Arduino Uno. Those ones are safe to connect to 5V signals.

Applying 5V signals to a cheaper ones, without the special buffers, could damage it.
 
I'm currently trying to get the color display to work. First, trying it on an arduino duemilanove, I manage to get the following via the serial console using the built in graphics test:

Code:
ILI9341 Test!
Display Power Mode: 0x9C
MADCTL Mode: 0x48
Pixel Format: 0x5
Image Format: 0x9C
Self Diagnostic: 0xC0
Benchmark                Time (microseconds)
Screen fill              2560992
Text                     291960
... etc

which seem to be expected values. however, the screen is completely white. as far as i can tell everything is working


I got a few of the graphics displays from PJRC and found that If I ran the demo 'graphicstest' with a Teensy 3.1 it worked fine but If I ran the exact same code with the sound card on it I got results similar to what you are describing. Since I had the luxury of a couple displays and T3's I could work through some of the permutations where I got good results and bad (white screen). I eventually commented out parts of the 'graphics test' in my setup and adding them back in. I did not take this to the logical conclusion to determine which call put the screen in white mode. but... I'll post the setup code I did get working for my T3 with soundcard. sounds like thats where your heading. I haven't had time to get back to working on this, I will have some time starting this weekend to determine which call causes the issue (I suspect it's in the commented code) if not a single call than some specific combination. But for now I was able to make progress so I stopped looking. Here's the setup I use for a T3 with Soundcard and the Graphics display (Using the instructions on the PJRC website

http://pjrc.com/store/display_ili9341.html


Here's the setup I use, hope this helps :

Code:
void setup() {
  
  // set the Time library to use Teensy 3.0's RTC to keep time
  setSyncProvider(getTeensy3Time);
  delay(100);

  //pinMode(8, OUTPUT);
  //digitalWrite(8, HIGH);
  SPI.setMOSI(7);
  SPI.setSCK(14);

  tft.begin();
  tft.fillScreen(ILI9341_BLACK);
  tft.setTextColor(ILI9341_YELLOW);
  tft.setTextSize(2);
  tft.setRotation(3);  

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

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

  if (timeStatus()!= timeSet) {
    Serial.println("Unable to sync with the RTC");
    tft.println("Unable to sync with the RTC");
  } else {
    Serial.println("RTC has set the system time");
    tft.println("RTC has set the system time");
  }
  
// print RTC time  
  digitalClockDisplay();


  // 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)"));
  tft.println(F("Benchmark Time (microseconds)"));
  delay(2000);

  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.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!"));
  tft.print("Done!");
  delay(200);
  tft.setRotation(3);  
  tft.fillScreen(ILI9341_BLACK);
    // Audio connections require memory to work.  For more
  // detailed information, see the MemoryAndCpuUsage example
  AudioMemory(5);

  sgtl5000_1.enable();
  sgtl5000_1.volume(0.5);

  SPI.setMOSI(7);
  SPI.setSCK(14);
  if (!(SD.begin(10))) {
    // stop here, but print a message repetitively
    while (1) {
      Serial.println("Unable to access the SD card");
      delay(500);
    }
  }
  frameText();
//  testText();

}
int stepTime = 0;
void playFile(const char *filename)
{
  Serial.print("Playing file: ");
  Serial.println(filename);

  // Start playing the file.  This sketch continues to
  // run while the file plays.
  playWav1.play(filename);

  // A brief delay for the library read WAV info
  delay(5);

  // Simply wait for the file to finish playing.
  while (playWav1.isPlaying()) {
    // uncomment these lines if you audio shield
    // has the optional volume pot soldered
    float vol = analogRead(15);
    vol = vol / 1024;
    sgtl5000_1.volume(vol);
    if( stepTime +1000 < millis()) {
      stepTime = millis();
      printTime();
    }
  }
}
 
Great. Thanks Paul and fretless_kb for your replies. Much appreciated! Will experiment some more tonight, and fingered crossed about the board being fried :)

At least I know some part of the circuit is working based on the returned values being polled...

*edit* forgot to mention, Paul, if this LCD is 3.3V only, you might want to update the product page under "Notes" for the VCC as it currently says 3.6 to 5.5v supply for the board... (unless I'm misinterpreting the data).
 
Last edited:
Great. Thanks Paul! I realize now that the power supply can still be up to 5.5V; its the input pins that aren't 5V tolerant... :)

Just got it hooked up with the Teensy and luckily, I didn't seem to do any permanent damage. Everything working fine now using the generic graphicstest example.

Thanks again!
 
Status
Not open for further replies.
Back
Top