2.8" TFT Display with uSD Card Module KeDei QQ:310953417

You was lucky because for me these modification doesn't work!

The seller sent me a Datasheet for a ILI9325 controller so I tryed also this one with no luck.

Sorry,

my display is 2.8" TFT Display with uSD Card Module KeDei QQ:310953417

I found Kedei shop on Aliexpress, wrote to him.
He was very kind and mailed me the drivers. They works.

I attached them here.

2.8_并口_c++.zip (422 KB)

I tried your driver but the examples are not compiled in my Arduino IDE 1.6.4. :frowning:

See Error:
C: \ Program Files (x86) \ arduino-1.6.4 \ libraries \ LCDTFT \ font.cpp: In member function 'void Font :: set_txt (unsigned short int, unsigned short int, unsigned short int, unsigned short int, short unsigned int) ':
C: \ Program Files (x86) \ arduino-1.6.4 \ libraries \ LCDTFT \ font.cpp: 153: 20: warning: NULL used in arithmetic [-Wpointer-arith]
if (txt_b_color! = NULL)

Ho provato i tuoi drivers ma l'Ide di Arduino non compila gli esempi e mi da questo errore.
Ciao.

Wich examples? I compiled with 1.6.5 IDE with the last Arduino core, 1.6.7 if I remember well.

Quali esempi? Io ho usato l'ultimo IDE con l'ultimo core Arduino.

Ok ho riprovato e funziona con la libreria che mi hai mandato!
Grazie. :slight_smile:

Ok I tried again and it works with the library you sent me!
Thanks!

I have 2 displays from them, one for the Uno and one for the Mega. the examples they sent me all work perfectly for both using Arduino 1.0.6

Many thanks to all! Grazie a tutti!

