Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By erhardd
#33137 You wrote, you use this:
viewtopic.php?p=31921#p31921
-- but this is not the ILI9325DS as used in the TFTv2.cpp TFT::TFTinit
Code: Select all    delay(500);
    sendCMD(0x01);
    delay(200);

    sendCMD(0xCF);
    WRITE_DATA(0x00);
    WRITE_DATA(0x8B);
    WRITE_DATA(0X30);

    sendCMD(0xED);
    WRITE_DATA(0x67);
    WRITE_DATA(0x03);
    WRITE_DATA(0X12);
    WRITE_DATA(0X81);

    sendCMD(0xE8);
    WRITE_DATA(0x85);
    WRITE_DATA(0x10);
    WRITE_DATA(0x7A);

...
u.s.w.

On this place you have to copy/paste the init-sequenz for your display ..
You have an ILI9341(as "Oldmicroguy" mentioned) ..

.. and to rewrite the init-seq
Code: Select allstatic const ucg_pgm_uint8_t ucg_tft_240x320_ili9341_init_seq[] = {
  UCG_CFG_CD(0,1),            /* DC=0 for command mode, DC=1 for data and args */
  UCG_RST(1),               
  UCG_CS(1),               /* disable chip */
  UCG_DLY_MS(5),
  UCG_RST(0),               
  UCG_DLY_MS(5),
  UCG_RST(1),
  UCG_DLY_MS(50),
  UCG_CS(0),               /* enable chip */
 
  UCG_C10(0x011),            /* sleep out */
  UCG_DLY_MS(10),
  //UCG_C10(0x038),            /* idle mode off */
  UCG_C10(0x013),            /* normal display on */

  //UCG_C14(0x0ed, 0x055, 0x001, 0x023, 0x001),    /* power on sequence control (POR values) */
  //UCG_C11(0x0f7, 0x020),       /* pump ratio control (POR value) */
 

  UCG_C10(0x20),             /* not inverted */
  //UCG_C10(0x21),             /* inverted */

  UCG_C11(0x03a, 0x066),       /* set pixel format to 18 bit */
  //UCG_C11(0x03a, 0x055),       /* set pixel format to 16 bit */

  //UCG_C12(0x0b1, 0x000, 0x01b),    /* frame rate control (POR values) */

  UCG_C14(0x0b6, 0x00a, 0x082 | (1<<5), 0x027, 0x000),    /* display function control (POR values, except for shift direction bit) */
 
  //UCG_C11(0x0b7, 0x006),       /* entry mode, bit 0: Low voltage detection control (0=off) */

  UCG_C11(0x0c0, 0x021),       /* power control 1 (reference voltage level), POR=21 */
  UCG_C11(0x0c1, 0x002),       /* power control 2 (step up factor), POR=2 */
  UCG_C11(0x0c7, 0x0c0),       /* VCOM control 2, enable VCOM control 1 */
  UCG_C12(0x0c5, 0x031, 0x03c),    /* VCOM control 1, POR=31,3C */
 
  UCG_C15(0x0cb, 0x039, 0x02c, 0x000, 0x034, 0x002),    /* power control A (POR values) */
  UCG_C13(0x0cf, 0x000, 0x081, 0x030),    /* power control B (POR values) */

  UCG_C13(0x0e8, 0x084, 0x011, 0x07a),    /* timer driving control A (POR values) */

  UCG_C12(0x0ea, 0x066, 0x000),    /* timer driving control B (POR values) */
  //UCG_C12(0x0ea, 0x000, 0x000),       /* timer driving control B  */

  //UCG_C10(0x28),             /* display off */
  //UCG_C11(0x0bf, 0x003),       /* backlight control 8 */
  UCG_C10(0x029),             /* display on */
  //UCG_C11(0x051, 0x07f),       /* brightness */
  //UCG_C11(0x053, 0x02c),       /* control brightness */
  //UCG_C10(0x028),             /* display off */


  UCG_C11( 0x036, 0x008),
 
  UCG_C14(  0x02a, 0x000, 0x000, 0x000, 0x0ef),              /* Horizontal GRAM Address Set */
  UCG_C14(  0x02b, 0x000, 0x000, 0x001, 0x03f),              /* Vertical GRAM Address Set */
  UCG_C10(  0x02c),               /* Write Data to GRAM */

 
  UCG_CS(1),               /* disable chip */
  UCG_END(),               /* end of sequence */
};




-- where UCG_C10 is to replace with sendCMD;
UCG_C11 --> sendCMD(); WRITE_DATA();
UCG_C12 --> sendCMD();WRITE_DATA();WRITE_DATA();
u.s.w.

sorry, -- a lot of writing ..


or you try this:

