Display issue with Mega and 2.8 TFT Touchscreen

Hi,

I bought a second 2.8 TFT touch screen that does not display correctly. I have one from the same vendor that is working correctly but this second one is not working with the exact same code. It looks like it may have a different screen on it, i have got the following output to try to identify it as examples keep coming back with 0xd3d3

Its a blue PCB and the following info from the LCD ID example

reg(0x0000) 03 03 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 07 07 07 07 Manufacturer ID
reg(0x0009) 0B 0B 0B 0B 0B Status Register
reg(0x000A) 0B 0B Get Power Mode
reg(0x000C) 0F 0F Get Pixel Format
reg(0x0030) 33 33 33 33 33 PTLAR
reg(0x0033) 33 33 33 33 33 33 33 VSCRLDEF
reg(0x0061) 63 63 RDID1 HX8347-G
reg(0x0062) 63 63 RDID2 HX8347-G
reg(0x0063) 63 63 RDID3 HX8347-G
reg(0x0064) 67 67 RDID1 HX8347-A
reg(0x0065) 67 67 RDID2 HX8347-A
reg(0x0066) 67 67 RDID3 HX8347-A
reg(0x0067) 67 67 RDID Himax HX8347-A
reg(0x0070) 73 73 Panel Himax HX8347-A
reg(0x00A1) A3 A3 A3 A3 A3 RD_DDB SSD1963
reg(0x00B0) B3 B3 RGB Interface Signal Control
reg(0x00B3) B3 B3 B3 B3 B3 Frame Memory
reg(0x00B4) B7 B7 Frame Mode
reg(0x00B6) B7 B7 B7 B7 B7 Display Control
reg(0x00B7) B7 B7 Entry Mode Set
reg(0x00BF) BF BF BF BF BF BF ILI9481, HX8357-B
reg(0x00C0) C3 C3 C3 C3 C3 C3 C3 C3 C3 Panel Control
reg(0x00C1) C3 C3 C3 C3 Display Timing
reg(0x00C5) C7 C7 Frame Rate
reg(0x00C8) CB CB CB CB CB CB CB CB CB CB CB CB CB GAMMA
reg(0x00CC) CF CF Panel Control
reg(0x00D0) D3 D3 D3 D3 Power Control
reg(0x00D1) D3 D3 D3 D3 VCOM Control
reg(0x00D2) D3 D3 D3 Power Normal
reg(0x00D3) D3 D3 D3 D3 ILI9341, ILI9488
reg(0x00D4) D7 D7 D7 D7 Novatek
reg(0x00DA) DB DB RDID1
reg(0x00DB) DB DB RDID2
reg(0x00DC) DF DF RDID3
reg(0x00E0) E3 E3 E3 E3 E3 E3 E3 E3 E3 E3 E3 E3 E3 E3 E3 E3 GAMMA-P
reg(0x00E1) E3 E3 E3 E3 E3 E3 E3 E3 E3 E3 E3 E3 E3 E3 E3 E3 GAMMA-N
reg(0x00EF) EF EF EF EF EF EF ILI9327
reg(0x00F2) F3 F3 F3 F3 F3 F3 F3 F3 F3 F3 F3 F3 Adjust Control 2
reg(0x00F6) F7 F7 F7 F7 Interface Control

for reference i have the pins moved as per the below
#elif defined(AVR_ATmega2560) && defined(USE_MEGA_8BIT_SHIELD_CUSTOM)
#warning USE_MEGA_8BIT_SHIELD for vagos21
#define RD_PORT PORTL
#define RD_PIN 6 //PL6 (D43). Graham has PA15 (D24) on Due Shield
#define WR_PORT PORTG
#define WR_PIN 2 //D39 CTE
#define CD_PORT PORTK
#define CD_PIN 6 //A14 CTE a14
#define CS_PORT PORTK
#define CS_PIN 7 //A15 CTE a15
#define RESET_PORT PORTG
#define RESET_PIN 0 //D41 CTE

#define write_8(x) { PORTA = x;}

