mcufriend 2.8 inch TFT LCD display issues

Hello, everyone,

I have recently bought a couple of LCD TFT touchscreen shields from ebay:
2-8-Inch-TFT-LCD-Display-Touch-Screen-Module-with-SD-Solt-for-Arduino-UNO-TOP

This seemed to be a good choice (not too expensive) for a guy with no previous experience with lcd displays.

However (suprise?..), it seems that I can't get it work properly. Before posting here, I did some research and tried a few different libraries.

My setup

Hardware:


Software:

Unfortunately, all of them didn't work as expected. The majority of them showed white screen:

st7783 library seemed to at least be doing something:

After using an example "st7783->Mygraphicstest", the screen changed from white to "striped" (periodic display of white and dark lines), which seemed to be refreshing (perhaps responding to the commands from the example sketch). To confirm this, I removed all the commands in loop and setup, except from "tft.fillScreen(BLUE)". After this, at first the screen turned white, refreshed (blinked) and turned striped (and stayed that way, no more refreshing). Changing the filling color did absolutely nothing (at least visible to me), so even though the program is trying to do something, the lcd display chip doesn't interpret it right (?).

So I thought maybe you guys have any ideas what could be causing this (because from the posts I've read before, many people are using similar displays). Following the steps from other posts, I couldn't get it working (and never saw a problem like I have).

I'm trying to read the st7783 chip manual (believing the seller's website), but it's a lot of info to grasp for a beginner with LCDs. So maybe you could point me in a right direction (or maybe provide a solution?).

I believe the pinning is correct as I'm using a shield.

So...

  • Timing issues between arduino and lcd chip? How to solve it if that's the case? Or how to debug it?
  • Incorrect initialization of the lcd chip? How to check it?
  • Incorrect commands being sent (every second line filled, creating a striped pattern)?
  • Maybe the pins are actually incorrect, even though it's a shield?
  • Defective lcd? Tried both of them, but none works as expected
  • More ideas?

I believe you people have more experience with this kind of stuff and could help me (and possibly others with similar issues).

The code with which I get a non-refreshing striped screen (using st7783 library):

#define LCD_CS A3    
#define LCD_CD A2    
#define LCD_WR A1   
#define LCD_RD A0    
// you can also just connect RESET to the arduino RESET pin
#define LCD_RESET A4
//Duemilanove/Diecimila/UNO/etc ('168 and '328 chips) microcontoller:
// Color definitions
#define BLACK           0x0000
#define BLUE            0x001F
#define RED             0xF800
#define GREEN           0x07E0
#define CYAN            0x07FF
#define MAGENTA         0xF81F
#define YELLOW          0xFFE0 
#define WHITE           0xFFFF

#include "TFTLCD.h"

TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

void setup(void) {
  Serial.begin(9600);
  Serial.println("8 Bit LCD test!");

  uint16_t identifier = tft.readRegister(0x00);
  Serial.print("ID=");
  Serial.println(identifier, HEX);

  Serial.println("tft.initDisplay");
  tft.reset();
  delay(100); // ???
  tft.initDisplay();
  
  Serial.println("fillscreen");
  tft.fillScreen(BLUE);

}

void loop(void) {

}

The result displayed on serial port:

8 Bit LCD test!
ID=0
tft.initDisplay
fillscreen

I'm sorry if this seems an easy task for you guys (or maybe I've made an obvious mistake), but pardon the beginner his mistakes!

Thank you for your time!

UPDATE ON: 2015-01-20

Wasn't really able to catch up with these posts (exams, work and stuff), but this post got my tft working:

http://forum.arduino.cc/index.php?topic=292777.0

Not much time to go this through right now, but will surely find out what was missing in my code :slight_smile:
Thank you!

Hello,

I have the same board and tried several libraries with no success. The Smoke and Wires mod library worked for me, see the post at http://www.smokeandwires.co.nz/blog/a-2-4-tft-touchscreen-shield-for-arduino/ for download links.

I've been trying to get this board working also.

I have tried the smokeandwires library and it makes the screen flicker but nothing else.

I have also tried to bit bash the ID register but can't get a sensible values out of it.

Anyone got any ideas or get any further?

Thanks

Just got it working :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile:

