giovedì 8 dicembre 2016

Interface Arduino UNO clone with a 2.4 TFT touchscreen - 3th driver

I have been facing a different type of display driver, even used on a new 2.4" TFT arduino shield.
It is the cheap TFT display you will get from ebay. There are serveral models using different drivers - this one uses LGDP4535 - that I've never met before.

Surfing on the web, I noticed that I was not the only to look for a solution.

So, I have added the following lines to the "MCUFRIEND_kbv.cpp" library ( already installed in my system ).

At the beginning , add :

#define SUPPORT_4532

before the line "#ifdef SUPPORT_4535" , you should add the below lines 


#ifdef SUPPORT_4532
//Support for LG Electronics LGDP4532 (also 4531 i guess) by Leodino v1.0 2-Nov-2016
//based on data by waveshare and the datasheet of LG Electronics
//My approach to get it working: the parameters by waveshare did no make it function allright
//I started with remming lines to see if this helped. Basically the stuff in range 41-93
//gives problems.
//The other lines that are REMmed give no problems, but it seems default values are OK as well.
case 0x4532:
_lcd_capable = 0 | REV_SCREEN; // | INVERT_GS;
static const uint16_t LGDP4532_regValues[] PROGMEM = {
0x0000,0x0001, //Device code read
0x0010,0x0628, //Power control 1 SAP[2:0] BT[3:0] AP[2:0] DK DSTB SLP
0x0012,0x0006, //Power control 3 PON VRH[3:0]
//0x0013,0x0A32, //Power control 4 VCOMG VDV[4:0] VCM[6:0]
0x0011,0x0040, //Power control 2; DC1[2:0] DC0[2:0] VC[2:0]
//0x0015,0x0050, //Regulator control RSET RI[2:0] RV[2:0] RCONT[2:0]
0x0012,0x0016, //Power control 3 PON VRH[3:0]
0x0010,0x5660, //Power control 1 SAP[2:0] BT[3:0] AP[2:0] DK DSTB SLP
//0x0013,0x2A4E, //Power control 4 VCOMG VDV[4:0] VCM[6:0]
//0x0001,0x0100, //Driver output control SM SS
//0x0002,0x0300, //LCD Driving Wave Control
//0x0003,0x1030, //Entry mode TRI DFM BGR ORG I/D[1:0] AM
//0x0007,0x0202, //Display Control 1 PTDE[1:0] BASEE GON DTE COL D[1:0]
//0x0008,0x0202, //Display Control 2 FP[3:0] BP[3:0] front and back porch (blank period at begin and end..)
//0x000A,0x0000, //Test Register 1 (RA0h)
//Gamma adjustment
//some of this stuff in range 41-93 really throws things off....
//0x0060,0x2700, //Driver Output Control (R60h)
//0x0061,0x0001, //Base Image Display Control (R61h)
//0x0090,0x0119, //Panel Interface Control 1 (R90h) DIVI[1:0] RTNI[4:0]
//0x0092,0x010A, //Panel Interface Control 2 (R92h) NOWI[2:0] EQI2[1:0] EQI1[1:0]
//0x0093,0x0004, //Panel Interface Control 3 (R93h) MCPI[2:0]
//0x00A0,0x0100, //Test Register 1 (RA0h)
0x0007,0x0133, //Display Control 1 PTDE[1:0] BASEE GON DTE COL D[1:0]
//0x00A0,0x0000, //Test Register 1 (RA0h)
init_table16(LGDP4532_regValues, sizeof(LGDP4532_regValues));


I think that the "MCUFRIEND" library has been already updated with this TFT version. 
Here the library link :

click here to see the video that demonstrate how it function