#define read_8() ( PINA )
#define setWriteDir() { DDRA = 0xFF; }
#define setReadDir() { DDRA = 0x00; }
#define write8(x) { write_8(x); WR_ACTIVE; WR_STROBE; } // HX8357-D is slower
#define write16(x) { uint8_t h = (x)>>8, l = x; write8(h); write8(l); }
#define READ_8(dst) { RD_STROBE; dst = read_8(); RD_IDLE; }
#define READ_16(dst) { RD_STROBE; dst = read_8(); RD_IDLE; RD_STROBE; dst = (dst<<8) | read_8(); RD_IDLE; }

#define PIN_LOW(p, b) (p) &= ~(1<<(b))
#define PIN_HIGH(p, b) (p) |= (1<<(b))
#define PIN_OUTPUT(p, b) *(&p-1) |= (1<<(b))

Plugging the display directly into another mega yields the following (i think the screen is DOA)

diagnose any controller
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 06 Get Pixel Format
reg(0x0030) 00 00 00 00 00 PTLAR
reg(0x0033) 00 00 00 00 00 00 00 VSCRLDEF
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(0x00B3) 00 00 1B 1B 1B Frame Memory
reg(0x00B4) 00 02 Frame Mode
reg(0x00B6) 00 0A 82 27 04 Display Control
reg(0x00B7) 00 06 Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00 ILI9481, HX8357-B
reg(0x00C0) 00 21 00 00 00 00 00 00 00 Panel Control
reg(0x00C1) 00 10 10 10 Display Timing
reg(0x00C5) 00 31 Frame Rate
reg(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA
reg(0x00CC) 00 71 Panel Control
reg(0x00D0) 00 00 00 00 Power Control
reg(0x00D1) 00 00 00 00 VCOM Control
reg(0x00D2) 00 00 00 Power Normal
reg(0x00D3) 00 00 93 41 ILI9341, ILI9488
reg(0x00D4) 00 00 00 00 Novatek
reg(0x00DA) 00 00 RDID1
reg(0x00DB) 00 00 RDID2
reg(0x00DC) 00 00 RDID3
reg(0x00E0) 00 0F 16 14 0A 0D 06 43 75 33 06 0E 00 0C 09 08 GAMMA-P
reg(0x00E1) 00 08 2B 2D 04 10 04 3E 24 4E 04 0F 0E 35 38 0F GAMMA-N
reg(0x00EF) 00 03 80 02 02 02 ILI9327
reg(0x00F2) 00 02 02 02 02 02 02 02 02 02 02 02 Adjust Control 2
reg(0x00F6) 00 01 00 00 Interface Control

You have an Ilitek ILI9341

This Uno Shield should work out of the box on a Uno, Mega2560, Due, ...

If you want to re-wire the Shield as a SPECIAL to work with USE_MEGA_8BIT_PROTOSHIELD it should work just fine too.
Obviously you must connect every wire correctly.

The LCD_ID_readreg.ino sketch should work if you #define all the pins correctly for your wiring scheme.
This is a very good way to verify your wiring. Post your defines.

I have no intention of studying your USE_MEGA_8BIT_SHIELD_CUSTOM
until you have verified with LCD_ID_readreg.ino (and posted the defines)

David.

So after a bunch of further testing / rewiring, turns out I was thwarted by a broken jumper wire, and when I tested on the other Mega i forgot the disable the "use special"

Great how frustration adds to the mistakes.

If you put the correct #defines into LCD_ID_readreg.ino you should get a proper report.

Yes, you get far better TFT performance on a 2560 when you put the data bus on PORTA.
I suggest that you buy a Protoshield and some male and female header strip.

Route the wires properly. i.e. solder the connecting wires. cut tracks or snip pins from the original pin mapping.
It takes time to do this but you end up with a reliable "Adapter Shield".

This handy for me. I can run any Uno TFT Shield with USE_MEGA_8BIT_PROTOSHIELD

But if you really want to use a TFT display with a Mega2560 --- buy a Mega2560 Display Shield in the first place !!

David.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.