Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[General] ILI9325 Initialization failed

Status
Not open for further replies.

GURKE

Newbie level 2
Joined
Mar 2, 2016
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
19
Hi guys,
I bought this TFT: **broken link removed**
I think it uses the ILI9325.

Here I found some code to use this display with an atmega32:
https://translate.google.com/transl...t_shield_2_4_atmega32/0-77&edit-text=&act=url

I'am using an AtMega1284p at 16Mhz.

The initialization-routine:
Code:
void LCD_ILI9325_Init(void)
{
    unsigned char i;
    unsigned int f;

	LCD_DATA_OUT;
	LCD_DATA_PORT = 0xFF;
	LCD_CLT_DDR = 0xFF;
	LCD_CS_H;
	LCD_RS_H;
	LCD_WR_H;
	LCD_RD_H;
	LCD_REST_H;

	_delay_ms(50);
	LCD_REST_L;  //??
    _delay_ms(50);
	LCD_REST_H;
    _delay_ms(50);
	

	LCD_WriteReg(0x0001,0x0000);//çåðêàëüíî âåðòèêàëü (0x0100) 
 	LCD_WriteReg(0x0002,0x0700); 
 	LCD_WriteReg(0x0003,0x1030);//ïðåîáðàçîâàíèÿ RGB â GBR, ñòðî÷íîé ðàçâåðòêè 

	 
 	LCD_WriteReg(0x0004,0x0000);//çåðêàëüíî âåðòèêàëü (0x0000) 
 	LCD_WriteReg(0x0008,0x0207);  
 	LCD_WriteReg(0x0009,0x0000);
 	LCD_WriteReg(0x000A,0x0000); 
 	LCD_WriteReg(0x000C,0x0000); 
 	LCD_WriteReg(0x000D,0x0000);
 	LCD_WriteReg(0x000F,0x0000);

	//power on sequence VGHVGL
	//Ïèòàíèÿ íà ïîñëåäîâàòåëüíîñòè VGHVGL
 	LCD_WriteReg(0x0010,0x0000);   
 	LCD_WriteReg(0x0011,0x0007);  
 	LCD_WriteReg(0x0012,0x0000);  
 	LCD_WriteReg(0x0013,0x0000);
	 
	//vgh 
 	LCD_WriteReg(0x0010,0x1290);   
 	LCD_WriteReg(0x0011,0x0227);

 	//vregiout 
 	LCD_WriteReg(0x0012,0x001d);//0x001b

 	//vom amplitude
    // Ïî àìïëèòóäå 
 	LCD_WriteReg(0x0013,0x1500);

 	//vom H
 	LCD_WriteReg(0x0029,0x0018); 
 	LCD_WriteReg(0x002B,0x000D); 

	//gamma
    // Äèàïàçîí 
 	LCD_WriteReg(0x0030,0x0004);
 	LCD_WriteReg(0x0031,0x0307);
 	LCD_WriteReg(0x0032,0x0002);//0006
 	LCD_WriteReg(0x0035,0x0206);
 	LCD_WriteReg(0x0036,0x0408);
 	LCD_WriteReg(0x0037,0x0507); 
 	LCD_WriteReg(0x0038,0x0204);//0200
 	LCD_WriteReg(0x0039,0x0707); 
 	LCD_WriteReg(0x003C,0x0405);//0504
 	LCD_WriteReg(0x003D,0x0F02); 

 	//ram
 	LCD_WriteReg(0x0050,0x0000); 
 	LCD_WriteReg(0x0051,0x00EF);
 	LCD_WriteReg(0x0052,0x0000); 
 	LCD_WriteReg(0x0053,0x013F);  
 	LCD_WriteReg(0x0060,0x2700);//çåðêàëüíî ãîðèçîíòàëü (0xA700) 
 	LCD_WriteReg(0x0061,0x0001); 
 	LCD_WriteReg(0x006A,0x0000); 

 	//
 	LCD_WriteReg(0x0080,0x0000); 
 	LCD_WriteReg(0x0081,0x0000); 
 	LCD_WriteReg(0x0082,0x0000); 
 	LCD_WriteReg(0x0083,0x0000); 
 	LCD_WriteReg(0x0084,0x0000); 
 	LCD_WriteReg(0x0085,0x0000); 

 	//
 	LCD_WriteReg(0x0090,0x0010); 
 	LCD_WriteReg(0x0092,0x0600); 
 	LCD_WriteReg(0x0093,0x0003); 
 	LCD_WriteReg(0x0095,0x0110); 
 	LCD_WriteReg(0x0097,0x0000); 
 	LCD_WriteReg(0x0098,0x0000);
 	LCD_WriteReg(0x0007,0x0133);


    LCD_WriteComand(0x0022);//Start to write to display RAM

    //paint screen red
    for(i=0;i<2;i++)
    {
        for(f=0;f<38400;f++)
        {
            LCD_WriteData(RED);
        }
    }
}

