The Godfather talking
You may crack software. How about me?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 23, 2024, 07:05:08 19:05


Login with username, password and session length


Pages: [1]
Print
Author Topic: Help needed for 2.8" LCD touch screen  (Read 6098 times)
0 Members and 1 Guest are viewing this topic.
localcrack
Active Member
***
 Muted
Offline Offline

Posts: 173

Thank You
-Given: 64
-Receive: 21



« on: March 11, 2016, 10:43:21 10:43 »

Recently I have purchased CZ miniSTM32F103V_-EK development board with 2.8" LCD touch screen from aliexpress
The seller do not provides details about which LCD driver chip used in the LCD Module. So I unable to interface it.
I google many times but unable to find info for specific LCD.
If anybody uses same LCD please share the specification

Logged
TucoRamirez
Senior Member
****
Offline Offline

Posts: 307

Thank You
-Given: 257
-Receive: 115


Tuco ... dead or Alive


« Reply #1 on: March 11, 2016, 12:24:01 12:24 »

you mean, the lcd based on  ili9320?

maybe this will give u ideas
https://github.com/torvalds/linux/blob/master/drivers/video/backlight/ili9320.c
Logged

Whoever double crosses me and leaves me alive... he understands nothing about Tuco.
Old_but_Alive
Senior Member
****
Offline Offline

Posts: 331

Thank You
-Given: 745
-Receive: 120


« Reply #2 on: March 11, 2016, 04:08:31 16:08 »

I just got a 2.8" SPI module.

it uses an ILI9341, and it works a treat.

if you have googled for it, and drawn a blank then you are in trouble.

are there any markings on the lcd pcb?



« Last Edit: March 11, 2016, 04:13:12 16:13 by Old_but_Alive » Logged

I fought Ohm's Law ...  and the law won
I only use Mosfets because I have a Bipolar mental disorder :-)
localcrack
Active Member
***
 Muted
Offline Offline

Posts: 173

Thank You
-Given: 64
-Receive: 21



« Reply #3 on: March 12, 2016, 02:09:45 14:09 »

I have tried following code from waveshare but unable to get success

http://www.waveshare.com/wiki/File:3.2inch-320x240-Touch-LCD-C-Code.7z

They provides code with both method by using Normal IO and with FSMC.
I do not know the FSMC more so I unable to configure it
In Normal IO method my board layout uses different pin configuration then code provided. I try to change pin config but unable to get success.
my stm32 board uses PortD amd PortE pins for LCD Data
Logged
forter
Active Member
***
Offline Offline

Posts: 139

Thank You
-Given: 1049
-Receive: 28


« Reply #4 on: March 12, 2016, 07:46:49 19:46 »

Localcrack!
May be you try to read  0x00 register of the chip and send this data in terminal program?
In most cases this register contain the chip ID.
For example you can see 1289, it means IC is SSD1289.

Logged
Checksum8
Active Member
***
Offline Offline

Posts: 132

Thank You
-Given: 124
-Receive: 102


« Reply #5 on: March 12, 2016, 10:37:00 22:37 »

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
Code:
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.html

Logged
localcrack
Active Member
***
 Muted
Offline Offline

Posts: 173

Thank You
-Given: 64
-Receive: 21



« Reply #6 on: March 13, 2016, 08:19:34 08:19 »

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. Sad

In LCD.C file I modified following things

Code:
/*******************************************************************************
* 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
Code:
#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
Code:
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.html



By 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
Logged
bobcat1
Senior Member
****
Offline Offline

Posts: 304

Thank You
-Given: 4273
-Receive: 94


« Reply #7 on: March 13, 2016, 09:33:12 09:33 »

Hi
According to the picture it look like a bus type LCD
At first try to verify operation try accessing any register by writing and reading from one address location
once it worked try to use some bus driver software to display a pixel on the display

All the best

Bobi
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC