cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F411RE ILI9225B 8bit parallel interfacing initialization problems

kedopofe kedopofe
Associate II
Posted on December 02, 2017 at 13:54

Hi everyone!

I want to connect 2' OpenSmart TFT LCD display (Image:

http://img.dxcdn.com/productimages/sku_467508_1.jpg

) with a touchscreen on STM32F411RE. Display characteristics are:

- Driver IC: ILI9225

- Touchscreen type: resistive touchscreen.

- Resolution: 176X220, 16-bit (262,000) color

- Logic level: 3.3V;

Display datasheet:

http://www.hpinfotech.ro/ILI9225B.pdf

Connections made: DISPLAY STM GNDGND +3.3V +3.3V CSD0 RSD1 WRD2 RDD3 RST D4 LEDGND DB0A0 DB1 A1 DB2A2 DB3 A3 DB4A4 DB5 A5 DB6 A6 DB7 A7 Part of my code and how it's work

void writeDataLines(uint8_t value)
{
DB0_GPIO->ODR = value;
mWR_LOW
mWR_HIGH
}�?�?�?�?�?�?�?�?�?�?�?�?
uint32_t readDataLines()
{
mRD_LOW
mRD_HIGH
return DB0_GPIO->IDR & 0x00FF;
}
uint16_t ILI9225_ReadRegister(uint8_t reg)
{
uint8_t reg_h=0,reg_l=0;
uint16_t result=0;
mRS_LOW
mCS_LOW
//Send register higher and lower byte
writeDataLines(0x00);
writeDataLines(reg);
//Read register data
readOnDataLines();
mRS_HIGH
reg_h = readDataLines();
reg_l = readDataLines();
mCS_HIGH
writeOnDataLines();
result =((uint16_t)reg_h << 8) | reg_l;
return result;
}
void ILI9225_WriteRegister(uint8_t reg,uint16_t val)
{
mCS_LOW
mRS_LOW
//Send register address
writeDataLines(0x00);
writeDataLines(reg);
mRS_HIGH
//Send register data
writeDataLines(val >> 8);
writeDataLines(val & 0xFF);
mCS_HIGH
}�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

WriteOnDataLines() and ReadOnDataLines() just configures DB0-DB7 pins as input or output. I read successfully ID register (0x00h) with result 0x9225, so display haveanILI9225B controller, excellent. But initialization of display not working. Every time after initialization thescreen is white. Here is code of initialization