The display starts white and changes to colorfull and flickers. It's not red as i should be.

Please help guys :)
 

The schematic seems as not exactly representing the assembling, as for instance, it do not show the 22pF capacitors apparently mentioned on text of the website, but clearly shown on the PCB picture. In addition, I would also recommend to add some delay at the part of the code that handles control pins of LCD.
 

The schematic seems as not exactly representing the assembling, as for instance, it do not show the 22pF capacitors apparently mentioned on text of the website, but clearly shown on the PCB picture.

I think the schematic should just show the connection between display and µC. Of course I have a 16Mhz Crystal with 2 22pF to GND, 1k between Reset and 3,3V and a 100nF between GND and 3,3V.

In addition, I would also recommend to add some delay at the part of the code that handles control pins of LCD.

I added a few delays:
Code:
void LCD_WriteComand(uint32 regID)
{
	_delay_ms(1);
	LCD_CS_L; 
	LCD_RS_L;
	LCD_RD_H; 
	LCD_WR_H;
	_delay_ms(1);
		
	LCD_DATA_PORT = regID>>8;
	LCD_WR_L;
	_delay_ms(1);
	LCD_WR_H;
	_delay_ms(1);

	LCD_DATA_PORT = regID;
	LCD_WR_L;
	_delay_ms(1);
	LCD_WR_H;
	_delay_ms(1);

	LCD_RS_H;	
	LCD_CS_H;
	_delay_ms(1);

}

void LCD_WriteData(uint32 data)
{
	_delay_ms(1);
	LCD_CS_L;
	LCD_RS_H;
	LCD_RD_H; // *****

	_delay_ms(1);
	LCD_DATA_PORT = data>>8;
	LCD_WR_L;
	_delay_ms(1);
	LCD_WR_H;
	_delay_ms(1);
	
	LCD_DATA_PORT = data;
	LCD_WR_L;
	_delay_ms(1);
	LCD_WR_H;
	_delay_ms(1);

	LCD_CS_H;
	_delay_ms(1);
}

void LCD_WriteReg(uint32 regID, uint32 regData)
{
	_delay_ms(1);
	LCD_CS_L; // *****
	LCD_RS_L;
	LCD_RD_H; // *****
	LCD_WR_H; // *****
		
	_delay_ms(1);
	LCD_DATA_PORT = regID>>8;
	LCD_WR_L;
	_delay_ms(1);
	LCD_WR_H;
	_delay_ms(1);

	LCD_DATA_PORT = regID;
	LCD_WR_L;
	_delay_ms(1);
	LCD_WR_H;
	_delay_ms(1);

	LCD_RS_H;
	_delay_ms(1);

	LCD_DATA_PORT = regData>>8;
	LCD_WR_L;
	_delay_ms(1);
	LCD_WR_H;
	_delay_ms(1);
	
	LCD_DATA_PORT = regData;
	LCD_WR_L;
	_delay_ms(1);
	LCD_WR_H;
	_delay_ms(1);

	LCD_CS_H;
	_delay_ms(1);
}

But i didn't help. After adding the delays the "picture" I get is brighter than without the delays:
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top