Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Jamiro14
PostPosted: Jul 19, 2012 - 06:09 PM
Rookie


Joined: Feb 14, 2011
Posts: 22


Hi.

I'm currently using a LCD with this driver, ILI9341 and I'm trying to interface it in 8080 16-bit mode.

Does anyone has a library or at least some initialization routine working?

Thank you.
 
 View user's profile Send private message  
Reply with quote Back to top
bobgardner
PostPosted: Jul 19, 2012 - 07:24 PM
10k+ Postman


Joined: Sep 04, 2002
Posts: 21257
Location: Orlando Florida

Its in the Atmel Software foundation! Must be a UC3 board with that controller.

_________________
Imagecraft compiler user
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
js
PostPosted: Jul 19, 2012 - 11:50 PM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20353
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

2nd hit on google https://bitbucket.org/fabienroyer/nwaze ... /ILI9341.c

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
abcminiuser
PostPosted: Jul 20, 2012 - 07:44 AM
Moderator


Joined: Jan 23, 2004
Posts: 9825
Location: Trondheim, Norway

Quote:

Its in the Atmel Software foundation! Must be a UC3 board with that controller.


Actually it's working with SAM, UC3 and XMEGA controllers. The driver is designed to be SPI compatible only, but you can probably just alter the byte write routine for parallel interface writes.

- Dean Twisted Evil

_________________
Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
Jamiro14
PostPosted: Jul 20, 2012 - 09:41 AM
Rookie


Joined: Feb 14, 2011
Posts: 22


Thank you for your answers, but I had already tried those libraries without success. Sad

I have no idea what I'm doing wrong. I have already used some LCDs in the past but this one doesn't want to do its job. Confused
 
 View user's profile Send private message  
Reply with quote Back to top
abcminiuser
PostPosted: Jul 20, 2012 - 10:15 AM
Moderator


Joined: Jan 23, 2004
Posts: 9825
Location: Trondheim, Norway

It's an absolute PAIN of a controller, it took me many iterations to get it to actually work. Have you checked the configuration lines to the controller to ensure its in the correct mode? Do you get any activity at all?

- Dean Twisted Evil

_________________
Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
Jamiro14
PostPosted: Jul 20, 2012 - 10:47 AM
Rookie


Joined: Feb 14, 2011
Posts: 22


The only activity I'm getting is when i turn the backlight on. Laughing

When you say configuration lines you're talking about IM[0..3] pins right? I'm not sure as I only have access to IM0.

Right now I'm trying to convert the ASF library from serial to parallel. If I'm successful i'll post it here.
 
 View user's profile Send private message  
Reply with quote Back to top
meslomp
PostPosted: Jul 20, 2012 - 11:46 AM
Raving lunatic


Joined: May 02, 2007
Posts: 3010
Location: Nieuwegein, Netherlands

why not use serial to see if it works all together? then convert to parallel...
at this point you probably do not even know the display works at all....

and what controller are you actually using? that could also trigger more direct questions on you version of the code.

regards

_________________
1)Datasheet and application notes checked?
2)tutorial forum
3)Newbie start here
 
 View user's profile Send private message  
Reply with quote Back to top
Jamiro14
PostPosted: Jul 20, 2012 - 12:47 PM
Rookie


Joined: Feb 14, 2011
Posts: 22


I'm using an ATxmega 128A1 but I don't have access to the serial pins only the parallel ones, so I can't use serial to test if the display is working. Sad
 
 View user's profile Send private message  
Reply with quote Back to top
abcminiuser
PostPosted: Jul 20, 2012 - 01:04 PM
Moderator


Joined: Jan 23, 2004
Posts: 9825
Location: Trondheim, Norway

Yes, you need to know what the other IMx pins are connected to - otherwise the controller may be in a completely different state than what you think it is.

- Dean Twisted Evil

_________________
Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
Jamiro14
PostPosted: Jul 26, 2012 - 04:20 PM
Rookie


Joined: Feb 14, 2011
Posts: 22


I've decided to use 8-bit mode instead of 16-bit, although I'm not seeing any interaction in both modes.

Is there anyone who has access to this LCD and can test my code? I'm not sure what I'm doing wrong. Thank you.

Code:

void TFT_WriteCommand(unsigned char commandToWrite )
{   
   RD_HIGH;           
   COMMAND_MODE;           
   CS_LOW;   
   WR_LOW;       
   
   _delay_us(WAIT_TIME);   
      
   LSB_PORT = commandToWrite;   
   _delay_us(WAIT_TIME);   
                           
   WR_HIGH;                     
   DATA_MODE;           
}