I downloaded the adafruit LCD driver (GitHub - adafruit/TFTLCD-Library: Arduino library for 8-bit TFT LCDs such as ILI9325, ILI9328, etc) and graphics lib. Once installed I selected the graphicstest file from the examples. the only thing I the changed was to force it be a ILI9341 as follows:

  if(identifier == 0x9325) {
    Serial.println(F("Found ILI9325 LCD driver"));
  } else if(identifier == 0x9328) {
    Serial.println(F("Found ILI9328 LCD driver"));
  } else if(identifier == 0x7575) {
    Serial.println(F("Found HX8347G LCD driver"));
  } else if(identifier == 0x9341) {
    Serial.println(F("Found ILI9341 LCD driver"));
  } else if(identifier == 0x8357) {
    Serial.println(F("Found HX8357D LCD driver"));
  } else {
    Serial.print(F("Unknown LCD driver chip: "));
    Serial.println(identifier, HEX);
    identifier = 0x9341;
  }

NOTE: I also keep the #define USE_ADAFRUIT_SHIELD_PINOUT 1 commented out.

The SD card reader also works (adafruit libraries).

However, the touch screen (adafruit libraries) is a bit poor at the moment it works if you change the pin allocations to:

// These are the pins for the shield!
#define YP A1  // must be an analog pin, use "An" notation!
#define XM A2  // must be an analog pin, use "An" notation!
#define YM 7   // can be a digital pin
#define XP 6   // can be a digital pin

Quick update - I have got the paint program to work completely now with the pin allocations above (albeit you do have to use a bit of force).

I did have to invert the coordinates for the X and Y on the touch points.

I'm not sure if the screen is flipped in either axis but this worked OK.

Hi shadersrjj,

Could you please post your code?

I've just spent a couple of days trying to get (what looks like exactly the same screen) working with no, zero, success :angry:

I even sat down and wrote an entire interface from the data sheet (which based on your info, is the wrong one :frowning: st7781), just to try and figure out what was happening. As so many of the libraries available are completely unfathomable, if you're new to this, as I am. :confused:

It would be great, to definitely workout if it just been the wrong libs the wrong way, or if the shield/display is actually DOA (which I completely believed it was until I read your post).

Thanks in advance.

PS. Just tried following your instructions, without any joy. Looking at the flex connector, it doesn't seem well attached to the board, so I think I'll go over it with the soldering iron and hopefully...

I'm really starting to think, saving $10 on this display, was definitely not worth the complete hassle. Has anyone tried to get any info from the manufacturer? Their site is completely broken, none of the downloads work and neither they or the people that sold it to me are answering emails. Definitely false economy :frowning:

Cheers
Luke

I did have the same opinion that the screen didn't work. Unfortunately, I have my uno wired up to a 8x8 LED matrix at the moment and I can't check that the library I have here definitely work.

To get mine working all I did (eventually) was to download the ADAFruit libraries and loaded the graphicstest example. I then made the changes specified to force it to one of the controllers in the list.

Maybe you can post what you have and I'll check.

Did you try the touch screen or SDI stuff without the display on. The SDI worked first time and the touch screen worked using the mods to the pins and the ADAFruit library (before I got the screen to work).

BTW Unless you know what you are doing Don't go near the flexi with soldering iron.

shadersrjj:
Just got it working :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile:

I downloaded the adafruit LCD driver (GitHub - adafruit/TFTLCD-Library: Arduino library for 8-bit TFT LCDs such as ILI9325, ILI9328, etc) and graphics lib. Once installed I selected the graphicstest file from the examples. the only thing I the changed was to force it be a ILI9341 as follows:

  if(identifier == 0x9325) {

Serial.println(F("Found ILI9325 LCD driver"));
  } else if(identifier == 0x9328) {
    Serial.println(F("Found ILI9328 LCD driver"));
  } else if(identifier == 0x7575) {
    Serial.println(F("Found HX8347G LCD driver"));
  } else if(identifier == 0x9341) {
    Serial.println(F("Found ILI9341 LCD driver"));
  } else if(identifier == 0x8357) {
    Serial.println(F("Found HX8357D LCD driver"));
  } else {
    Serial.print(F("Unknown LCD driver chip: "));
    Serial.println(identifier, HEX);
    identifier = 0x9341;
  }




**NOTE: I also keep the #define USE_ADAFRUIT_SHIELD_PINOUT 1 commented out.**

Thanks a lot for this, it helped me get it up and running.

One problem I have is using this with my Mega. It works fine on my Uno, but my Mega prints the following:

Using Adafruit 2.8" TFT Breakout Board Pinout
Unknown LCD driver chip: 0

while my Uno prints:

Using Adafruit 2.8" TFT Breakout Board Pinout
Unknown LCD driver chip: 8080

the pin numbers are the same on the mega, any idea why this is happening?

I don't know much about the mega but when I was trying different libraries they did seem to have different pin assignments so it may be worth a check against the schematics and where the shield connects.