Code: Select allcase ILI9341_S4P:
   LCD_Write_COM(0x11);//sleep out
   delay(20);
  //LCD_Write_COM(0x01); //reset
  //delay(15);
  LCD_Write_COM(0x28); //display off
  delay(5);
  LCD_Write_COM(0xCF); //power control b
  LCD_Write_DATA(0x00);
  LCD_Write_DATA(0x83); //83 81 AA
  LCD_Write_DATA(0x30);
  LCD_Write_COM(0xED); //power on seq control
  LCD_Write_DATA(0x64); //64 67
  LCD_Write_DATA(0x03);
  LCD_Write_DATA(0x12);
  LCD_Write_DATA(0x81);
  LCD_Write_COM(0xE8); //timing control a
  LCD_Write_DATA(0x85);
  LCD_Write_DATA(0x01);
  LCD_Write_DATA(0x79); //79 78
  LCD_Write_COM(0xCB); //power control a
  LCD_Write_DATA(0x39);
  LCD_Write_DATA(0X2C);
  LCD_Write_DATA(0x00);
  LCD_Write_DATA(0x34);
  LCD_Write_DATA(0x02);
  LCD_Write_COM(0xF7); //pump ratio control
  LCD_Write_DATA(0x20);
  LCD_Write_COM(0xEA); //timing control b
  LCD_Write_DATA(0x00);
  LCD_Write_DATA(0x00);
  LCD_Write_COM(0xC0); //power control 2
  LCD_Write_DATA(0x26); //26 25
  LCD_Write_COM(0xC1); //power control 2
  LCD_Write_DATA(0x11);
  LCD_Write_COM(0xC5); //vcom control 1
  LCD_Write_DATA(0x35);
  LCD_Write_DATA(0x3E);
  LCD_Write_COM(0xC7); //vcom control 2
  LCD_Write_DATA(0xBE); //BE 94
  LCD_Write_COM(0xB1); //frame control
  LCD_Write_DATA(0x00);
  LCD_Write_DATA(0x1B); //1B 70
  LCD_Write_COM(0xB6); //display control
  LCD_Write_DATA(0x0A);
  LCD_Write_DATA(0x82);
  LCD_Write_DATA(0x27);
  LCD_Write_DATA(0x00);
  LCD_Write_COM(0xB7); //emtry mode
  LCD_Write_DATA(0x07);
  LCD_Write_COM(0x3A); //pixel format
  LCD_Write_DATA(0x55); //16bit
  LCD_Write_COM(0x36); //mem access
  LCD_Write_DATA((1<<3)|(1<<6));
  //LCD_Write_DATA((1<<3)|(1<<7)); //rotate 180
  LCD_Write_COM(0x29); //display on
  delay(5);
   //break;


plus this:
Code: Select allmyGLCD.setXY{//case ILI9341_S4P:
   LCD_Write_COM(0x2A); //column
   LCD_Write_DATA(x1>>8);
   LCD_Write_DATA(x1);
   LCD_Write_DATA(x2>>8);
   LCD_Write_DATA(x2);
   LCD_Write_COM(0x2B); //page
   LCD_Write_DATA(y1>>8);
   LCD_Write_DATA(y1);
   LCD_Write_DATA(y2>>8);
   LCD_Write_DATA(y2);
   LCD_Write_COM(0x2C); //write
   }//break;

and this in the setup:
myGLCD.setXY(0, 0, 240, 320); // hinzu
User avatar
By SwiCago
#33173
erhardd wrote:OK, I've put it on my baseboard.
IT WORKS!

Image
See the attached file !


Thanks, I'll try the version you attached. I see it is different than the one on git
https://github.com/esp8266/Arduino/blob ... /TFTv2.cpp

Yours
Code: Select allvoid TFT::TFTinit (void)
{
    pinMode(2, OUTPUT);
    pinMode(4, OUTPUT);
    pinMode(15, OUTPUT);
    SPI.begin();
    SPI.setClockDivider(SPI_CLOCK_DIV2);
   
    TFT_CS_HIGH;
    TFT_DC_HIGH;
    INT8U i=0, TFTDriver=0;
    for(i=0;i<3;i++)
    {
        TFTDriver = readID();
    }
   sendCMD(0x11);//sleep out
   delay(20);
  //sendCMD(0x01); //reset
  //delay(15);
  sendCMD(0x28); //display off
  delay(5);
  sendCMD(0xCF); //power control b


The one on git
Code: Select allvoid TFT::TFTinit (void)
{
    pinMode(2, OUTPUT);
    pinMode(4, OUTPUT);
    pinMode(15, OUTPUT);
    SPI.begin();
    SPI.setClockDivider(SPI_CLOCK_DIV2);
   
    TFT_CS_HIGH;
    TFT_DC_HIGH;
    INT8U i=0, TFTDriver=0;
    for(i=0;i<3;i++)
    {
        TFTDriver = readID();
    }
    delay(500);
    sendCMD(0x01);
    delay(200);

    sendCMD(0xCF);


There could be more differences, but the commented out "reset" and added "sleep out" stuck out at me out...