LPC1768 + 2.8" TFT ILI9325

OP (Company: Coinel Technology Solutions) #1801209
Rate this post
• ▲ useful
▼ not useful
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

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.