I did write a program to "bit bash" the id register out assuming it was loctaed at 00h. However, I normally got C0C0h or 0000h. Looking at the datasheet for the ILI9341 the ID register appears to be at 04h or D3h so I may go back to see I can read it now. However, it is worth bearing in mind that the driver might just be a cheap clone.

I have managed to confirm the ID of the LCD driver for my Ebay, mcufriend.com touch screen. This was found by reading it from D3h and it confirmed this was an ILI9341 ICD driver chip. I have some code that bit bashes it out on an UNO board and displays it serially. I make no guarantee for it so only use it under your own risk but it may help try to find and read the ID of your board (e.g. your can change to specific register to read).

BTW it looks complicated but actually is just driving ports high and low one command at a time so you should be able to create a timing diagram for what's going on pretty quickly (which is the main reason I write this kind of code like this)

//
// ILI9341 ID Checker against data sheet http://www.adafruit.com/datasheets/ILI9341.pdf
// Ugly bit basher - R Jennings 11/11/14 (http://www.shaders.co.uk)
//
 #define CS A3   // Chip Select goes to Analog 3
 #define CD A2   // Command/Data goes to Analog 2
 #define WR A1   // LCD Write goes to Analog 1
 #define RD A0   // LCD Read goes to Analog 0
 #define RST A4  // Can alternately just connect to Arduino's reset pin
 #define D0 8    // DO
 #define D1 9    // D1
 #define D2 2    // D2
 #define D3 3    // D3
 #define D4 4    // D4
 #define D5 5    // D5
 #define D6 6    // D6
 #define D7 7    // D7

void setup(void) {
// Set up port directions and default states
  pinMode(CS, OUTPUT);  pinMode(CD, OUTPUT);  pinMode(WR, OUTPUT);  pinMode(RD, OUTPUT);  pinMode(RST, OUTPUT);
  digitalWrite(CS, 1); digitalWrite(CD, 1); digitalWrite(WR, 1); digitalWrite(RD, 1); digitalWrite(RST, 1);
  pinMode(D0, OUTPUT); pinMode(D1, OUTPUT); pinMode(D2, OUTPUT); pinMode(D3, OUTPUT);
  pinMode(D4, OUTPUT); pinMode(D5, OUTPUT); pinMode(D6, OUTPUT); pinMode(D7, OUTPUT);

// This just drivers the serial monitor no screen activity  
  Serial.begin(9600);
  Serial.println("TFT LCD test - Read of the ID register");
//HW Reset
  digitalWrite(RST,0); delay(5);
  digitalWrite(RST,1); delay(500);  
// Read the ID Register, D3h
// Start by writing to the command register with the register to read
  digitalWrite(CD, 0); 
  digitalWrite(CS, 0);
  digitalWrite(D0, 1); digitalWrite(D1, 1); digitalWrite(D2, 0); digitalWrite(D3, 0);  // 3 - Change for lower nibble as required 
  digitalWrite(D4, 1); digitalWrite(D5, 0); digitalWrite(D6, 1); digitalWrite(D7, 1);  // D - Change for upper nibble as required
  digitalWrite(WR, 0); digitalWrite(WR, 1);
  digitalWrite(CS, 1);    
// Switch to reading   
  pinMode(D0, INPUT);    pinMode(D1, INPUT);    pinMode(D2, INPUT);    pinMode(D3, INPUT);
  pinMode(D4, INPUT);    pinMode(D5, INPUT);    pinMode(D6, INPUT);    pinMode(D7, INPUT);
  int x=0;
// Then read the four bytes and print to the serial port
// See section 8.3.23 page 233 for read sequence
// 1st Parameter - Dummy byte could be anything
  digitalWrite(CD, 1); 
  digitalWrite(CS, 0); 
  digitalWrite(RD, 0); 
  x=0;
  digitalWrite(RD, 0); 
  x|=digitalRead(D0);    x|=digitalRead(D1)<<1; x|=digitalRead(D2)<<2; x|=digitalRead(D3)<<3;
  x|=digitalRead(D4)<<4; x|=digitalRead(D5)<<5; x|=digitalRead(D6)<<6; x|=digitalRead(D7)<<7;
  Serial.print("Dummny Byte Read =        "); Serial.println(x, HEX);   
  digitalWrite(RD, 1); 
 // 2nd Parameter should be 00h
  x=0;
  digitalWrite(RD, 0); 
  x|=digitalRead(D0);    x|=digitalRead(D1)<<1; x|=digitalRead(D2)<<2; x|=digitalRead(D3)<<3;
  x|=digitalRead(D4)<<4; x|=digitalRead(D5)<<5; x|=digitalRead(D6)<<6; x|=digitalRead(D7)<<7;
  Serial.print("2nd Parameter Byte Read = "); Serial.println(x, HEX);   
  digitalWrite(RD, 1); 
 // 3rd Parameter should be 93h    
  x=0;
  digitalWrite(RD, 0); 
  x|=digitalRead(D0);    x|=digitalRead(D1)<<1;  x|=digitalRead(D2)<<2; x|=digitalRead(D3)<<3;
  x|=digitalRead(D4)<<4; x|=digitalRead(D5)<<5;  x|=digitalRead(D6)<<6; x|=digitalRead(D7)<<7;
  Serial.print("3rd Parameter Byte Read = "); Serial.println(x, HEX);   
  digitalWrite(RD, 1); 
 // 4th Parameter should be 41h     
  x=0;
  digitalWrite(RD, 0); 
  x|=digitalRead(D0);    x|=digitalRead(D1)<<1; x|=digitalRead(D2)<<2; x|=digitalRead(D3)<<3;
  x|=digitalRead(D4)<<4; x|=digitalRead(D5)<<5; x|=digitalRead(D6)<<6; x|=digitalRead(D7)<<7;
  Serial.print("4th Parameter Byte Read = "); Serial.println(x, HEX);   
  digitalWrite(RD, 1);  
}
//Nothing to do here
void loop(void) {
}

