This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC1768 + 2.8" TFT ILI9325

Hello all,

I have an LCD module TM240320B9NFWUGWC and it has inbuilt ILI9325
controller.
MPU-Interface Mode is through 8-bit parallel interface.

I'm trying to read its device code but its not working, I always
getting 0x0000. If any body can help on this, that will be very
appreciated.

My code is as follow
------------------------------------------------------------------
void TSLCDInit(void) //initial LCD
{ TSLCDOutIns(TS_INS_START_OSC);
driver_code = TSLCDInDat();
if (driver_code == 0x9320) //ILI9320
{ TSLCDInit9320();
} else if (driver_code == 0x9325) //ILI9325
{ TSLCDInit9325();
} }
--------------------------------------------------------------------
But I am getting driver_code = 0x0000

And my write command, write data and read data as follow

void TSLCDOutIns(unsigned short ins) //write instruction to LCD
{ LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4);
LPC_GPIO0->FIODIR |= LCD_DATA_MASK;

LCD_CS_LOW();
LCD_RS_LOW();
LCD_RD_HIGH();

LCD_WR_HIGH();
LCD_WR_LOW();
delay_ms(1);
LPC_GPIO0->FIOPIN &= ~LCD_DATA_MASK;
LCD_WR_HIGH();

LCD_WR_LOW();
delay_ms(1);
LPC_GPIO0->FIOPIN |= ins<<2;
LCD_WR_HIGH();

delay_ms(1);
}

void TSLCDOutDat(unsigned short dat) //write data to LCD
{ LCD_RS_HIGH();
LCD_RD_HIGH();
LCD_WR_LOW();

LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4);
LPC_GPIO0->FIODIR |= LCD_DATA_MASK;
LPC_GPIO0->FIOCLR = LCD_DATA_MASK;
LPC_GPIO0->FIOSET = (dat >> 8 ) << 2;

LCD_CS_LOW();
LCD_CS_HIGH();

LPC_GPIO0->FIOCLR = LCD_DATA_MASK;
LPC_GPIO0->FIOSET = dat << 2;

LCD_CS_LOW();
LCD_CS_HIGH();
LCD_WR_HIGH();

LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4);
LPC_GPIO0->FIODIR &= ~LCD_DATA_MASK;
}

unsigned short TSLCDInDat(void) //read data from LCD
{ unsigned short retval = 0;

LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4);
LPC_GPIO0->FIODIR &= ~LCD_DATA_MASK;

LCD_CS_LOW();
LCD_RS_HIGH();

LCD_RD_LOW();
delay_ms(1);
retval = (LPC_GPIO0->FIOPIN & LCD_DATA_MASK);
LCD_RD_HIGH();
delay_ms(1);

LCD_RD_LOW();
delay_ms(1);
retval = (retval << 8 ) | (LPC_GPIO0->FIOPIN & LCD_DATA_MASK);
LCD_RD_HIGH();
delay_ms(1);

LCD_CS_HIGH();

return retval;
}

Note: For data lines I am using P0.2 to P0.9 and that's why I am
shifting 'ins' and 'dat' left by 2.

-Prakash
9886545216

Parents
  • Hello Per Westermark,

    Thanks for your suggestion:)

    Resending my previous mail...

    I have an LCD module TM240320B9NFWUGWC and it has inbuilt ILI9325
    controller.
    MPU-Interface Mode is through 8-bit parallel interface.

    I'm trying to read its device code but its not working, I always
    getting 0x0000. If any body can help on this, that will be very
    appreciated.

    My code is as follow

    void TSLCDInit(void) //initial LCD
    {
      TSLCDOutIns(TS_INS_START_OSC);
      driver_code = TSLCDInDat();
      if (driver_code == 0x9320) //ILI9320
      {
        TSLCDInit9320();
      }
      else if (driver_code == 0x9325) //ILI9325
      {
        TSLCDInit9325();
      }
    }
    

    But I am getting driver_code = 0x0000

    And my write command, write data and read data functions as follow

    void TSLCDOutIns(unsigned short ins) //write instruction to LCD
    {
    LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4);
    LPC_GPIO0->FIODIR |= LCD_DATA_MASK;
    
    LCD_CS_LOW();
    LCD_RS_LOW();
    LCD_RD_HIGH();
    
    LCD_WR_HIGH();
    LCD_WR_LOW();
    delay_ms(1);
    LPC_GPIO0->FIOPIN &= ~LCD_DATA_MASK;
    LCD_WR_HIGH();
    
    LCD_WR_LOW();
    delay_ms(1);
    LPC_GPIO0->FIOPIN |= ins<<2;
    LCD_WR_HIGH();
    
    delay_ms(1);
    }
    
    void TSLCDOutDat(unsigned short dat) //write data to LCD
    {
    LCD_RS_HIGH();
    LCD_RD_HIGH();
    LCD_WR_LOW();
    
    LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4);
    LPC_GPIO0->FIODIR |= LCD_DATA_MASK;
    LPC_GPIO0->FIOCLR = LCD_DATA_MASK;
    LPC_GPIO0->FIOSET = (dat >> 8 ) << 2;
    
    LCD_CS_LOW();
    LCD_CS_HIGH();
    
    LPC_GPIO0->FIOCLR = LCD_DATA_MASK;
    LPC_GPIO0->FIOSET = dat << 2;
    
    LCD_CS_LOW();
    LCD_CS_HIGH();
    LCD_WR_HIGH();
    
    LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4);
    LPC_GPIO0->FIODIR &= ~LCD_DATA_MASK;
    }
    
    unsigned short TSLCDInDat(void) //read data from LCD
    {
    unsigned short retval = 0;
    
    LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4);
    LPC_GPIO0->FIODIR &= ~LCD_DATA_MASK;
    
    LCD_CS_LOW();
    LCD_RS_HIGH();
    
    LCD_RD_LOW();
    delay_ms(1);
    retval = (LPC_GPIO0->FIOPIN & LCD_DATA_MASK);
    LCD_RD_HIGH();
    delay_ms(1);
    
    LCD_RD_LOW();
    delay_ms(1);
    retval = (retval << 8 ) | (LPC_GPIO0->FIOPIN & LCD_DATA_MASK);
    LCD_RD_HIGH();
    delay_ms(1);
    
    LCD_CS_HIGH();
    
    return retval;
    }
    
    

    Note: For data lines I am using P0.2 to P0.9 and that's why I am
    shifting 'ins' and 'dat' left by 2.

    -Prakash
    9886545216

