I used simulate IO method also.
The main thing is that the my stm32 board uses different port for LCD date then default source code.
In default source code it uses whole Port_B for LCD data however my board used following port pins for LCD data.
LCD => D15 D14 D13 D12 D11 D10 D09 D08 D07 D06 D05 D04 D03 D02 D01 D00
STM32 Board => PD10 PD09 PD08 PE15 PE14 PE13 PE12 PE11 PE10 PE09 PE08 PE07 PD01 PD00 PD15 PD14
I also modified the code according to my board IO but still something is missing.
In LCD.C file I modified following things/*******************************************************************************
* Function Name : LCD_Configuration
* Description : Configure the LCD Control pins and FSMC Parallel interface
* Input : None
* Output : None
* Return : None
* Attention : None
*******************************************************************************/
static void LCD_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/* Enable GPIOC and GPIOE clocks */
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE);
/* PE.00(D0), PE.01(D1), PE.02(D2), PE.03(D3), PE.04(D4), PE.05(D5), PE.06(D6), PE.07(D7), PE.08(D8)
PE.09(D9), PE.10(D10), PE.11(D11), PE.12(D12), PE.13(D13), PE.14(D14), PE.15(D15) */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOD, &GPIO_InitStructure);
/* PC.0(RST), PC.1(WR), PC.2(RD) , PC.6(CS), PC.7(RS)*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOE, &GPIO_InitStructure);
}
/*******************************************************************************
* Function Name : LCD_WriteReg
* Description :
* Input : - index:
* Output : None
* Return : None
* Attention : None
*******************************************************************************/
__inline void LCD_WriteIndex(uint16_t index)
{
uint16_t value_d, value_e;
GPIOD->CRH = 0x33343333;
GPIOD->CRL = 0x34334433;
value_d = GPIOD->IDR;
GPIOE->CRH = 0x33333333;
GPIOE->CRL = 0x34444434;
value_e = GPIOE->IDR;
Clr_Rs;
Set_nRd;
LCD_Delay(0);
GPIOD->ODR = (value_d & 0x104C) | (((index << 14) & 0xC000) | ((index >> 5) & 0x0700) | ((index >> 2) & 0x0003));
GPIOE->ODR = (value_e & 0x007D) | (((index << 3) & 0xFF80));
LCD_Delay(0);
Clr_nWr;
Set_nWr;
}
/*******************************************************************************
* Function Name : LCD_WriteReg
* Description :
* Input : - index:
* Output : None
* Return : None
* Attention : None
*******************************************************************************/
__inline void LCD_WriteData(uint16_t data)
{
uint16_t value_d, value_e;
GPIOD->CRH = 0x33343333;
GPIOD->CRL = 0x34334433;
value_d = GPIOD->IDR;
GPIOE->CRH = 0x33333333;
GPIOE->CRL = 0x34444443;
value_e = GPIOE->IDR;
Set_Rs;
LCD_Delay(0);
GPIOD->ODR = (value_d & 0x104C) | (((data << 14) & 0xC000) | ((data >> 5) & 0x0700) | ((data >> 2) & 0x0003));
GPIOE->ODR = (value_e & 0x007D) | (((data << 3) & 0xFF80));
LCD_Delay(0);
Clr_nWr;
Set_nWr;
}
/*******************************************************************************
* Function Name : LCD_ReadData
* Description :
* Input : None
* Output : None
* Return :
* Attention : None
*******************************************************************************/
__inline uint16_t LCD_ReadData(void)
{
uint16_t value,value_d, value_e;
Set_Rs;
Set_nWr;
Clr_nRd;
/*
PE.00(D0), PE.01(D1), PE.02(D2), PE.03(D3), PE.04(D4), PE.05(D5), PE.06(D6), PE.07(D7), PE.08(D8)
PE.09(D9), PE.10(D10), PE.11(D11), PE.12(D12), PE.13(D13), PE.14(D14), PE.15(D15) */
/*
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOE, &GPIO_InitStructure);
*/
GPIOD->CRH = 0x33343333;
GPIOD->CRL = 0x34334433;
GPIOE->CRH = 0x33333333;
GPIOE->CRL = 0x34444434;
/*
value = GPIO_ReadInputData(GPIOE);
value = GPIO_ReadInputData(GPIOE);
*/
value_d = GPIOD->IDR;
value_e = GPIOE->IDR;
value = ((((value_d >> 14) & 0x0003) | ((value_d << 5) & 0xE000) | ((value_d << 2) & 0x000C)) & 0xC703) | ((value_e >> 3) & 0x1FF0);
/*
PE.00(D0), PE.01(D1), PE.02(D2), PE.03(D3), PE.04(D4), PE.05(D5), PE.06(D6), PE.07(D7), PE.08(D8)
PE.09(D9), PE.10(D10), PE.11(D11), PE.12(D12), PE.13(D13), PE.14(D14), PE.15(D15) */
/*
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOE, &GPIO_InitStructure);
*/
/*GPIOD->CRH = 0x33333333;
GPIOD->CRL = 0x33333333;
GPIOE->CRH = 0x33333333;
GPIOE->CRL = 0x33333333;*/
Set_nRd;
return value;
}
In LCD.h I modified following things#define Set_Cs GPIOD->BSRR = GPIO_Pin_7
#define Clr_Cs GPIOD->BRR = GPIO_Pin_7
#define Set_Rs GPIOD->BSRR = GPIO_Pin_11
#define Clr_Rs GPIOD->BRR = GPIO_Pin_11
#define Set_nWr GPIOD->BSRR = GPIO_Pin_5
#define Clr_nWr GPIOD->BRR = GPIO_Pin_5
#define Set_nRd GPIOD->BSRR = GPIO_Pin_4
#define Clr_nRd GPIOD->BRR = GPIO_Pin_4
Posted on: March 13, 2016, 07:37:06 07:37 - Automerged
The code you referenced has sub folders labeled "LCD.c".
LCD's supported
#define ILI9320 0 /* 0x9320 */
#define ILI9325 1 /* 0x9325 */
#define ILI9328 2 /* 0x9328 */
#define ILI9331 3 /* 0x9331 */
#define SSD1298 4 /* 0x8999 */
#define SSD1289 5 /* 0x8989 */
#define ST7781 6 /* 0x7783 */
#define LGDP4531 7 /* 0x4531 */
#define SPFD5408B 8 /* 0x5408 */
#define R61505U 9 /* 0x1505 0x0505 */
#define HX8347D 10 /* 0x0047 */
#define HX8347A 11 /* 0x0047 */
#define LGDP4535 12 /* 0x4535 */
#define SSD2119 13 /* 3.5 LCD 0x9919 */
As forter said if you read REG 0x0000 it returns a Device Code. It looks like the program during LCD initalization automatically determines the device code and sets the display
From the STM32/LCD+TouchPanel(simulate IO) folder
void LCD_Initializtion(void)
{
uint16_t DeviceCode;
LCD_Configuration();
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable , ENABLE);
GPIO_ResetBits(GPIOC, GPIO_Pin_0); /* LCD_RESET */
delay_ms(100);
GPIO_SetBits(GPIOC, GPIO_Pin_0);
GPIO_SetBits(GPIOA, GPIO_Pin_3); /* Enable back light */
/* Set MN(multipliers) of PLL, VCO = crystal freq * (N+1) */
/* PLL freq = VCO/M with 250MHz < VCO < 800MHz */
/* The max PLL freq is around 120MHz. To obtain 120MHz as the PLL freq */
DeviceCode = LCD_ReadReg(0x0000); /* Read LCD ID */ ***********************
if( DeviceCode == 0x9325 || DeviceCode == 0x9328 )
{
LCD_Code = ILI9325;
LCD_WriteReg(0x00e7,0x0010);
Try the simulate IO version if you don't know FSMC
When I googled your board. I found a Russian site that mentioned the display as a ILI9325.
http://ravwin.livejournal.com/60511.htmlBy the way I also find another Russian site they mentioned the display as a ILI9320.
I am confused which one is true ?
http://zakamik-ru.blogspot.in/p/blog-page.html