shadersrjj:
I have managed to confirm the ID of the LCD driver for my Ebay, mcufriend.com touch screen. This was found by reading it from D3h and it confirmed this was an ILI9341 ICD driver chip. I have some code that bit bashes it out on an UNO board and displays it serially. I make no guarantee for it so only use it under your own risk but it may help try to find and read the ID of your board (e.g. your can change to specific register to read).

BTW it looks complicated but actually is just driving ports high and low one command at a time so you should be able to create a timing diagram for what's going on pretty quickly (which is the main reason I write this kind of code like this)

//

// ILI9341 ID Checker against data sheet http://www.adafruit.com/datasheets/ILI9341.pdf
// Ugly bit basher - R Jennings 11/11/14 (http://www.shaders.co.uk)
//
#define CS A3  // Chip Select goes to Analog 3
#define CD A2  // Command/Data goes to Analog 2
#define WR A1  // LCD Write goes to Analog 1
#define RD A0  // LCD Read goes to Analog 0
#define RST A4  // Can alternately just connect to Arduino's reset pin
#define D0 8    // DO
#define D1 9    // D1
#define D2 2    // D2
#define D3 3    // D3
#define D4 4    // D4
#define D5 5    // D5
#define D6 6    // D6
#define D7 7    // D7

void setup(void) {
// Set up port directions and default states
  pinMode(CS, OUTPUT);  pinMode(CD, OUTPUT);  pinMode(WR, OUTPUT);  pinMode(RD, OUTPUT);  pinMode(RST, OUTPUT);
  digitalWrite(CS, 1); digitalWrite(CD, 1); digitalWrite(WR, 1); digitalWrite(RD, 1); digitalWrite(RST, 1);
  pinMode(D0, OUTPUT); pinMode(D1, OUTPUT); pinMode(D2, OUTPUT); pinMode(D3, OUTPUT);
  pinMode(D4, OUTPUT); pinMode(D5, OUTPUT); pinMode(D6, OUTPUT); pinMode(D7, OUTPUT);

// This just drivers the serial monitor no screen activity 
  Serial.begin(9600);
  Serial.println("TFT LCD test - Read of the ID register");
//HW Reset
  digitalWrite(RST,0); delay(5);
  digitalWrite(RST,1); delay(500); 
// Read the ID Register, D3h
// Start by writing to the command register with the register to read
  digitalWrite(CD, 0);
  digitalWrite(CS, 0);
  digitalWrite(D0, 1); digitalWrite(D1, 1); digitalWrite(D2, 0); digitalWrite(D3, 0);  // 3 - Change for lower nibble as required
  digitalWrite(D4, 1); digitalWrite(D5, 0); digitalWrite(D6, 1); digitalWrite(D7, 1);  // D - Change for upper nibble as required
  digitalWrite(WR, 0); digitalWrite(WR, 1);
  digitalWrite(CS, 1);   
// Switch to reading 
  pinMode(D0, INPUT);    pinMode(D1, INPUT);    pinMode(D2, INPUT);    pinMode(D3, INPUT);
  pinMode(D4, INPUT);    pinMode(D5, INPUT);    pinMode(D6, INPUT);    pinMode(D7, INPUT);
  int x=0;
// Then read the four bytes and print to the serial port
// See section 8.3.23 page 233 for read sequence
// 1st Parameter - Dummy byte could be anything
  digitalWrite(CD, 1);
  digitalWrite(CS, 0);
  digitalWrite(RD, 0);
  x=0;
  digitalWrite(RD, 0);
  x|=digitalRead(D0);    x|=digitalRead(D1)<<1; x|=digitalRead(D2)<<2; x|=digitalRead(D3)<<3;
  x|=digitalRead(D4)<<4; x|=digitalRead(D5)<<5; x|=digitalRead(D6)<<6; x|=digitalRead(D7)<<7;
  Serial.print("Dummny Byte Read =        "); Serial.println(x, HEX); 
  digitalWrite(RD, 1);
// 2nd Parameter should be 00h
  x=0;
  digitalWrite(RD, 0);
  x|=digitalRead(D0);    x|=digitalRead(D1)<<1; x|=digitalRead(D2)<<2; x|=digitalRead(D3)<<3;
  x|=digitalRead(D4)<<4; x|=digitalRead(D5)<<5; x|=digitalRead(D6)<<6; x|=digitalRead(D7)<<7;
  Serial.print("2nd Parameter Byte Read = "); Serial.println(x, HEX); 
  digitalWrite(RD, 1);
// 3rd Parameter should be 93h   
  x=0;
  digitalWrite(RD, 0);
  x|=digitalRead(D0);    x|=digitalRead(D1)<<1;  x|=digitalRead(D2)<<2; x|=digitalRead(D3)<<3;
  x|=digitalRead(D4)<<4; x|=digitalRead(D5)<<5;  x|=digitalRead(D6)<<6; x|=digitalRead(D7)<<7;
  Serial.print("3rd Parameter Byte Read = "); Serial.println(x, HEX); 
  digitalWrite(RD, 1);
// 4th Parameter should be 41h   
  x=0;
  digitalWrite(RD, 0);
  x|=digitalRead(D0);    x|=digitalRead(D1)<<1; x|=digitalRead(D2)<<2; x|=digitalRead(D3)<<3;
  x|=digitalRead(D4)<<4; x|=digitalRead(D5)<<5; x|=digitalRead(D6)<<6; x|=digitalRead(D7)<<7;
  Serial.print("4th Parameter Byte Read = "); Serial.println(x, HEX); 
  digitalWrite(RD, 1); 
}
//Nothing to do here
void loop(void) {
}

