2.4" TFT touch display partially works

I bought the attached TFT touch display and I cannot find a library that will make it work fully. I tried 4 different libraries but the best I can do is get the display to work but not the touch screen nor the SD card.

I asked the seller where to find the correct arduino libraries but he didn't know what a library was.

Does anyone know where the appropriate library is?

Here is the device I bought.

Your link shows a readable photo.

I can read mcufriend.com (ili9340) on one photo and (ili9335) on another photo.

Install/Upgrade MCUFRIEND_kbv library from the Library Manager.

It supports ILI9340 and ILI9335. As well as about 30 other controllers.
There is a "diagnose_TFT" sketch.

David.

Thanks David. I'm making progress. The mcufriend library works well with graphics.

I had to load the adafruit touchscreen library to get the touchscreen to work.
The remaining problem is the SD card. Any recommendations on how to get that working?

Again, Thanks for the help.

This TFT Display is now fully functional.
I loaded the Arduino Library and set the chip select pin to 10 for my UNO and the SD card is now working.

Hooray!

Hello Everyone!!
I am using 2.4" lcd Touch screen display (www.mcufriend.com) and arduino mega 2560.i Installed tft_5408-master library and run the graphictest.kbv .display the hex code(ID=0x2FE3) only remain code should not be run And also run LCD_ID_readreg my output is:

Read Registers on MCUFRIEND UNO shield
controllers either read as single 16-bit
e.g. the ID is at readReg(0)
or as a sequence of 8-bit values
in special locations (first is dummy)

reg(0x0000) 00 00 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) 00 00 61 00 00 Status Register
reg(0x0061) 00 00 RDID1 HX8347-G
reg(0x0062) 00 00 RDID2 HX8347-G
reg(0x0063) 00 00 RDID3 HX8347-G
reg(0x0064) 00 00 RDID1 HX8347-A
reg(0x0065) 00 00 RDID2 HX8347-A
reg(0x0066) 00 00 RDID3 HX8347-A
reg(0x0067) 00 00 RDID Himax HX8347-A
reg(0x0070) 00 00 Panel Himax HX8347-A
reg(0x00A1) 00 00 00 00 00 RD_DDB SSD1963
reg(0x00B0) 00 40 RGB Interface Signal Control
reg(0x00B4) 00 40 Inversion Control
reg(0x00B6) 00 02 1E 1E 1E Display Control
reg(0x00B7) 00 06 Entry Mode Set
reg(0x00BF) 00 02 02 02 02 02 ILI9481, HX8357-B
reg(0x00C0) 00 15 11 11 11 11 Panel Control
reg(0x00CC) 00 04 Panel Control
reg(0x00D0) 00 00 00 Power Control
reg(0x00D2) 00 00 00 03 03 NVM Read
reg(0x00D3) 00 00 93 40 ILI9341, ILI9488
reg(0x00DA) 00 E3 RDID1
reg(0x00DB) 00 00 RDID2
reg(0x00DC) 00 00 RDID3
reg(0x00EF) 00 00 00 00 00 00 ILI9327
reg(0x00F2) 00 00 00 00 00 00 00 00 00 00 00 00 Adjust Control 2
reg(0x00F6) 00 00 00 00 Interface Control

my display only in white colour.please any one found my error and help me

Install MCUFRIEND_kbv and Adafruit_GFX via the IDE Library Manager

You have an ILI9340 screen. It should be supported by default (since April 2017).

If you have a problem please quote example sketch and library version numbers.

David.

david_prentice:
Install MCUFRIEND_kbv and Adafruit_GFX via the IDE Library Manager

You have an ILI9340 screen. It should be supported by default (since April 2017).

If you have a problem please quote example sketch and library version numbers.

David.

Thank you for the Reply David

I am using Adafuit_ILI9341 and also try MCUFRIEND_kbv-2.9.8 library.run the example graphicstest remain white screen came .

Please post a link to the actual display that you have bought. e.g. Ebay sale

A Shield plugs into a Uno or Mega. All the Shield male pins should mate with corresponding female sockets.

