cancel
Showing results for 
Search instead for 
Did you mean: 

FT5216 gets random touchs after connecting LCD to the board

SEMad
Associate III

Hi.

I am using a custom board: STM32F767ZGT6 + LCD 4.3" innolux AT043TN25 + FT5216 touch driver.

I use a very simple and basic code for get touch coordinates:

Init:

uint8_t FT5216_Init(void)
{
	uint8_t temp[2]; 
	HAL_GPIO_WritePin(T_RST_GPIO_Port, T_RST_Pin, GPIO_PIN_RESET);
	HAL_Delay(20);
 	HAL_GPIO_WritePin(T_RST_GPIO_Port, T_RST_Pin, GPIO_PIN_SET);	    
	HAL_Delay(50);  	
	temp[0]=0;
	FT5206_WR_Reg(FT_DEVIDE_MODE,temp,1);
	FT5206_WR_Reg(FT_ID_G_MODE,temp,1);
	temp[0]=22;
	FT5206_WR_Reg(FT_ID_G_THGROUP,temp,1);
	temp[0]=12;
	FT5206_WR_Reg(FT_ID_G_PERIODACTIVE,temp,1);
	return 1;
}

get touch:

uint8_t FT5216_GetTouch(uint16_t *x, uint16_t *y)
{
	uint8_t data[4];
	uint8_t read, dat;
	if(HAL_GPIO_ReadPin(T_INT_GPIO_Port, T_INT_Pin) == GPIO_PIN_RESET)
		{
			//number of touchs
			read = 0x02;
			HAL_I2C_Master_Transmit(&hi2c1, 0x70, &read, 1, 10);
			HAL_I2C_Master_Receive(&hi2c1, 0x70, &dat, 1, 10);
			if(dat  == 0 || dat > 1)
				return 0;
			//Get Touch data
			read = 0x03;
			//0x03 is the first byte of touch cordinates of 1st touch
			HAL_I2C_Master_Transmit(&hi2c1, 0x70, &read, 1, 10);
			HAL_I2C_Master_Receive(&hi2c1, 0x70, data, 4, 10);
			*x = (uint16_t)((data[0] & 0x0F) << 8) + data[1];
			*y = (uint16_t)((data[2] & 0x0F) << 8) + data[3];
			return 1;
		}
		else
			return 0;
}

everythings is OK UNTIL I connect the LCD to the board...

touch driver starts getting random touchs without touching the screen...

how can I solve this problem?

thanks.

0 REPLIES 0