TFT 3.2" display issue Ili9341

Hi
Just got a new 3.2 tft display for my mega and trying to go through examples to verify its working but if only seems to show half screen and buttons overlap, text is garbled.
I have an elegoo mega 2560 rev 3
Display shield that came with tft
3.2" tft touch 320x240,it says ili9341 16bit on the packaging.
Bought from aus electronics and downloaded the drivers and libraries from their site linked to the product, the examples already have ili9341_16 set.
I ran the config test and it didnt recognise model.
On my tft board it says hr4 8637s G1/1

Before using the libraries that came with it i installed mcufriend ones, utft, ur touch

Please post a link to the actual display that you have bought e.g. sale page from the shop or online catalogue.

Yes, you have given some clues. But you can't expect readers to Google with your clues. We don't know every Australian shop and there is no point in guessing.

When we have accurate information we can walk you through how to plug in, run examples, ...

David.

Sorry David here's the link: 3.2 inch Touchscreen LCD Screen Shield for Arduino Mega (auselectronicsdirect.com.au)

Cheers

Rob

It looks like a regular 40-pin display with a 40-pin Adapter Shield.

  1. Plug Shield into MEGA2560

  2. Plug Display into Shield

  3. Connect USB cable to the MEGA2560

  4. Either install the hacked library from the "Download Library and Examples" link. (v2.82)

  5. Or install the official UTFT library (v2.83) from RinkyDink

  6. You should only have one version of UTFT.

  7. It looks as if the "Download Examples" have been configured to run out of the box. I am sure that they will be 100%

  8. If you choose the "official" UTFT you will need to use the correct constructor in every sketch e.g.

UTFT    myGLCD(ILI9341_16,38,39,40,41);

Personally, I would always be happier with the official library(s) but you might find it easier to start with the hacked library and examples. After all, the board manufacturer has probably tested the display with them.

If you have any problems, take notes on paper describing each step you made.

Then type from your notes, quote the library version and Example name.

Good Luck !

David.

Thanks for that.
I again downloaded the included files and installed the libraries (hacked) specific to this tft, tried an example and again I get no error, it uploads just fine but the display is showing on only half, buttons are overlapped and text is garbled.
What should I try next?
Cheers
Rob


Just tried the official v2.83 from rinkydink and changed example to use:
UTFT myGLCD(ILI9341_16,38,39,40,41);
It displays stuff but messy, half screen and not in the right place.

I ran diagnostics in mcufriend examples:

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

tft.readID() finds: ID = 0x2424

MCUFRIEND_kbv version: 2.9.9

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

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) 2C 2C ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 2C 2C 2C 2C Manufacturer ID
reg(0x0009) 2D 2D 2D 2D 2D Status Register
reg(0x000A) 2E 2E Get Power Mode
reg(0x000C) 2C 2C Get Pixel Format
reg(0x0061) 6D 6D RDID1 HX8347-G
reg(0x0062) 6E 6E RDID2 HX8347-G
reg(0x0063) 6F 6F RDID3 HX8347-G
reg(0x0064) 6C 6C RDID1 HX8347-A
reg(0x0065) 6D 6D RDID2 HX8347-A
reg(0x0066) 6E 6E RDID3 HX8347-A
reg(0x0067) 6F 6F RDID Himax HX8347-A
reg(0x0070) 7C 7C Panel Himax HX8347-A
reg(0x00A1) AD AD AD AD AD RD_DDB SSD1963
reg(0x00B0) BC BC RGB Interface Signal Control
reg(0x00B4) BC BC Inversion Control
reg(0x00B6) BE BE BE BE BE Display Control
reg(0x00B7) BF BF Entry Mode Set
reg(0x00BF) BF BF BF BF BF BF ILI9481, HX8357-B
reg(0x00C0) EC EC EC EC EC EC EC EC EC Panel Control
reg(0x00C8) EC EC EC EC EC EC EC EC EC EC EC EC EC GAMMA
reg(0x00CC) EC EC Panel Control
reg(0x00D0) FC FC FC Power Control
reg(0x00D2) FE F6 F6 F6 F6 NVM Read
reg(0x00D3) FB FB FB FB ILI9341, ILI9488
reg(0x00D4) FC FC FC FC Novatek ID
reg(0x00DA) F2 F2 RDID1
reg(0x00DB) FB FB RDID2
reg(0x00DC) F4 F4 RDID3
reg(0x00E0) E4 E4 E4 E4 E4 E4 E4 E4 E4 E4 E4 E4 E4 E4 E4 E4 GAMMA-P
reg(0x00E1) E1 E1 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 E5 GAMMA-N
reg(0x00EF) EF EF EF EF EF EF ILI9327
reg(0x00F2) F2 F2 F2 F6 F6 F6 E6 E6 E6 E6 E6 E6 Adjust Control 2
reg(0x00F6) F6 F6 F6 F6 Interface Control

Does this help?

I again downloaded the included files and installed the libraries (hacked) specific to this tft, tried an example and again I get no error, it uploads just fine but the display is showing on only half, buttons are overlapped and text is garbled.

You should always leave the IDE. Delete the old UTFT directory. Start the IDE . Install the new library.

I don't know what instructions your hacked library gives. (UTFT is not supported by the IDE Library Manager because UTFT author Henning Karlsen refuses)

Then type from your notes, quote the library version and Example name.

Please quote Example name. I don't want to guess.

Your photo shows that something is working with the hacked v2.82
I would like to see the equivalent picture for genuine v2.83

Please understand that I don't have your hardware. I have genuine v2.83 but I certainly don't want to install any hacked v2.82 (even though it will probably be safe)

Regarding MCUFRIEND_kbv. This is designed for read-write Uno Shields. Your Mega Adapter Shield is write-only so it is impossible to read ID or registers.

