LPC1768 + 2.8" TFT ILI9325

OP (Company: Coinel Technology Solutions) #1801209
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

A question of your own? This thread is over 16 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

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.