void TFT_WriteData( unsigned char dataToWrite )
{
   RD_HIGH;              
   DATA_MODE;   
   CS_LOW;             
   WR_LOW;   
   
   _delay_us(WAIT_TIME);   
   LSB_PORT= dataToWrite;    
   _delay_us(WAIT_TIME);
                                 
   WR_HIGH;   


void TFT_Init(void)
{   
   // VCI=2.8V
//************* Reset LCD Driver ****************//
    //Hardware reset
   RST_HIGH;
   _delay_ms(200);    
   RST_LOW;
   _delay_ms(200);     
   RST_HIGH;
   _delay_ms(200); 
   
   //Software Reset
   TFT_WriteCommand(0x01);
   CS_HIGH;
   _delay_ms(1000);        
//************* Start Initial Sequence **********//
   //Power control A
   TFT_WriteCommand(0xCB); 
   TFT_WriteData(0x39);
   TFT_WriteData(0x2C);
   TFT_WriteData(0x00);
   TFT_WriteData(0x34);
   TFT_WriteData(0x02);
   CS_HIGH;
 
   //Power control A
   TFT_WriteCommand(0xCF); 
   TFT_WriteData(0x00);
   TFT_WriteData(0XC1);
   TFT_WriteData(0X30);
   CS_HIGH;
 
   //Driver timing control A
   TFT_WriteCommand(0xE8); 
   TFT_WriteData(0x85);
   TFT_WriteData(0x00);
   TFT_WriteData(0x78);
   CS_HIGH;
 
   //Driver timing control B
   TFT_WriteCommand(0xEA); 
   TFT_WriteData(0x00);
   TFT_WriteData(0x00);
   CS_HIGH;
 
   //Power on sequence control
   TFT_WriteCommand(0xED); 
   TFT_WriteData(0x64);
   TFT_WriteData(0x03);
   TFT_WriteData(0X12);
   TFT_WriteData(0X81);
   CS_HIGH;
   
   //Pump ratio control
   TFT_WriteCommand(0xF7); 
   TFT_WriteData(0x20);
   CS_HIGH;
 
   //Power Control 1
   TFT_WriteCommand(0xC0);    
   TFT_WriteData(0x23);
   CS_HIGH;   
   
   //Power Control 2
   TFT_WriteCommand(0xC1);
   TFT_WriteData(0x10); 
   CS_HIGH;
   
   //VCOM Control 1
   TFT_WriteCommand(0xC5); 
   TFT_WriteData(0x2B);
   TFT_WriteData(0x2B);
   CS_HIGH;    
 
   //Memory Access Control
   TFT_WriteCommand(0x36);
   TFT_WriteData(0x48);
   CS_HIGH;
 
   //Frame Rate Control (In Normal Mode/Full Colors)
   TFT_WriteCommand(0xB1);
   TFT_WriteData(0x00); 
   TFT_WriteData(0x1B);
   CS_HIGH;
 
   //Display Function Control
   TFT_WriteCommand(0xB6);
   TFT_WriteData(0x0A);
   TFT_WriteData(0x02);
   CS_HIGH;
   
   //Enable 3G
   TFT_WriteCommand(0xF2); 
   TFT_WriteData(0x02);
   CS_HIGH;
   
   //COLMOD: Pixel Format Set
   TFT_WriteCommand(0x3a); 
   TFT_WriteData(0x05);
   CS_HIGH;
   
   //Gamma Set
   TFT_WriteCommand(0x26);
   TFT_WriteData(0x01);
   CS_HIGH;
 
   //Positive Gamma Correction
   TFT_WriteCommand(0xE0); 
   TFT_WriteData(0x0F);
   TFT_WriteData(0x31);
   TFT_WriteData(0x2B);
   TFT_WriteData(0x0C);
   TFT_WriteData(0x0E);
   TFT_WriteData(0x08);
   TFT_WriteData(0x4E);
   TFT_WriteData(0xF1);
   TFT_WriteData(0x37);
   TFT_WriteData(0x07);
   TFT_WriteData(0x10);
   TFT_WriteData(0x03);
   TFT_WriteData(0x0E);
   TFT_WriteData(0x09);
   TFT_WriteData(0x00);
   CS_HIGH;
 
   //Negative Gamma Correction
   TFT_WriteCommand(0XE1);
   TFT_WriteData(0x00);
   TFT_WriteData(0x0E);
   TFT_WriteData(0x14);
   TFT_WriteData(0x03);
   TFT_WriteData(0x11);
   TFT_WriteData(0x07);
   TFT_WriteData(0x31);
   TFT_WriteData(0xC1);
   TFT_WriteData(0x48);
   TFT_WriteData(0x08);
   TFT_WriteData(0x0F);
   TFT_WriteData(0x0C);
   TFT_WriteData(0x31);
   TFT_WriteData(0x36);
   TFT_WriteData(0x0F);
   CS_HIGH;   
 
   // Sleep Out
   TFT_WriteCommand(0x11); 
   CS_HIGH;   
   _delay_ms(120);
   
    //Display On
   TFT_WriteCommand(0x29);
   CS_HIGH;
}

void TFT_DrawPixel(uint16_t x, uint16_t y, uint16_t color)
{
   TFT_SetWindow(x, x, y, y);
   TFT_WriteData((unsigned char )((color>>8)&0xff));
   TFT_WriteData((unsigned char )(color&0xff));
   
   CS_HIGH;
}

void TFT_SetWindow(unsigned short x0, unsigned short y0,
               unsigned short x1, unsigned short y1)
{
   TFT_WriteCommand(ILI9341_CMD_COLUMN_ADDRESS_SET);
   TFT_WriteData((x0 >> 8) & 0xFF);
   TFT_WriteData(x0 & 0xFF);
   TFT_WriteData((y0 >> 8) & 0xFF);
   TFT_WriteData(y0 & 0xFF);
   CS_HIGH;
   
   TFT_WriteCommand(ILI9341_CMD_PAGE_ADDRESS_SET);
   TFT_WriteData((x1 >> 8) & 0xFF);
   TFT_WriteData(x1 & 0xFF);
   TFT_WriteData((y1 >> 8) & 0xFF);
   TFT_WriteData(y1 & 0xFF);
   CS_HIGH;
   
   TFT_WriteCommand(ILI9341_CMD_MEMORY_WRITE);
   CS_HIGH;
}

 
 View user's profile Send private message  
Reply with quote Back to top
Jamiro14
PostPosted: Aug 03, 2012 - 11:19 AM
Rookie


Joined: Feb 14, 2011
Posts: 22


I've discovered my problem, it was a faulty LCD Shocked.

As promised here is a simple initialization and a draw pixel function in 8080 16-bit mode.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits