TFT_eSPI Touch values out of whack. Bad hardware?

69 Views Asked by At

I have the HiLetGo TFT touchscreen display: enter image description here

And I'm messing around with the Bodner SPI library for the 9341 and touch events: https://github.com/Bodmer/TFT_eSPI

I'm also using a Raspberry Pico which is 3.3v friendly so it matches up well with this display. I'm using the Setup60_RP2040_ILI9341.h header file in the User_Setups and I wired everything up per their default values just to get a demo going. The display works beautifully. I ran through a bunch of his demos and everything is working as expected for the display side of things.

I then wanted to get the touch events going, so I pulled up his "Test_Touch_Controller.ino" demo: https://github.com/Bodmer/TFT_eSPI/blob/master/examples/Test%20and%20diagnostics/Test_Touch_Controller/Test_Touch_Controller.ino

I hooked up the touch connections as well as the additional chip select, enabled the TOUCH_CS defined constant in the header file making sure it matches the chip select pin I used on the pico.

So the issue is that I'm getting values back, but it's out of whack. Without touching the screen, I get values such as (this is real data back):

X: 0 Y: 7936 Z: 2303
X: 0 Y: 7936 Z: 65023
X: 0 Y: 7936 Z: 255
X: 0 Y: 7936 Z: 63999
X: 0 Y: 7936 Z: 64767
X: 0 Y: 7936 Z: 3583
X: 0 Y: 7936 Z: 64255
X: 0 Y: 7936 Z: 4607
X: 0 Y: 7936 Z: 1535
X: 0 Y: 7936 Z: 2047
X: 0 Y: 7936 Z: 3071
X: 0 Y: 7936 Z: 65535
X: 0 Y: 7936 Z: 2303
X: 0 Y: 7936 Z: 2303
X: 0 Y: 7936 Z: 3583

If I touch the screen, I do get values for X and Y, but they don't seem to be related to where I'm actually touching on the screen. I realize the values coming back are raw values, and not pixels, but there's still no relation to the position on the screen, as in, the X value going up for down as I touch across the screen. The values seem to be pretty random.

I'm wondering if I have a bad touch display. The fact that Y is reading 7936 and Z jumping all over the place without even touching the display leads me to believe this may be the case, but I'm wondering if I'm missing something else.

FYI, for testing purposes, if I disconnect the CS pin everything reads 0 as expected, so it's clearly getting data from touch.

1

There are 1 best solutions below

0
PJ Glasso On

I think it's showing the ADC output not the X, Y coordinates. if you read the fine print it say's that somewhere. HTH GL :-) PJ