This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TSC2046 X Y Z values incorrect

Other Parts Discussed in Thread: TSC2046


 i am interfacing TSC2046 with stm32, but i haven't  get proper x, y & z values. (TFT resolution is 1024*600) 

also check TFT X Y Z waveform, interrupt & spi comm  everything is correct but still i haven't get proper X Y Z value.

for X- 0XD0 & Y- 0X90


uint16_t TSC2046_SendCommand(uint8_t cmd)
uint8_t spiBuf[3] = {0,0,0};
uint16_t return16=0;
uint16_t vall;

spiBuf[0] = cmd;
HAL_SPI_Transmit(&tsSPIhandle, spiBuf, 1, 10);
//Wait for response (3 ms)
if(HAL_SPI_Receive(&tsSPIhandle, &spiBuf[1], 2, 10) == HAL_OK)
return16 = (spiBuf[1]<<4) + (spiBuf[2]>>4);
else return16 = 0;

return return16;


uint16_t TSC2046_getRaw_X(void)
return TSC2046_SendCommand(0XD0);

//ii. get y-axis raw touch 12-bit value
uint16_t TSC2046_getRaw_Y(void)
return TSC2046_SendCommand(0X90);
//iii. get z-axis raw touch 12-bit value
uint16_t TSC2046_getRaw_Z(void)
return TSC2046_SendCommand(0XB0);

while (1)

if(HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_8)==0)
// data_z= TSC2046_getRaw_Z();

   data_x= TSC2046_getRaw_X();

  data_y= TSC2046_getRaw_Y();



  • Hi,

    We don't offer expert support on our touch screen controllers, but I can try to help you the best I can. Are you results random or are they off by a scaling or constant factor? I'm wondering if the device needs to be calibrated differently.