I suggested some steps in #4. Please follow them.
It is pretty easy to say that you did steps (1), (2), (3), (4), (6), (7) and ran example "Example_XYZ.ino"

You might think that it is hard work to type information to your message. Yes, it takes a few minutes from your life. But it means that you get accurate replies.

David.

Hi David,

To be clear, from your suggestions in 4:
I ran steps (1),(2),(3),(4), (6 - yes I have one version at a time) , ran example then posted the results.
So this was from the Hack, I then deleted the UTFT folder and did (5) - downloaded and installed v2.83 from Rinkydink, I got the same results - half screen and garbled text, things in the wrong place.

So let me reset, here's what i've done just now:
(everything is plugged in)
1.Exited from IDE
2.Deleted utft folder
3.Downloaded official v2.83 from rinky dink again
4.Launched IDE
5.Went into Sketch, include library, add .zip library, selected the one just downloaded from rinky dink
6.Tried example UTFT_viewfont - edited the following:
Changed this - UTFT myGLCD(ITDB32S,38,39,40,41);
to this - UTFT myGLCD(ILI9341_16,38,39,40,41);
7. Compiled - successfully
8. Uploaded to Mega

Result - same, it displays but only uses half screen, text doesn't look readable
My library version is v2.83

I would still like to know which example you are building. i.e. the name

I would be happier with examples from the genuine v2.83 but examples from v2.82 or the Elegoo examples would be perfectly acceptable if you quote the example name.

TFT hardware failures do not look like #5

David.

Hi David
My Point 6 i did provide the example name and it was from the official library v2.83
Example name:UTFT_viewfont (this is the example name right? Apologies if not)

Please see below:
6.Tried example UTFT_viewfont - edited the following:
Changed this - UTFT myGLCD(ITDB32S,38,39,40,41);
to this - UTFT myGLCD(ILI9341_16,38,39,40,41);

Thanks for trying to help resolve this issue, it's appreciated.
Rob

Wondering if this is faulty or incompatible hardware and I should send it back and buy a different TFT with shield, what are peoples thoughts?
Is there a display that will be 100% compatible with my Elegoo AT Mega2560 R3?

From #0

3.2" tft touch 320x240,it says ili9341 16bit on the packaging.

My apologies. From a further look at the link from #3 I see that your display has 34 pins and it is a 34-pin Adapter Shield for Mega2560

I had just assumed it was the common 40-pin TFT320QVT_9341 display with a regular 40-pin Adapter Shield.

I have never seen a 34-pin Adapter Shield before !!
For several years I have been saying : Do not buy 34-pin displays because there is no 34-pin Adapter Shield

Quite honestly, the pictures in #5 and #10 don't add up. There is something very odd.

I don't have an ILI9341 display with 16-bit interface. Only Mcufriend-style with 8-bit interface that is not supported by UTFT.

When you received your display, was the anti-static envelope sealed ? Did it really say ili9341 16bit on the anti-static envelope?

I suggest that you ask for a refund or a replacement from the shop.

David.

Hi David
Yes the envelope was sealed, i still have it and it says 3.2" lcd module
Driver ILI9341
Bus: 16bit
Dots: 240x320
Touch: yes

I'll ask for a refund.

Can you tell if the display in this link has a good chance of being ok?

https://www.jaycar.com.au/medias/sys_master/images/images/9457004085278/XC4630-manualMain.pdf
They are a reputable electronics store and I can walk in to purchase.

Yes, that should work fine on a Uno. Note that you must make a minor one-time edit of MCUFRIEND_kbv.cpp

It will be slower on a Mega2560 but will still work.

If you are feeling brave, you could try your 34-pin display with MCUFRIEND_kbv.
From mcufriend_how_to.txt

17. If you do not have a standard Uno Shield, you can add a SPECIAL to the mcufriend_special.h
    Edit mcufriend_shield.h:  #define USE_SPECIAL
    Edit mcufriend_special.h: e.g. #define USE_MEGA_16BIT_SHIELD
    If your "special" is write-only,  the library can not read the ID.  It always returns 0xD3D3

Then try forcing tft.begin(0x9329) in setup() for any of the examples.
Don't worry about mirroring, directions, ...
Just see if the display shows a clear picture.
Report back.

David.

Thanks David,
I followed your suggestion and it seems better, not perfect but an improvement.
Now is using the full screen, placement is a bit off still.

I edited mcufriend_shield.h: #define USE_SPECIAL
Edit mcufriend_special.h #define USE_MEGA_16BIT_SHIELD

I didn't do minor one-time edit of MCUFRIEND_kbv.cpp - was that for UNO only? If not what is the Edit please?

Example was button simple, I changed it a little though.
And I changed setup to:
void setup(void)
{
Serial.begin(9600);
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.begin(0x9329);
tft.setRotation(0); //PORTRAIT
tft.fillScreen(BLACK);
on_btn.initButton(&tft, 60, 200, 100, 40, WHITE, CYAN, BLACK, "ON", 2);
off_btn.initButton(&tft, 180, 200, 100, 40, WHITE, CYAN, BLACK, "OFF", 2);
on_btn.drawButton(false);
off_btn.drawButton(false);
tft.fillRect(40, 80, 160, 80, RED);
}

The "minor edit" was for the Jaycar display. It uses a "less common" UC8230 controller e.g.

UC8230   240x320  ID=0x8230 #define SUPPORT_8230

The good news is that your display is not dead.

Please run graphictest_kbv.ino (with the tft.begin(0x9329); statement )

Either take notes on paper. Or post a video. Or a few photos of Penguin screens.

David.

p.s. many but not all examples handle write-only displays and still work with regular read-write displays.
e.g. edit like this:

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