Problems with xpt2046 display ILI9341 calibration

I wrote the following code in ESPhome with an esp32 wroom 32, in the logs it only shows me “[I][cal:104]: x=0, y=0, x_raw=0, y_raw=0” the first time I touch the screen regardless of where I press, all the other time I press it only print “[D][xpt2046:055]: Touchscreen Update [0, 0], z = 4095”, still regardless of where I press, what am I doing wrong?


  - file: "fonts/verdanab.ttf"
    id: verdana
    size: 100
  - file: "fonts/arial.ttf"
    id: arial
    size: 40

  - platform: homeassistant
    entity_id: sensor.gw2000a_pool_temperature
    name: "TempPiscina"
    id: TempPiscina

  - platform: homeassistant
    entity_id: alarm_control_panel.mg5050_partition_interno
    name: "Stato allarme"
    id: statoAllarme

  clk_pin: GPIO18
  mosi_pin: GPIO23
  miso_pin: GPIO19

  - file: mdi:shield-home
    id: allarme
    resize: 200x200

  - platform: ili9xxx
    id: display1
    model: ili9341
    reset_pin: GPIO13
    cs_pin: GPIO5
    dc_pin: GPIO15
      height: 320
      width: 240
    rotation: 270
    lambda: |-

      auto red = Color(255, 0, 0);
      auto green = Color(0, 153, 0);
      auto black = Color(0, 0, 0);
      auto white = Color(255, 255, 255);
        if(id(statoAllarme).state == "disarmed"){
          it.filled_rectangle(1, 1, 320, 240, green);
          it.printf(20, 56, id(verdana), "%4.1f", id(TempPiscina).state);
          it.printf(270, 120, id(arial), "°C");
        it.filled_rectangle(1, 1, 320, 240, red);
        it.image(60, 20, id(allarme), white);
  platform: xpt2046
  display: display1
  id: my_touchscreen
  cs_pin: GPIO21
  interrupt_pin: GPIO25
    - lambda: |-
          ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",

hello @Matteo2 ,

have you found the problem please? , i am facing the same issue…

i can only press one time on the screen top left and get

[I][cal:299]: x=0, y=0, x_raw=0, y_raw=0

and after that i have only

[D][xpt2046:055]: Touchscreen Update [0, 0], z = 4095 no matter where i press on the touchscreen…

I think perhaps i have not a XPT2046 but any indication on the web site

my screen is a ST7789V on the vendor page and it has never work on ESP home, only with ILI9488 settings

here is the screen :

EDIT: seems there is capacitive and resistive touchscreen and i think i have a resistive one, who dont work in esphome XPT2046…

Found it!!!

just disconnect MISO pin to the TFT and connect TDO of the Touchscreen to your MISO PIN, and ENJOY!!! finally it work!!!