Quantcast
Channel: Data converters
Viewing all articles
Browse latest Browse all 38628

Forum Post: TSC2046 to Tiva C Launchpad SPI interfacing

$
0
0
Hi, I have been trying to interface the Stellaris Tiva C Launchpad and a LCD and touchscreen. The touchscreen controller is the TSC 2046. Communication takes place via a SPI interface. The SPI interface is configured for a clock rate of 1MHz. The SSI data-size is set to 8-bits. Config for SPI: SSI->SSICR1=0x00u; SSI->SSIClockPrescale =0x10u; SSI->SSICR0&=0xFFC7u; SSI->SSICR1=0x02u; The problem I have is that when I retrieve the x and y co-ordinates the returned values are always zero(0). The functions I call are shown below: unsigned int xGetData(void) { unsigned int lbdata, hbdata, data; TouchCS=~TouchCS; // Touch Controller CS = 0 // SSI2->SSIData = 0xD0u; while ((SSI2->SSIStatus & 16) == 16 ){}; delay_us(2); while ((SSI2->SSIStatus & 16) == 16 ){}; hbdata = SSI2->SSIData; lbdata = SSI2->SSIData; hbdata = (hbdata > 4); } unsigned int yGetData(void) { unsigned int lbdata, hbdata, data; TouchCS=~TouchCS; // SSI2->SSIData = 0x90u; while ((SSI2->SSIStatus & 16) == 16 ){}; delay_us(2); while ((SSI2->SSIStatus & 16) == 16 ){}; hbdata = SSI2->SSIData; lbdata = SSI2->SSIData; hbdata = (hbdata >4); } I have used an oscilloscope to verify that the command has been sent and the TSC2046 is responding (I don't have a digital analyser so can only use the oscilloscope). I have used different commands (in sequence - stored into variables and later used to calculate the average value) such as: 0xD1; 0xD1, 0xD0; when measuring the x coordinate (0x91, 0x90 for the y coordinate) - but to no avail. Intermittently I get values but these change constantly even when pressing the same location on the screen. The default however is that the x and y coordinates are zero. I presume that I have incorrectly configured the SPI but I cannt fathom what exactly I have done incorrectly. Many Thanks, Carl.

Viewing all articles
Browse latest Browse all 38628

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>