The mega seems to be the same as the Uno in that respect.

The only reason i want to use the mega is that i'd like to add some sensors to the board, and read some data, sch as temperature etc, and display it on the board.

The mega seems to be the same as the Uno in that respect.

So the mega reports an ILI9341 LCD driver but still doesn't work with the Adafruit library?

Hi guys,

I have the same display 2.8 from MCUfriend. I got it from DX.COM, also inserted in Mega, but without result. Still have a blank screen.
Based on previous informations here, it was done by Uno (also Duemilanove ?).
Please, give your used libraries (or links) to github.

Thanks for all your posts.

Probably you find the answer in this post:

http://forum.arduino.cc/index.php?topic=292777.0

Thanks for your help. Finally, everything running good.

Hello guys, I have tried several things posted here. I have this lcd and when I run graphictest in my Arduino Uno R3, I see this in Serial Interface:

Unknown LCD driver chip: 154

Do you know what chip should I be using?

Thanks in advance,

http://forum.arduino.cc/index.php?board=7.0

This works for me.

pacosta:
Hello guys, I have tried several things posted here. I have this lcd and when I run graphictest in my Arduino Uno R3, I see this in Serial Interface:

Unknown LCD driver chip: 154

Do you know what chip should I be using?

Thanks in advance,

Having the same issue with a 2.4tft from mcufriend. Getting the result that the Chip ID is 0x0154. Tried several libraries so far, but nothing worked. Does any one have the same issue and found a library to get this Display work?

I have been investigated and i think that the TFT display use a S6D0154 controller.
Do you have the driver for Arduino?
See this item:

http://www.ebay.es/itm/TFT-LCD-SHIELD-2-4-ARDUINO-UNO-CONTROLADOR-S6D0154-CALIDAD-100/161570502961?_trksid=p2047675.c100012.m1985&_trkparms=aid%3D444000%26algo%3DSOI.DEFAULT%26ao%3D1%26asc%3D20140402094601%26meid%3D943a1d260453444eb793c48d4565cc6b%26pid%3D100012%26rk%3D8%26rkt%3D9%26sd%3D161503138880