Adafruit TFTLCD library small bug on my 2.4" display but fixed!

I bought 2/3 years ago 2.4" TFT LCD shields from aliexpress or dx.com.

similar to that one 2.4 " TFT uno shield

I was trying to make them work with the new library from adafruit but they refuse to work but they were working with the current code on the UNO. I don't have that code anymore since it was on one of my old laptop.

After some investigation I found that the readID didn't find the LCD. I suspect that my shields are 0x9341.

By changing the readID to force return of 0x9341 I was able to make them work!

uint16_t Adafruit_TFTLCD::readID(void) {
  return 0x9341;
}

Also my touch screen pin out are not same.

#define YP A2  // must be an analog pin, use "An" notation!
#define XM A1  // must be an analog pin, use "An" notation!
#define YM 6   // can be a digital pin
#define XP 7   // can be a digital pin

This is just a little note to help if you have the same problem.

danjperron:
I bought 2/3 years ago 2.4" TFT LCD shields from aliexpress or dx.com.

similar to that one 2.4 " TFT uno shield

I was trying to make them work with the new library from adafruit but they refuse to work but they were working with the current code on the UNO. I don't have that code anymore since it was on one of my old laptop.

After some investigation I found that the readID didn't find the LCD. I suspect that my shields are 0x9341.

By changing the readID to force return of 0x9341 I was able to make them work!

uint16_t Adafruit_TFTLCD::readID(void) {

return 0x9341;
}





Also my touch screen pin out are not same.



#define YP A2  // must be an analog pin, use "An" notation!
#define XM A1  // must be an analog pin, use "An" notation!
#define YM 6   // can be a digital pin
#define XP 7   // can be a digital pin





This is just a little note to help if you have the same problem.

Your link has some form of "iurl" instead of HTML "url". I don't know how you get an "iurl" but I can't click on it.

If I remove the extraneous "iurl=http://" wrapper I get a regular clickable link i.e.

https://www.aliexpress.com/item/1005001651875679.html

Anyway, the link shows a regular "Mcufriend Uno Shield". These come with random controllers. Many of which are not supported by Adafruit_TFTLCD. (chip is not visible to human eye)

If you want to know which controller is actually mounted on your TFT panel, run the LCD_ID_readreg.ino example sketch from MCUFRIEND_kbv library.

David.

Thanks David,

Nice Library!.

The ID is still 0x0. But it works!
I didn't see that iurl. Really strange. I corrected it !

Looks like a read problem. I tried two arduinos UNO on both of my LCDs and still reading zero.

But I dont care I'm able to use them now. One will be used to control my hydroponic garden.

Daniel

No, you have not corrected the HTML url..

Please can you copy-paste the output from LCD_ID_readreg.ino example.
Does MCUFRIEND_kbv return 0x0000 from readID() ?

Can you remember where you bought your shield ?

David.

Hi David, On my side the link are OK! no iurl! and they work!

This is the result of the LCD_ID_readreg.ino

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) 08 08	Get Power Mode
reg(0x000C) 66 66	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 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) 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00	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) 28 94 03 08 08 10 00 15 48 00 07 00	Adjust Control 2
reg(0x00F6) 01 01 03 00	Interface Control

Thanks for the readreg report. You have a MIPI-style controller. There is not any ID found in the usual places.

I suggest that you force some test IDs and see which one obeys every test in graphictest_kbv.ino example. i.e.

  1. correct graphics
  2. correct colours
  3. correct text directions
  4. vertical scroll directions
  5. software scroll
  6. inverted colours

in setup()

    ...
    uint16_t ID = tft.readID(); //
    Serial.print("ID = 0x");
    Serial.println(ID, HEX);
    if (ID == 0xD3D3) ID = 0x9481; // write-only shield
    //>>>>> danjperron please add this next statement <<<<<
    if (ID == 0x0000) ID = 0x2053; //try 0x2053, 0xAC11, 0x9302, 0x9338, 0x9341 
//    ID = 0x9329;                             // force ID
    tft.begin(ID);
}

With luck, 0x9341 gives 100% performance. But these controllers do vary.

David.

thanks again David,

Now the display is roughly three times faster!

best regards,

Now I'm ready to create my display menu. The UNO will be link via serial to an esp32 in micropython.

This topic was automatically closed after 83 days. New replies are no longer allowed.