As the title states, I can not seem to get the xpt2046 touchscreen integration to function properly. All the suggestions in the facebook group as well as the esphome discord have so far been unsuccessful.
Hardware:
ESP32 devkitv1 x2
ESP32S2 x1
3.2" ili9341/xpt 2046 touchscreen x3
So far, the display component on all 3 displays work (one suggestion was to try a new display, so I bought 2 more). However, the touch function keeps yielding odd results within the logs when I attempt to calibrate them as shown in the esphome docs.
I have tried 3 different ESP32s, all brand new. All 3 displays are also new. I have tried 4 different wiring configs on breadboard. Someone suggested breadboard can be problematic, so I soldered it all up on a prototype board and the issue is still there.
As of now, upon touching the screen after bootup, 1 of 2 things will happen.
When report_interval:
is set to 1s
, touching the screen lists [21:07:52][I][cal:071]: x=0, y=395, x_raw=0, y_raw=0
, and continues to repeat indefinitely about 3 times per second until you power cycle the ESP. Touching the display when this is happening does nothing. No touch is reported other than the log entry above.
When report_interval:
is set to never, the display does not respond at all, and no logs are generated. Although when report_interval:
is set to never
, the log reports it as being set to a random number, [19:28:30][C][xpt2046:154]: Report interval: 4294967295
.
All 3 displays and 3 esp32s show the same behavior.
Current config:
captive_portal:
spi:
clk_pin: GPIO18
mosi_pin: GPIO23
miso_pin: GPIO19
display:
- platform: ili9xxx
id: my_display
rotation: 0
model: TFT 2.4
dc_pin: GPIO02
cs_pin: GPIO15
reset_pin: GPIO04
touchscreen:
platform: xpt2046
id: my_touchscreen
cs_pin: 21
update_interval: never
report_interval: never
on_touch:
- lambda: |-
ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
id(my_touchscreen).x,
id(my_touchscreen).y,
id(my_touchscreen).x_raw,
id(my_touchscreen).y_raw
);
interrupt_pin: 27
threshold: 400
calibration_x_min: 0
calibration_x_max: 4095
calibration_y_min: 0
calibration_y_max: 4095
swap_x_y: false
font:
- file: "gfonts://Roboto"
id: roboto
size: 20
- file:
type: gfonts
family: Roboto
weight: 400
id: font1
size: 35
color:
- id: white
red: 100%
green: 100%
blue: 100%
- id: BLACK
red: 0%
green: 0%
blue: 0%
- id: lcdpurple
hex: FF3399
Current wiring layout:
VCC: 5v
GND: GND
CS: GPIO 21
RESET: GPIO 4
DC: GPIO 2
MOSI: GPIO 23
SCK: GPIO 18
LED: 3.3v
MISO: GPIO 19
T_CLK: GPIO 18 (shared with SPI CLK)
T_CS: GPIO 21
T_DIN: GPIO 19 (shared with SPI MISO)
T_DO: GPIO 23 (shared with SPI MOSI)
T_IRQ: GPIO 27
Can anybody see why this is not working? I feel like the report_interval: behavior is quite odd, but I can’t get it to work by adjusting it. I know there are strapping pins with the current config; the current config is mirrored to this project that many have had success with: GitHub - DustinWatts/ESP32_TFT_Combiner: A PCB making it easy to combine an ESP32 and a TFT Touchsceen.
Sorry for the long first post, but I am losing my mind trying to get this display working. I am open to try anything again, no matter if you think 5 other people suggested it previously. Thanks in advance