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.

TM4C1294NCPDT: Problem with TSC2003 touch screen controller temperature connected to TM4C1294NCPDT

Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: TSC2003


I also posted this on the touch forum but I figured I might get some feedback here too since I am using the TM4C1294.

I am trying figure out how to read temperature using the TSC2003. It looks like I implemented my I2C drivers correctly because I am able to measure X and Y okay and I am able to implement touch screen feature. But I could not get the right temperature readings. Any suggestions on what I am doing wrong? I am using the TM4C1294NCPDTI. Some of the lines I wrote might not make sense because I have tried so many things and I just could not get reading the temperature to work.

void InitializeTouch(void)
 //PENIRQ pin
 }//end while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOC))
 GPIOIntRegister(GPIO_PORTC_BASE, PortCIntHandler);
 //Touch I2C pins
 }//end while(!SysCtlPeripheralReady(SYSCTL_PERIPH_I2C6))
 }//end while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOA)) 
 I2CMasterInitExpClk(I2C6_BASE, FOSC_HZ, false); 
 //chip initialize
 WriteTouchByte(0x90, 0x02);
 PollTimer0Delay(20, 1000);
}//end void InitializeTouch(void)
void WriteTouchByte(uint8_t i2cAdd,  uint8_t commandByte)
 i2cAdd = i2cAdd >> 1;
 I2CMasterSlaveAddrSet(I2C6_BASE, i2cAdd, false);
 I2CMasterDataPut(I2C6_BASE, commandByte);
 PollTimer0Delay(50, 1000000);
}//end void WriteTouchByte(uint8_t i2cAdd,  uint8_t commandByte)
uint8_t ReadTouchByte(uint8_t i2cAdd)
 uint32_t i2cByte;
 i2cAdd = i2cAdd >> 1;
 I2CMasterSlaveAddrSet(I2C6_BASE, i2cAdd, true);
 PollTimer0Delay(50, 1000000);
 i2cByte = I2CMasterDataGet(I2C6_BASE);
}//end uint8_t ReadTouchByte(uint8_t i2cAdd)

This is the code in my main

     WriteUART0("\n\rTouch Temp1 = ");
     WriteTouchByte(0x90, 0x0E);
     PollTimer0Delay(20, 1000);
     touchTemp1 = ReadTouchByte(0x90);

     WriteTouchByte(0x90, 0x02);  
     PollTimer0Delay(20, 1000);

     PollTimer0Delay(5, 1);

     WriteUART0("\n\rTouch Temp2 = ");
     WriteTouchByte(0x90, 0x4E); 
     PollTimer0Delay(20, 1000); 
     touchTemp2 = ReadTouchByte(0x90);
     WriteTouchByte(0x90, 0x02);  
     PollTimer0Delay(20, 1000);
     Temperature = touchTemp1 * 2.5 / 255 * 1000.0 * 25.0 / 600;
     WriteUART0("\n\rTemp0(C) = ");

     Temperature = (2.573 * (touchTemp2 - touchTemp1) * 2.5 / 255 * 1000) - 273;
     WriteUART0("\n\rTemp1(C) = ");

This is what I see on hyperterminal. And no matter what the temperature around is, it's always like this.

Touch Temp1 = 76
Touch Temp2 = 92
Temp0(C) = 31.04
Temp1(C) = 130.60



  • Hi,
    If you are able to read the measurement of X and Y correctly then I think the hardware setup is mostly right.

    I will suggest that you use the scope monitor what is returned by the TSC2003 when you do ReadTouchByte(0x90). Is the data correct on the scope? If the data is correct on the scope then the problem is likely due to the software.

    I read the TSC2003 datasheet and it says you need to wait 10us after you issue a command before you can read the data? Did your PollTimer0Delay() meet this requirement? After you issue the command, the TSC2003 needs to start the acquisition and then conversion. If you read too early before the data is ready then the data can be wrong. Just a thought though.