I got this module working on UNO R3 with:

  1. Downloading the library from ZOOMX (for BMP example, you need to add #include <SPI.h> to the example to compile it). uSD and Touch panel working fine.

  2. the suggested http://misc.ws/2015/01/24/lcd-touch-screen-information with 0x0303 as controller ID. BTW: Thanks to the misc.ws moderator to have found the right controller driver for my chip ID under my request. Touch screen not yet working though, still trying on this

zoomx:
I found Kedei shop on Aliexpress, wrote to him.
He was very kind and mailed me the drivers. They works.

I attached them here.

Hi

The library works but you don't able to use with UNO R3 because the memory shortage. Please someone can you modify this library to MEGA or optimize it for lower memory usage? I try to show a picture and some text but it will use 127% of the memory. It's a large array with the font hex codes what eating up all the memory. Can someone help with this problem?

Hello
I need the library for mega the 2.8tft kedei taobao.
Takes

@zoomx,

What does my LCD_ID_readreg.ino sketch show?
I do not recognise the controller from the ZIP file that you attached. Mind you, I can't read Chinese.

It looks very similar to the 2.4" and 2.8" mcufriend boards. However, the mcufriend boards use level-translator chips. The Kedei display looks as if it just uses resistors. The SD traces look as if it is 3.3V only.

David.

I have to check.

There are other differences: A0-A3 lines are swapped.

In the code I believe that there is not written the name of the driver anywere. I was not able to recognise the driver using the initial setup, I didn't find any similar setup so I believe that is a custom code written over older Adafruit code. But I am not sure.
The hardware is different from other builders.

The ZIP that you posted implies that the Shield wiring is identical. i.e. LCD_RD on A0, LCD_D0 on 8.

You can change the defines for RD etc in the LCD_ID_readreg sketch if you need to.

David.

Check made!
With your original sketch I get

reg(0x0000) 03 03	ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 03 03 03 03	Manufacturer ID
reg(0x00BF) 03 03 03 03 03 03	ILI9481
reg(0x00D0) 03 03	HX8357
reg(0x00D3) 03 03 93 43	ILI9341, ILI9488
reg(0x00EF) 03 03 83 03 03 03	ILI9327

If I swap lines according to config.h file I get

reg(0x0000) 03 03	ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 03 03 03 03	Manufacturer ID
reg(0x00BF) 03 03 03 03 03 03	ILI9481
reg(0x00D0) 03 03	HX8357
reg(0x00D3) 03 03 03 03	ILI9341, ILI9488
reg(0x00EF) 03 03 03 03 03 03	ILI9327

These are the pins definition in config.h in the original drivers

//LCD GPIO
#define		RST	A4
#define		CS	A3
#define		RS	A2
#define		WR	A1
#define		RD	A0

#define		D0	2
#define		D1	3
#define		D2	4
#define		D3	5
#define		D4	6
#define		D5	7
#define		D6	8
#define		D7	9

//TS  GPIO
#define		XP	A1	
#define		XM	2	
#define		YP	A2	
#define		YM	3

You should be able to just inspect the pcb traces.

Since you get 0x9343 from register 0xD3, l will put serious money on a ILI9340 or ILI9341.
Bits 0, 1 are clearly reading 1 regardless of your defines. My default defines expect bits LCD_D0, LCD_D1 to be on digital #8, 9.

Try Digital #0, 1. You will probably get bit 0 reading as 1 because it has the Serial RXD0 on this pin. e.g. the sketch would show 0x01 everywhere except for the 9341.

Since an ILI9340 is very similar to a 9341, it is worth trying any 9341 library with the databus on PORTD.

Please try the digital #0, 1 and let me know. If it is wired like this, the MCUFRIEND_kbv library will run at about twice the speed. However the Read functions might conflict with the Serial port. And you will get garbage on a connected Terminal.

David.

No traces start from Digital #0, 1 all traces seems to be as declared in config.h, 2-9 are for sure.
Kedey build these shields, he don't sell shields builded from others, you can find his shop on Aliexpress.

The bmp example works fine so I believe that all the declared lines work. have not greenish colours.

I am very confused. I must have been tired when I originally read the "config.h" from your ZIP.

Please edit LCD_ID_readreg.ino

// for Kedei:
#define LCD_D0 2
#define LCD_D1 3
#define LCD_D2 4
#define LCD_D3 5
#define LCD_D4 6
#define LCD_D5 7
#define LCD_D6 8
#define LCD_D7 9
/* my original wiring
#define LCD_D0 8
#define LCD_D1 9
#define LCD_D2 2
#define LCD_D3 3
#define LCD_D4 4
#define LCD_D5 5
#define LCD_D6 6
#define LCD_D7 7
*/

In message #16, you got a 93 43 from register(0xD3) with "my" wiring.
Please edit for "kedei's" wiring. And paste the result.

Yes, looking (when not tired) at your photo of the pcb, it shows LCD_RESET on A4 and LCD_D7 on digital #9

David.

Done! But unfortunately I get all C0.

reg(0x0000) C0 C0	ILI9320, ILI9325, ILI9335, ...
reg(0x0004) C0 C0 C0 C0	Manufacturer ID
reg(0x00BF) C0 C0 C0 C0 C0 C0	ILI9481
reg(0x00D0) C0 C0	HX8357
reg(0x00D3) C0 C0 C0 C0	ILI9341, ILI9488
reg(0x00EF) C0 C0 C0 C0 C0 C0	ILI9327

But I am confused too. This is a photo of my shield that I shoot.

it doesn't match the define in config.h

#define		RST	A4
#define		CS	A3
#define		RS	A2
#define		WR	A1
#define		RD	A0

#define		D0	2
#define		D1	3
#define		D2	4
#define		D3	5
#define		D4	6
#define		D5	7
#define		D6	8
#define		D7	9

CS is A0 in photo but A3 in #define, for example. But the driver works!

Following the #define (control lines and communication lines) I get all C0.

I am well confused. Message #1 had a photo of a Green pcb with LCD_CS on A3.
Message #20 has a Red pcb. with LCD_CS on A0.

I would simply try the pin-out from the Red pcb if that is what is on your desk:

// Red pcb
#define RST A4
#define CS A0
#define RS A1
#define WR A2
#define RD A3

/*
// Green pcb (and regular MCUFRIEND UNO shields)
#define RST A4
#define CS A3
#define RS A2
#define WR A1
#define RD A0
*/

//Red and Green pcb have this LCD_DATA bus:
#define D0 2
#define D1 3
#define D2 4
#define D3 5
#define D4 6
#define D5 7
#define D6 8
#define D7 9

Since the Arduino builds a Library from the Source code, it should OBEY the defines from the "Config.h" that is actually on your PC. Note that I am simply reading the ZIP from the link in your message #5. You may have a different set of Source files on your PC.

Looking at the actual source code, I have a further problem: The config.h defines are NEVER used in the LCDTFT.cpp code !!! I have added my own comments. I can't read Chinese.

void  TFTLCD::cmd(unsigned char cmd)
{
 PORTC=PORTC&0Xfc|0xf8;                           //A0=0, A1=0, A3=1  i.e.CS=0, RS=0, WR=1
 PORTB=(0xfc&PORTB)|(0x03&cmd);                   //PB0=bit0, PB1=bit1 i.e. MCUFRIEND data bus
 PORTD=(0x03&PORTD)|(0xfc&cmd);                   //PD2-PD7 = bit2-7
 PORTC&=0xfb;                                     //A3=0 i.e. WR=0
 *portOutputRegister(digitalPinToPort(11))&=0xff; //nothing happens
 PORTC|=0x05;                                     //A0=1, A2=1 i.e. CS=1, RD=1

}

So my analysis is that you should have this in Config.h:

// my guess is that the wiring is:
#define RST A4
#define CS A0
#define RS A1
#define WR A3
#define RD A2

//it has a mcufriend LCD_DATA bus:
#define D0 8
#define D1 9
#define D2 2
#define D3 3
#define D4 4
#define D5 5
#define D6 6
#define D7 7

And in the LCD_ID_readreg.ino sketch:

//-- Kedei Plugged as shield on UNO
#define LCD_RST A4
#define LCD_CS A0
#define LCD_RS A1
#define LCD_WR A3
#define LCD_RD A2

#define LCD_D0 8
#define LCD_D1 9
#define LCD_D2 2
#define LCD_D3 3
#define LCD_D4 4
#define LCD_D5 5
#define LCD_D6 6
#define LCD_D7 7

It appears that the WR line spends most of its time at 0. i.e. the 8080 write-bus is active.
Normally you leave WR, RD, CS inactive i.e. 1. Then only "strobe" the WR line as required. i.e. a brief low pulse. Kedei's approach will work but give a problem with a Resistive TouchScreen.

David.

:frowning: using your last #define with WR and RD swapped

reg(0x0000) 01 01	ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 05 05 05 05	Manufacturer ID
reg(0x0009) 09 09 09 09 09	Status Register
reg(0x00BF) BD BD BD BD BD BD	ILI9481
reg(0x00D0) D1 D1	HX8357
reg(0x00D3) D1 D1 D1 D1	ILI9341, ILI9488
reg(0x00EF) ED ED ED ED ED ED	ILI9327

Looking to my photo I still believe that WR is on A2 and RD on A3. In this case I get

reg(0x0000) 03 03	ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 03 03 03 03	Manufacturer ID
reg(0x0009) 03 03 63 03 03	Status Register
reg(0x00BF) 03 03 03 03 03 03	ILI9481
reg(0x00D0) 03 03	HX8357
reg(0x00D3) 03 03 93 43	ILI9341, ILI9488
reg(0x00EF) 03 03 83 03 03 03	ILI9327

I noticed that green PCB shows data lines with D0 on pin 2 and this is strange, maybe it is an older version or maybe a wrong PCB
If config.h is not used at all it may explain the different define.
I use the drivers in the zip posted here because any other drivers doesn't work. I just renamed .cpp and .h files and all references to the old name to avoid confusion with others libraries.