Reply
  • Hello Per Westermark,

    Thanks for your suggestion:)

    Resending my previous mail...

    I have an LCD module TM240320B9NFWUGWC and it has inbuilt ILI9325
    controller.
    MPU-Interface Mode is through 8-bit parallel interface.

    I'm trying to read its device code but its not working, I always
    getting 0x0000. If any body can help on this, that will be very
    appreciated.

    My code is as follow

    void TSLCDInit(void) //initial LCD
    {
      TSLCDOutIns(TS_INS_START_OSC);
      driver_code = TSLCDInDat();
      if (driver_code == 0x9320) //ILI9320
      {
        TSLCDInit9320();
      }
      else if (driver_code == 0x9325) //ILI9325
      {
        TSLCDInit9325();
      }
    }
    

    But I am getting driver_code = 0x0000

    And my write command, write data and read data functions as follow

    void TSLCDOutIns(unsigned short ins) //write instruction to LCD
    {
    LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4);
    LPC_GPIO0->FIODIR |= LCD_DATA_MASK;
    
    LCD_CS_LOW();
    LCD_RS_LOW();
    LCD_RD_HIGH();
    
    LCD_WR_HIGH();
    LCD_WR_LOW();
    delay_ms(1);
    LPC_GPIO0->FIOPIN &= ~LCD_DATA_MASK;
    LCD_WR_HIGH();
    
    LCD_WR_LOW();
    delay_ms(1);
    LPC_GPIO0->FIOPIN |= ins<<2;
    LCD_WR_HIGH();
    
    delay_ms(1);
    }
    
    void TSLCDOutDat(unsigned short dat) //write data to LCD
    {
    LCD_RS_HIGH();
    LCD_RD_HIGH();
    LCD_WR_LOW();
    
    LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4);
    LPC_GPIO0->FIODIR |= LCD_DATA_MASK;
    LPC_GPIO0->FIOCLR = LCD_DATA_MASK;
    LPC_GPIO0->FIOSET = (dat >> 8 ) << 2;
    
    LCD_CS_LOW();
    LCD_CS_HIGH();
    
    LPC_GPIO0->FIOCLR = LCD_DATA_MASK;
    LPC_GPIO0->FIOSET = dat << 2;
    
    LCD_CS_LOW();
    LCD_CS_HIGH();
    LCD_WR_HIGH();
    
    LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4);
    LPC_GPIO0->FIODIR &= ~LCD_DATA_MASK;
    }
    
    unsigned short TSLCDInDat(void) //read data from LCD
    {
    unsigned short retval = 0;
    
    LPC_PINCON->PINSEL0 &= ~(0xFFFF<<4);
    LPC_GPIO0->FIODIR &= ~LCD_DATA_MASK;
    
    LCD_CS_LOW();
    LCD_RS_HIGH();
    
    LCD_RD_LOW();
    delay_ms(1);
    retval = (LPC_GPIO0->FIOPIN & LCD_DATA_MASK);
    LCD_RD_HIGH();
    delay_ms(1);
    
    LCD_RD_LOW();
    delay_ms(1);
    retval = (retval << 8 ) | (LPC_GPIO0->FIOPIN & LCD_DATA_MASK);
    LCD_RD_HIGH();
    delay_ms(1);
    
    LCD_CS_HIGH();
    
    return retval;
    }
    
    

    Note: For data lines I am using P0.2 to P0.9 and that's why I am
    shifting 'ins' and 'dat' left by 2.

    -Prakash
    9886545216

Children