Your "LCD_ID_readreg" report implies that you have a Parallel shield.
Adafruit_ILI9341 is for SPI displays.

There are several diagnostic examples. Please copy-paste from the Serial Terminal.

David.

Thank you for your Reply!!

I am uisng Arduino Mega 2560.

I mention my code is Below and my output also show. please help me find out the solution..

This is my grapghicstest.ino:

#include <Adafruit_GFX.h> // Core graphics library
#include "SWTFT.h" // Hardware-specific library

// #define LCD_CS A3 // Chip Select goes to Analog 3
// #define LCD_CD A2 // Command/Data goes to Analog 2
// #define LCD_WR A1 // LCD Write goes to Analog 1
// #define LCD_RD A0 // LCD Read goes to Analog 0

// #define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin

// When using the BREAKOUT BOARD only, use these 8 data lines to the LCD:
// For the Arduino Uno, Duemilanove, Diecimila, etc.:
// D0 connects to digital pin 8 (Notice these are
// D1 connects to digital pin 9 NOT in order!)
// D2 connects to digital pin 2
// D3 connects to digital pin 3
// D4 connects to digital pin 4
// D5 connects to digital pin 5
// D6 connects to digital pin 6
// D7 connects to digital pin 7
// For the Arduino Mega, use digital pins 22 through 29
// (on the 2-row header at the end of the board).

// Assign human-readable names to some common 16-bit color values:
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF

SWTFT tft;
// If using the shield, all control and data lines are fixed, and
// a simpler declaration can optionally be used:
// SWTFT tft;

