help getting mcufriend tftp display to work

hello. I am fairly new to this. I have recently purchased a mcufriend 2.8 display. Attempting to get it to work. For now, it is on what I found to be called the white screen of death.

It is attached to a Mega 2560 board.

I have downloaded and installed the MCUFRIEND_kbv library. Upon running the LCD_ID_readreg sketch. Register D3 is reading all 0s. The output is posted below for reference.

Any help you can provide would be greatly appreciated. I am hoping to get this working so I can use it to control my project. Thanks.

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) 47 47	ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00	Manufacturer ID
reg(0x0009) 3F 3F 3F 3F 3F	Status Register
reg(0x000A) 00 00	Get Power Mode
reg(0x000C) 01 01	Get Pixel Format
reg(0x0061) 00 00	RDID1 HX8347-G
reg(0x0062) 80 80	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 00 00 00 00	Display Control
reg(0x00B7) 00 00	Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00	ILI9481, HX8357-B
reg(0x00C0) 00 00 00 00 00 00 00 00 00	Panel Control
reg(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00	GAMMA
reg(0x00CC) 00 00	Panel Control
reg(0x00D0) 00 00 00	Power Control
reg(0x00D2) 00 00 00 00 00	NVM Read
reg(0x00D3) 00 00 00 00	ILI9341, ILI9488
reg(0x00D4) 00 00 00 00	Novatek ID
reg(0x00DA) 00 00	RDID1
reg(0x00DB) 00 00	RDID2
reg(0x00DC) 00 00	RDID3
reg(0x00E0) 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03	GAMMA-P
reg(0x00E1) 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49 49	GAMMA-N
reg(0x00EF) 49 49 49 49 49 49	ILI9327
reg(0x00F2) 10 10 10 10 10 10 10 10 10 10 10 10	Adjust Control 2
reg(0x00F6) 00 00 00 00	Interface Control

First off, install/upgrade your library with the Library Manager

You have an HX8347 controller. You must enable support by editing MCUFRIEND_kbv.cpp and removing the two slashes in front of #define SUPPORT_8347D

There are instructions in the how_to file.
There are instructions in the diagnose_TFT_controller sketch

If your original library has come from Elegoo and not from the Library Manager, it is wise to delete the whole MCUFRIEND_kbv directory and start again (with the Library Manager)

David.

ok I removed library and reinstalled via library manager (I believe it was your library). Updated the files as you suggested. I do see output to the screen now from the diagnose_TFT_contoller sketch. ID=0x4747.

Thanks. Hopefully I can figure it out from here.

So I can get things to display to this screen. All the screen test sketches work. But the touchscreen tests result in "broken screen". Is there something more I need to do to ensure this is not broken. Or is this part a DOA.

Copy-Paste the diagnosis from the Serial Terminal.

If the diagnostic says broken screen, it is probably correct. You can always measure the Touch Panel resistance with a DMM.

If the glass has a single crack, it is broken.
If there is a broken connection between the Touch panel signals and the Shield pins, it is broken.

Note that the diagnostic does not work on ARM or ESP32. You must use a DMM.

David.

I don't see any cracks in the screen and the ribbon cables appear to be connected. Not sure what a DMM is.

from the calibration sketch.

TouchScreen.h GFX Calibration
Making all control and bus pins INPUT_PULLUP
Typical 30k Analog pullup with corresponding pin
would read low when digital is written LOW
e.g. reads ~25 for 300R X direction
e.g. reads ~30 for 500R Y direction

BROKEN TOUCHSCREEN
ID = 0x4747

from diagnose touch pins

Making all control and bus pins INPUT_PULLUP
Typical 30k Analog pullup with corresponding pin
would read low when digital is written LOW
e.g. reads ~25 for 300R X direction
e.g. reads ~30 for 500R Y direction

Also, here is the touchshield_new output.

Most Touch Screens use pins 6, 7, A1, A2
But they can be in ANY order
e.g. right to left or bottom to top
or wrong direction
Edit name and calibration statements

HX8347-D
ID=0x4747
Screen is 240x320
Calibration is: 
LEFT = 907 RT  = 136
TOP  = 942 BOT = 139
Wiring is always PORTRAIT
YP=55 XM=56
YM=7 XP=6

You can select as much of a Serial Window as you like. Paste it to your message.

thaynes sounds a fairly Anglo-Saxon name. Google DMM. See what it says.
Hint. A device for measuring voltage, current, resistance.

If you don't have a DMM, the diagnostic paste will tell me most things.

David.

Edit. The touchshield_new does no diagnosis. It simply reports the default values.
I would like to see the diagnostic.

you know what. I am a dumby. Yes I have a multimeter. I guess I will attempt to figure out how to test this board with it.

I did post everything in the diagnostic window in my above message.

Unplug the shield. Measure the resistance between A1 and Digital pins. Then repeat for A2. It is possible but unlikely that there is anything connected to A0 or A3.

I would expect the diagnostic to report which pins “look” connected before saying Broken.
I am not at a PC. Perhaps I have ruined the report !!

David.

here is the code from my diagnose_touchpins sketch. the one not reporting anything but the initial print text.

void showpins(int A, int D, int value, const char *msg)
{
    Serial.print(msg);
    Serial.print(" (A" + String(A - A0) + ", D" + String(D) + ") = ");
    Serial.println(value);
}
void setup()
{
    int i, j, value, Apins[2], Dpins[2], Values[2], found = 0;
    Serial.begin(9600);
    Serial.println("Making all control and bus pins INPUT_PULLUP");
    Serial.println("Typical 30k Analog pullup with corresponding pin");
    Serial.println("would read low when digital is written LOW");
    Serial.println("e.g. reads ~25 for 300R X direction");
    Serial.println("e.g. reads ~30 for 500R Y direction");
    Serial.println("");
    for (i = A0; i < A5; i++) pinMode(i, INPUT_PULLUP);
    for (i = 2; i < 10; i++) pinMode(i, INPUT_PULLUP);
    for (i = A0; i < A4; i++) {
        for (j = 5; j < 10; j++) {
            pinMode(j, OUTPUT);
            digitalWrite(j, LOW);
            value = analogRead(i);   // ignore first reading
            value = analogRead(i);
            if (value < 100) {
                showpins(i, j, value, "Testing :");
                if (found < 2) {
                    Apins[found] = i;
                    Dpins[found] = j;
                    Values[found] = value;
                    found++;
                }
            }
            pinMode(j, INPUT_PULLUP);
        }
    }
    if (found == 2) {
        Serial.println("Diagnosing as:-");
        for (i = 0; i < 2; i++) {
            showpins(Apins[i], Dpins[i], Values[i], (Values[i] < Values[!i]) ? "XM,XP: " : "YP,YM: ");
        }
    }
}

void loop()
{
    // put your main code here, to run repeatedly:

}

This is what Serial Terminal output should look like.
Note that Blue ILI9481 non-Mcufriend shields often do not have a Touch Panel.
I show an example where a Panel has Y but no X.

good diagnose_TouchPins:

Making all control and bus pins INPUT_PULLUP
Typical 30k Analog pullup with corresponding pin
would read low when digital is written LOW
e.g. reads ~25 for 300R X direction
e.g. reads ~30 for 500R Y direction

Testing : (A2, D8) = 25
Testing : (A3, D9) = 37
Diagnosing as:-
XM,XP:  (A2, D8) = 25
YP,YM:  (A3, D9) = 37

good TouchScreeen_Calibr_native:

TouchScreen.h GFX Calibration
Making all control and bus pins INPUT_PULLUP
Typical 30k Analog pullup with corresponding pin
would read low when digital is written LOW
e.g. reads ~25 for 300R X direction
e.g. reads ~30 for 500R Y direction

Testing : (A1, D7) = 31
Testing : (A2, D6) = 23
Diagnosing as:-
YP,YM:  (A1, D7) = 31
XM,XP:  (A2, D6) = 23
ID = 0x154

cx=863 cy=936 cz=473 LEFT, TOP, Pressure
cx=870 cy=559 cz=567 LEFT, MIDH, Pressure
cx=860 cy=183 cz=651 LEFT, BOT, Pressure
cx=506 cy=939 cz=326 MIDW, TOP, Pressure
cx=521 cy=184 cz=622 MIDW, BOT, Pressure
cx=209 cy=926 cz=249 RT, TOP, Pressure
cx=177 cy=567 cz=441 RT, MIDH, Pressure
cx=173 cy=181 cz=587 RT, BOT, Pressure
MCUFRIEND_kbv ID=0x0154  240 x 320

const int XP=6,XM=A2,YP=A1,YM=7; //240x320 ID=0x0154
const int TS_LEFT=894,TS_RT=155,TS_TOP=958,TS_BOT=156;
PORTRAIT CALIBRATION     240 x 320
x = map(p.x, LEFT=894, RT=155, 0, 240)
y = map(p.y, TOP=958, BOT=156, 0, 320)
Touch Pin Wiring XP=6 XM=A2 YP=A1 YM=7
LANDSCAPE CALIBRATION    320 x 240
x = map(p.y, LEFT=958, RT=156, 0, 320)
y = map(p.x, TOP=155, BOT=894, 0, 240)

Bad diagnose_TouchPins:

Making all control and bus pins INPUT_PULLUP
Typical 30k Analog pullup with corresponding pin
would read low when digital is written LOW
e.g. reads ~25 for 300R X direction
e.g. reads ~30 for 500R Y direction

Testing : (A1, D7) = 31

Bad TouchScreen_Calibr_native:

TouchScreen.h GFX Calibration
Making all control and bus pins INPUT_PULLUP
Typical 30k Analog pullup with corresponding pin
would read low when digital is written LOW
e.g. reads ~25 for 300R X direction
e.g. reads ~30 for 500R Y direction

Testing : (A1, D7) = 36
BROKEN TOUCHSCREEN
ID = 0x9341

You said that you owned a DMM. Did you try measuring resistance between A1 and D7 or A1 and D9 ?

David.

thanks for your help. I am going to chalk this up to a bad display. I'll order another one and hopefully it works. Maybe I can use this to display something on a future project. Thank you for all your help.