How to initialize SD1289 LCD TFT

lcdmicrocontrollertft

Friends,

I've tried to initiate TFT LCD with chipset SD1289,
Photo of the result :
TFT result

Init code that I've written

    void Lcd_Write_Com( int  DH)     //ÃüÁî
    {   
        LCD_RS=0;
        LCD_CS =0;   
        LCD_DataPortH=DH>>8;    
        LCD_DataPortL=DH;       
        LCD_WR=0;
        LCD_WR=1;
        LCD_CS =1;  
    }

    void Lcd_Write_Data(int DH) //Êý¾Ý  
    {
        LCD_RS=1;
        LCD_CS =0;                  
        LCD_DataPortH=DH>>8;    
        LCD_DataPortL=DH;                   
        LCD_WR=0;
        LCD_WR=1;
        LCD_CS =1;  
    }



void main_init(void)
{


  LCD_RS = 1;
  LCD_WR = 1;
  LCD_RD = 1;
  LCD_CS = 1;
  LCD_REST = 0;

    //P1 = 0xFF;
    delayms(100);
    LCD_REST = 1;
    P2 = 0x00;
    delayms(20);
    P3 = 0x00;
    delayms(20);
   // Start screen initialisation

   Lcd_Write_Com(OSC_START);          //Start Oscillation
   Lcd_Write_Data(0x00);
   Lcd_Write_Data(0x01);
   delayms(30);
   Lcd_Write_Com(DRIVER_OUT);            //Driver Output Control
   Lcd_Write_Data(0x23);
   Lcd_Write_Data(0x3F);
    delayms(30);
   Lcd_Write_Com(LCD_DRIVE_AC);       //LCD Drive AC Control
   Lcd_Write_Data(0x06);
   Lcd_Write_Data(0x00);
   delayms(30);
   Lcd_Write_Com(POWER_CONTROL1);     //Power Control (1)
   Lcd_Write_Data(0xA8);
   Lcd_Write_Data(0xA6);
   delayms(30);
   Lcd_Write_Com(DISPLAY_CONTROL);    //Display Control
   Lcd_Write_Data(0x00);
   Lcd_Write_Data(0x33);
   delayms(30);
   Lcd_Write_Com(POWER_CONTROL2);     //Power Control (2)
   Lcd_Write_Data(0x00);
   Lcd_Write_Data(0x05);
   delayms(30);
   Lcd_Write_Com(POWER_CONTROL3);     //Power Control (3)
   Lcd_Write_Data(0x30);
   Lcd_Write_Data(0x0B);
   delayms(30);
   Lcd_Write_Com(POWER_CONTROL4);     //Power Control (4)
   Lcd_Write_Data(0x20);
   Lcd_Write_Data(0x00);
   delayms(30);

   Lcd_Write_Com(ENTRY_MODE);         //Set Display color mode for 65k color
   Lcd_Write_Data(0x68);
   Lcd_Write_Data(0x30);
   delayms(30);
      Lcd_Write_Com(SLEEP_MODE);         //Exit Sleep Mode
   Lcd_Write_Data(0x00);
   Lcd_Write_Data(0x00);
   delayms(30);                //delay 30ms

   Lcd_Write_Com(POWER_CONTROL5);     //Power Control (5)
   Lcd_Write_Data(0x00);
   Lcd_Write_Data(0xA8);
   delayms(30);
   Lcd_Write_Com(HORIZONTAL_RAM_START);   //Horizontal RAM address position start/end setup
   Lcd_Write_Data(0xEF);                  //decimal 239
   Lcd_Write_Data(0x00);                  //decimal 0, i.e. horizontal ranges from 0 -> 239
   delayms(30);                                 //POR value is 0xEF00 anyway. This address must be set before RAM write

   Lcd_Write_Com(VERTICAL_RAM_START);     //Vertical RAM address start position setting
   Lcd_Write_Data(0x00);                  //0x0000 = decimal 0
   Lcd_Write_Data(0x00);
   delayms(30);
   Lcd_Write_Com(VERTICAL_RAM_END);       //Vertical RAM address end position setting
   Lcd_Write_Data(0x01);                  //0x013F = decimal 319
   Lcd_Write_Data(0x3F);
   delayms(30);
   Lcd_Write_Com(RAM_WRITE);              //Commande d'ecriture dans la Memoire ecran

   LCD_CLS(BLANC);                  //send blank  (mode 16 Bits)
}

datasheet of SD1289

http://www.gpegint.com/files/library/files/supportpdf/Driver%20IC%20SSD1289.pdf

Best Answer

I didn't spent a lot of time reading datasheet that you pointed, but I noticed some points which doesn't fit to your code.

  1. Are you sure you have good communication with SD1289? Please try to read IR register (0x00). According to datasheet (p.27) it should gives you value 0x8989. It's device ID. If you don't get this value, that means you don't have good connection with device and init procedure will not be performed.

  2. If you able to read device ID, check if writing also works. Write something, then read it and compare. For test you can use 0x4F register (Set GDDRAM Y addr)

  3. In my opinion it seems that your read/write functions are incomplete. Please look at page 21. Pin E is used as clock signal for MPU parallel interface. In your functions I see only R/W#, CS# and D/C# (you called it RS?) signals. I don't see the clock. Another issue is data width. You are writing/reading 16 bits (probably) while interface is 18-bit. Have you set remaining 2 bits to any defined value?

  4. Initialization sequence - it looks bit different in datasheet than in your code. Please refer to page 72. _ 1st step in manual - Reg 0x07 = 0x0021, and you starting OSC, and then writing 0x0023 to R0x07.

Related Topic