/* Reset power control */
ILI9225_WriteRegister(ILI9225_POWER_CTRL1, 0x0000); // Set SAP,DSTB,STB
ILI9225_WriteRegister(ILI9225_POWER_CTRL2, 0x0000); // Set APON,PON,AON,VCI1EN,VC
ILI9225_WriteRegister(ILI9225_POWER_CTRL3, 0x0000); // Set BT,DC1,DC2,DC3
ILI9225_WriteRegister(ILI9225_POWER_CTRL4, 0x0000); // Set GVDD
ILI9225_WriteRegister(ILI9225_POWER_CTRL5, 0x0000); // Set VCOMH/VCOML voltage
MDelay_ms(40);
/* Power-on sequence */
ILI9225_WriteRegister(ILI9225_POWER_CTRL2, 0x0018); // Set APON,PON,AON,VCI1EN,VC
ILI9225_WriteRegister(ILI9225_POWER_CTRL3, 0x6121); // Set BT,DC1,DC2,DC3
ILI9225_WriteRegister(ILI9225_POWER_CTRL4, 0x006F); // Set GVDD /*007F 0088 */
ILI9225_WriteRegister(ILI9225_POWER_CTRL5, 0x495F); // Set VCOMH/VCOML voltage
ILI9225_WriteRegister(ILI9225_POWER_CTRL1, 0x0800); // Set SAP,DSTB,STB
MDelay_ms(10);
ILI9225_WriteRegister(ILI9225_POWER_CTRL2, 0x103B); // Set APON,PON,AON,VCI1EN,VC
MDelay_ms(50);
/* Configure display */
ILI9225_WriteRegister(ILI9225_DRIVER_OUTPUT_CTRL, 0x011C); // Set the display line number and display direction
ILI9225_WriteRegister(ILI9225_LCD_AC_DRIVING_CTRL, 0x0100); // Set 1 line inversion
ILI9225_WriteRegister(ILI9225_ENTRY_MODE, 0x1030); // Set GRAM write direction and BGR=1.
ILI9225_WriteRegister(ILI9225_DISP_CTRL1, 0x0000); // Display off
ILI9225_WriteRegister(ILI9225_BLANK_PERIOD_CTRL1, 0x0808); // Set the back porch and front porch
ILI9225_WriteRegister(ILI9225_FRAME_CYCLE_CTRL, 0x1100); // Set the clocks number per line
ILI9225_WriteRegister(ILI9225_INTERFACE_CTRL, 0x0000); // CPU interface
ILI9225_WriteRegister(ILI9225_OSC_CTRL, 0x0D01); // Set Osc /*0e01*/
MDelay_ms(10);
ILI9225_WriteRegister(ILI9225_VCI_RECYCLING, 0x0020); // Set VCI recycling
ILI9225_WriteRegister(ILI9225_RAM_ADDR_SET1, 0x0000); // Set RAM Address
ILI9225_WriteRegister(ILI9225_RAM_ADDR_SET2, 0x0000); // Set RAM Address
/* Set GRAM area */
ILI9225_WriteRegister(ILI9225_GATE_SCAN_CTRL, 0x0000); // Set full display scan
ILI9225_WriteRegister(ILI9225_VERTICAL_SCROLL_CTRL1, 0x0000); // Turn off vertical scroll
ILI9225_WriteRegister(ILI9225_VERTICAL_SCROLL_CTRL2, 0x0000);
ILI9225_WriteRegister(ILI9225_VERTICAL_SCROLL_CTRL3, 0x0000);
ILI9225_WriteRegister(ILI9225_PARTIAL_DRIVING_POS1, 0x00DB);
ILI9225_WriteRegister(ILI9225_PARTIAL_DRIVING_POS2, 0x0000);
//Set full screen window
ILI9225_WriteRegister(ILI9225_HORIZONTAL_WINDOW_ADDR1, 0x00AF); //Window horizontal end address
ILI9225_WriteRegister(ILI9225_HORIZONTAL_WINDOW_ADDR2, 0x0000); //Window horizontal start address
ILI9225_WriteRegister(ILI9225_VERTICAL_WINDOW_ADDR1, 0x00DB); //Window vertical end address
ILI9225_WriteRegister(ILI9225_VERTICAL_WINDOW_ADDR2, 0x0000); //Window vertical start address
/* Set GAMMA curve */
// Gamma for positive polarity
ILI9225_WriteRegister(ILI9225_GAMMA_CTRL1, 0x0000);
ILI9225_WriteRegister(ILI9225_GAMMA_CTRL2, 0x0808);
ILI9225_WriteRegister(ILI9225_GAMMA_CTRL3, 0x080A);
// Gradient for positive polarity
ILI9225_WriteRegister(ILI9225_GAMMA_CTRL4, 0x000A);
// Gama for negative polarity
ILI9225_WriteRegister(ILI9225_GAMMA_CTRL5, 0x0A08);
ILI9225_WriteRegister(ILI9225_GAMMA_CTRL6, 0x0808);
ILI9225_WriteRegister(ILI9225_GAMMA_CTRL7, 0x0000);
// Gradient for negative polarity
ILI9225_WriteRegister(ILI9225_GAMMA_CTRL8, 0x0A00);
// Amplitude adj. for pos. polarity
ILI9225_WriteRegister(ILI9225_GAMMA_CTRL9, 0x0710);
//Amplitude adj. for neg. polarity
ILI9225_WriteRegister(ILI9225_GAMMA_CTRL10, 0x0710);
/* Turn on display */
//Prepare panel by setting black color on normally black panel or white on norm. white panel
ILI9225_WriteRegister(ILI9225_DISP_CTRL1, 0x0012);
MDelay_ms(50);
//Turn on display
ILI9225_WriteRegister(ILI9225_DISP_CTRL1, 0x1017);�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

Could someone help me, what could go wrong? I checked with logic analyzer signals while writing data into register but everything was like in datasheet. Sometimes display color changes to dark gray but after restarting its white again.

#ili9225b #stm32f411re #i8080 #interface-display #tft
2 REPLIES 2
Posted on December 02, 2017 at 14:46

You say you are able to read back the ID register - so try to read back other registers after you've written them.

Double-check you register number definitions, too.

JW

kedopofe kedopofe
Associate II
Posted on December 03, 2017 at 10:17

Hi Waclawek,

I tried your suggestion and had one register definition which does not exist on the ILI9225B IC, searched a little bit and found that whole initialization routine was wrong because it was for ILI9225G IC which is a little bit different. Also, many registers are write-only, I tried to write into one of them 0x55 (1010101) just to see what I will read, but read results was totally random. I'll try to change setup routine and see what will happen, for now, display is still white