Having trouble making this display work on Mega with shield




hello everyone, i am trying to make this LCD work with Mega, i tried many libraries but all i get is a white screen, i am 100% its my mistake as i cant identify the LCD/shield version , so can someone please guide me on how i can make it work?

thanks a lot for any help i get.

Take a look at this:

this is one of the tutorials i followed before , but the link for the libraries is not working for me.

i followed other tutorials but they all resulted in white screen .

thanks for help

At least i want to know how to identify the LCD and shield version so I know what library I should use.

thanks again

This is my basic test code. Try it. You may need to install some libraries with the Library Manager.

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <MCUFRIEND_kbv.h>
#include <TouchScreen.h>

MCUFRIEND_kbv tft;

#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF
#define GREY    0x2945

void setup() {
  Serial.begin(38400);

  uint16_t ID = tft.readID();
  Serial.print("TFT ID = 0x");
  Serial.println(ID, HEX);
  Serial.println("Calibrate for your Touch Panel");
  if (ID == 0xD3D3) ID = 0x9486; // write-only shield
  tft.begin(ID);
  tft.setRotation(0);            //PORTRAIT
  tft.fillScreen(BLACK);
  tft.setCursor(0, 0);
  tft.setTextColor(WHITE);
  tft.setTextSize(3);
  tft.println("Hello World!");
}

void loop() {
}

when i run that code i get the following in the serial console and still the screen is white:

"�!W���(�,0������������������������������!����(�L0"

I set my serial port at 38400. Set the serial monitor to match or change Serial.begin(9600)

now i get:

��������������������������������TFT ID = 0xC0C

Calibrate for your Touch Panel

Try this. It's running on my 480x320 on the upper corner of my display.
IDE _> File -> Examples -> MCUFRIEND_kbv -> GLUE_Demo_320x240

Edit: Check your wiring with the link in post #2.

sadly it didn't work, There is still a white screen, also for the wiring I am using the shield for mega, is there anything I need to do?

I appreciate your patience

I see that now. Don't know why it isn't working. Has the same controller as mine.

hello again , i run the MCUfriend (LCD_ID_readnew.ino) and it gave me this info:

Read Special 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)

diagnose any controller
reg(0x0000) 04 04	ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 04 04 04 04	Manufacturer ID
reg(0x0009) 05 05 05 05 05	Status Register
reg(0x000A) 06 06	Get Power Mode
reg(0x000C) 04 04	Get Pixel Format
reg(0x0030) 34 34 34 34 34	PTLAR
reg(0x0033) 3F 3F 3F 3F 3F 3F 3F	VSCRLDEF
reg(0x0061) 6D 6D	RDID1 HX8347-G
reg(0x0062) 66 66	RDID2 HX8347-G
reg(0x0063) 67 67	RDID3 HX8347-G
reg(0x0064) 64 64	RDID1 HX8347-A
reg(0x0065) 65 65	RDID2 HX8347-A
reg(0x0066) 66 66	RDID3 HX8347-A
reg(0x0067) 67 67	RDID Himax HX8347-A
reg(0x0070) 74 74	Panel Himax HX8347-A
reg(0x00A1) 25 25 25 25 25	RD_DDB SSD1963
reg(0x00B0) 3C 3C	RGB Interface Signal Control
reg(0x00B3) 3F 3F 3F 3F 3F	Frame Memory
reg(0x00B4) 3C 3C	Frame Mode
reg(0x00B6) 3E 3E 3E 3E 3E	Display Control
reg(0x00B7) 3F 3F	Entry Mode Set
reg(0x00BF) 3F 3F 3F 3F 3F 3F	ILI9481, HX8357-B
reg(0x00C0) 4C 4C 4C 4C 4C 4C 4C 4C 4C	Panel Control
reg(0x00C1) 45 45 45 45	Display Timing
reg(0x00C5) 4D 4D	Frame Rate
reg(0x00C8) 44 44 44 44 44 44 44 44 44 44 44 44 44	GAMMA
reg(0x00CC) 44 44	Panel Control
reg(0x00D0) 54 54 54 54	Power Control
reg(0x00D1) 55 55 55 55	VCOM Control
reg(0x00D2) 5E 5E 5E	Power Normal
reg(0x00D3) 5F 5F 5F 5F	ILI9341, ILI9488
reg(0x00D4) 54 54 54 54	Novatek
reg(0x00DA) 56 56	RDID1
reg(0x00DB) 57 57	RDID2

as I see the panel is ILI9341 or ILI9488 , is there a library for it? 

again thanks a lot for any help I get

Your MEGA shield is write-only, as far as I remember. It uses unidirectional level converters.
You may need to use a forced ID with MCUFRIEND_kbv.

can you help me how to do that? i am quite a beginner

thanks for help

Start with reading MCUFRIEND_kbv/README.md at master · prenticedavid/MCUFRIEND_kbv · GitHub.

Then try to run MCUFRIEND_kbv/examples/graphictest_kbv/graphictest_kbv.ino at master · prenticedavid/MCUFRIEND_kbv · GitHub.
See line 95 ff:

    if (ID == 0xD3D3) ID = 0x9481; // write-only shield
//    ID = 0x9329;                             // force ID
    tft.begin(ID);

But you also need to configure the library for 16 bit parallel interface and Arduino MEGA.

this is too much for me to understand, but as far I understand, my shield is not supported by MCUfriend as it's a 40-pin shield.

is there any way to make that LCD work??

i really need to make this LCD work for a project I am working on.

really appreciate the help

Your shield is supported. It has a 16 bit parallel data bus and some control lines.

I am not patient enough to act as a teacher. And I am always short on time.

But there are many responders in this section that might step in and provide tens of answer posts. :grinning:

See MCUFRIEND_kbv/utility/mcufriend_special.h at master · prenticedavid/MCUFRIEND_kbv · GitHub line 6:

//#define USE_MEGA_16BIT_SHIELD     // 2.14sec Mega2560 Shield 

and uncomment it.