void setup(void) {
Serial.begin(9600);
Serial.println(F("TFT LCD test"));

tft.reset();

uint16_t identifier = tft.readID();

Serial.print(F("LCD driver chip: "));
Serial.println(identifier, HEX);

tft.begin(0x9325);

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

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

unsigned long testFillScreen() {
unsigned long start = micros();
tft.fillScreen(BLACK);
tft.fillScreen(RED);
tft.fillScreen(GREEN);
tft.fillScreen(BLUE);
tft.fillScreen(BLACK);
return micros() - start;
}

unsigned long testText() {
tft.fillScreen(BLACK);
unsigned long start = micros();
tft.setCursor(0, 0);
tft.setTextColor(WHITE); tft.setTextSize(1);
tft.println("Hello World!");
tft.setTextColor(YELLOW); tft.setTextSize(2);
tft.println(1234.56);
tft.setTextColor(RED); tft.setTextSize(3);
tft.println(0xDEADBEEF, HEX);
tft.println();
tft.setTextColor(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(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(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(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(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(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(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(BLACK);
n = min(tft.width(), tft.height());
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(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(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(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(BLACK);
w = min(tft.width(), tft.height());
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(BLACK);
start = micros();
for(i=min(tft.width(), tft.height()); 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;
}

This is Serial Terminal Output:

TFT LCD test
LCD driver chip: C0C0
Done!

This my LCD Screen:

Now My lcd display with lot of Noise only colour dot is running

I am using mcufriend 2.4 inch display

david_prentice:
Install MCUFRIEND_kbv and Adafruit_GFX via the IDE Library Manager

You have an ILI9340 screen. It should be supported by default (since April 2017).

If you have a problem please quote example sketch and library version numbers.

David.

david_prentice:
Please post a link to the actual display that you have bought. e.g. Ebay sale

A Shield plugs into a Uno or Mega. All the Shield male pins should mate with corresponding female sockets.

Your "LCD_ID_readreg" report implies that you have a Parallel shield.
Adafruit_ILI9341 is for SPI displays.

There are several diagnostic examples. Please copy-paste from the Serial Terminal.

David.

I am the author of MCUFRIEND_kbv library.
There are several examples from MCUFRIEND_kbv
Please run these examples.

There is no point in running tft_5408-master library or SWTFT library or any other library until I see the output from MCUFRIEND_kbv examples.

David.

1 Like

Please send the correct library link .Thank for your valuable reply

my output screen of lcd is attached.

Run Library Manager from the IDE

e.g. Sketch->Include Library->Manage Libraries...
e.g. Tools->Manage Libraries...

Install MCUFRIEND_kbv
Install Adafruit_GFX

Run example sketch from library

e.g. File->Examples->MCUFRIEND_kbv->graphictest_kbv
e.g. File->Examples->MCUFRIEND_kbv->diagnose_TFT_support
e.g. File->Examples->MCUFRIEND_kbv->LCD_ID_readreg
e.g. File->Examples->MCUFRIEND_kbv->readpixel_kbv

Obviously my IDE menus are in English. Your menu will have titles in your own language.
If you are not sure how to use the IDE please ask.

David.

1 Like

david_prentice:
Run Library Manager from the IDE

e.g. Sketch->Include Library->Manage Libraries...
e.g. Tools->Manage Libraries...

Install MCUFRIEND_kbv
Install Adafruit_GFX

Run example sketch from library

e.g. File->Examples->MCUFRIEND_kbv->graphictest_kbv
e.g. File->Examples->MCUFRIEND_kbv->diagnose_TFT_support
e.g. File->Examples->MCUFRIEND_kbv->LCD_ID_readreg
e.g. File->Examples->MCUFRIEND_kbv->readpixel_kbv

Obviously my IDE menus are in English. Your menu will have titles in your own language.
If you are not sure how to use the IDE please ask.

David.

Thank you!!

How to use my own IDE .

I run the graphictest_kbv. The following output will be there

Serial took 0ms to start
ID = 0x2FE3

I run the diagnose_TFT_support .the output is:

Diagnose whether this controller is supported
There are FAQs in extras/mcufriend_how_to.txt

tft.readID() finds: ID = 0x2FE3

MCUFRIEND_kbv version: 2.9.8

This ID is not supported
look up ID in extras/mcufriend_how_to.txt
you may need to edit MCUFRIEND_kbv.cpp
to enable support for this ID
e.g. #define SUPPORT_8347D

New controllers appear on Ebay often
If your ID is not supported
run LCD_ID_readreg.ino from examples/
Copy-Paste the output from the Serial Terminal
to a message in Displays topic on Arduino Forum
or to Issues on GitHub

Note that OPEN-SMART boards have diff pinout
Edit the pin defines in LCD_ID_readreg to match
Edit mcufiend_shield.h for USE_SPECIAL
Edit mcufiend_special.h for USE_OPENSMART_SHIELD_PINOUT

LCD_ID_readreg .The output is:

Read Registers on MCUFRIEND UNO shield
controllers either read as single 16-bit
e.g. the ID is at readReg(0)
or as a sequence of 8-bit values
in special locations (first is dummy)

reg(0x0000) 00 00 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) 00 00 61 00 00 Status Register
reg(0x000A) 00 08 Get Power Mode
reg(0x000C) 00 00 Get Pixel Format
reg(0x0061) 00 00 RDID1 HX8347-G
reg(0x0062) 00 00 RDID2 HX8347-G
reg(0x0063) 00 00 RDID3 HX8347-G
reg(0x0064) 00 00 RDID1 HX8347-A
reg(0x0065) 00 00 RDID2 HX8347-A
reg(0x0066) 00 00 RDID3 HX8347-A
reg(0x0067) 00 00 RDID Himax HX8347-A
reg(0x0070) 00 00 Panel Himax HX8347-A
reg(0x00A1) 00 00 00 00 00 RD_DDB SSD1963
reg(0x00B0) 00 00 RGB Interface Signal Control
reg(0x00B4) 00 00 Inversion Control
reg(0x00B6) 00 02 1E 1E 1E Display Control
reg(0x00B7) 00 06 Entry Mode Set
reg(0x00BF) 00 02 02 02 02 02 ILI9481, HX8357-B
reg(0x00C0) 00 15 11 11 11 11 11 11 11 Panel Control
reg(0x00C8) 00 04 04 04 04 04 04 04 04 04 04 04 04 GAMMA
reg(0x00CC) 00 85 Panel Control
reg(0x00D0) 00 00 00 Power Control
reg(0x00D2) 00 00 00 03 03 NVM Read
reg(0x00D3) 00 00 93 40 ILI9341, ILI9488
reg(0x00D4) 00 00 00 00 Novatek ID
reg(0x00DA) 00 E3 RDID1
reg(0x00DB) 00 00 RDID2
reg(0x00DC) 00 00 RDID3
reg(0x00E0) 00 00 86 10 09 16 08 3C 5A 4A 05 0D 09 1B 1F 0F GAMMA-P
reg(0x00E1) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA-N
reg(0x00EF) 00 00 00 00 00 00 ILI9327
reg(0x00F2) 00 00 00 00 00 00 00 00 00 00 00 00 Adjust Control 2
reg(0x00F6) 00 00 00 00 Interface Control

I have no luck My lcd display remaining white only

My apologies. I read that you were using "foreign" libraries and consequently did not study your readreg report carefully.

You do not appear to have a genuine ILI9340. The ILI9340 datasheet expects

reg(0x000C) 00 06 Get Pixel Format
reg(0x00B0) 00 40 RGB Interface Signal Control
reg(0x00B4) 00 02 Inversion Control
reg(0x00B6) 00 0A 82 27 xx Display Control
reg(0x00B7) 00 07 Entry Mode Set
reg(0x00C0) 00 26 00 xx xx xx xx xx xx Panel Control
reg(0x00D0) 00 00 00 Power Control
reg(0x00D3) 00 00 93 40 ILI9341, ILI9488  ### SAME AS ILI9340 ###
reg(0x00E0) 00 0F 22 1F 0A 0E 06 4D 76 3B 03 0E 04 13 0E 0C GAMMA-P
reg(0x00E1) 00 0C 23 26 04 10 04 39 24 4B 03 0B 0B 33 33 37 0F GAMMA-N

I would expect the library find ID = 0x9340. I do not understand how you got 0x2FE3

Please run graphictest_kbv example after editing setup()

void setup(void) {
    Serial.begin(9600);
    uint32_t when = millis();
    //    while (!Serial) ;   //hangs a Leonardo until you connect a Serial
    if (!Serial) delay(5000);           //allow some time for Leonardo
    Serial.println("Serial took " + String((millis() - when)) + "ms to start");
    //    tft.reset();                 //hardware reset
    uint16_t ID = tft.readID(); //
    Serial.print("ID = 0x");
    Serial.println(ID, HEX);
    if (ID == 0xD3D3) ID = 0x9481; // write-only shield
    ID = 0x9329;                             // force ID
    tft.begin(ID);
}

Then repeat with "forcing" ID = 0x9340

Where did you buy your shield?
If there is a non-Ilitek 0x9340 appearing on Ebay I would like to get this fixed.

David.

Thank you !!!

I am forcing The ID = 0x9340 . But Still not working .

I am buy a sheild in electronics shop. tft for arduino(spifalsh) only U2 and U3 IC on my board .U5 IC slot is Empty .

www.mcufriend.com on my sheild.

Please help me..

I am used below attached lcd sheild:

arduino-tft.jpg

Thanks for the photo of the Shield pcb. It is the current Mcufriend pcb disign. I do not think it is a good design but it should "work".

I would expect the shield to work with tft.begin(0x9329);

If it does not work with 0x9329 or with 0x9340 the shield is faulty.

Go back to the shop and ask them for a replacement. Make sure that the shop tests the replacement shield before you accept it.

David.

Hello David,

Thanks for you support .I changed my tft display now working fine with Arduino uno.
Same display not working arduino mega 2560.what can i do?

Thanks Again

What controller is in the replacement display?

Any controller that works in the Uno should work in Mega, Leonardo, Due, Zero, ...

Plug the shield into the Mega, Leonardo, Due, Zero, ...
Select the Board in the IDE
Build and run the examples.

Which example does not run in the MEGA2560?

Have you enabled a SPECIAL ?
In which case it might be building for some special wiring.

I am still intrigued by your reports in #13 for the old display.
It looks like a non-genuine ILI9340. I would like to know more about it.

Did you get a refund for the non-working display?
Or did the shop send a free replacement?

David.