ILI9488 calibration with ESP32

Hey gang,
I have an ILI9488 SPI touch screen (LCD wiki) and though I've gotten the screen to work, I'm having no luck with the touch screen (XPT2046).
It's as if something is permanently touching the screen, so as soon as I put it into calibration mode, it says "Touch corners as indicated" which it races through then says calibration complete. Of course, touch output is all incorrect. :confused:

I'm using ESP-WROOM-32 (38 pin) with TFT_eSPI library, but am open to other suggestions (as long as they're compatible with LVGL, which I plan to use after I get this problem sorted out.

In TFT_eSPI's config file User_Setup.h, I have even tried putting -1 for the TOUCH_CS pin and the calibration process still races through.

It is entirely possible I've done something wrong as I followed this tutorial as my starting point, tweaking things my specific display.

Any help would be greatly appreciated!

All the best,
Dax.

Post your code, I'd like to see the pin numbers being used. Oh code in code tag thingies.

Hey Idaho,
Sure thing, thanks for your interest.

Here are the only non-commented lines in User_Setup.h other than the default font and SPI speed settings.

#define ILI9488_DRIVER
#define TFT_MISO 19
#define TFT_MOSI 26
#define TFT_SCLK 18
#define TFT_CS   15  // Chip select control pin
#define TFT_DC   2  // Data Command control pin
#define TFT_RST  4  // Reset pin (could connect to RST pin)
#define TOUCH_CS 14

Other than that, it's the examples from Bodmer's TFT_eSPI library.

Let me know if you'd like to know anything else! :slight_smile:

Cheers,
Dax.

When I run the Touch Controller Demo sketch, it displays x:0 y:0 and doesn't respond to touch.

When I run the Test Touch Controller sketch, the serial monitor shows stuff like this when I'm touching the screen:

21:55:53.028 -> x: 162     y: 4095     z: 4070 
21:55:53.263 -> x: 173     y: 4095     z: 4059 
21:55:53.499 -> x: 155     y: 4095     z: 4026 
21:55:53.779 -> x: 160     y: 4095     z: 4048 
21:55:54.012 -> x: 130     y: 4095     z: 4078 
21:55:54.246 -> x: 183     y: 4095     z: 4032 
21:55:54.527 -> x: 147     y: 4095     z: 4024 
21:55:54.762 -> x: 3920     y: 559     z: 3928 
21:55:54.995 -> x: 3951     y: 589     z: 3957 
21:55:55.275 -> x: 158     y: 4095     z: 4046 
21:55:55.508 -> x: 3824     y: 967     z: 3852 
21:55:55.741 -> x: 3807     y: 938     z: 3840 
21:55:56.023 -> x: 3758     y: 1038     z: 3835 
21:55:56.257 -> x: 124     y: 4095     z: 4119 
21:55:56.490 -> x: 3519     y: 2739     z: 3797 
21:55:56.771 -> x: 3880     y: 2319     z: 3877 
21:55:57.004 -> x: 3960     y: 1181     z: 3924 
21:55:57.239 -> x: 3415     y: 652     z: 3835 
21:55:57.522 -> x: 4002     y: 362     z: 3945 
21:55:57.758 -> x: 3806     y: 628     z: 3827 
21:55:57.994 -> x: 144     y: 4095     z: 4057 
21:55:58.277 -> x: 3984     y: 2169     z: 4002 
21:55:58.512 -> x: 137     y: 4095     z: 4038 
21:55:58.746 -> x: 4017     y: 2548     z: 3988 
21:55:59.027 -> x: 3967     y: 1392     z: 3935 
21:55:59.261 -> x: 141     y: 4095     z: 3992 
21:55:59.497 -> x: 272     y: 4095     z: 4050 
21:55:59.780 -> x: 141     y: 4095     z: 4029 
21:56:00.013 -> x: 146     y: 4095     z: 4024 
21:56:00.247 -> x: 137     y: 4095     z: 4024 

And this when I'm not touching the screen:

21:56:31.010 -> x: 178     y: 4095     z: 4061 
21:56:31.244 -> x: 181     y: 4095     z: 4001 
21:56:31.526 -> x: 138     y: 4095     z: 4083 
21:56:31.762 -> x: 174     y: 4095     z: 4045 
21:56:31.998 -> x: 151     y: 4095     z: 4048 
21:56:32.281 -> x: 133     y: 4095     z: 4086 
21:56:32.519 -> x: 163     y: 4095     z: 4036 
21:56:32.755 -> x: 157     y: 4095     z: 4047 
21:56:32.988 -> x: 176     y: 4095     z: 4047 
21:56:33.272 -> x: 155     y: 4095     z: 4051 
21:56:33.508 -> x: 151     y: 4095     z: 4055 
21:56:33.742 -> x: 177     y: 4095     z: 4058 
21:56:34.023 -> x: 164     y: 4095     z: 4048 
21:56:34.257 -> x: 140     y: 4095     z: 4050 
21:56:34.489 -> x: 150     y: 4095     z: 4049 
21:56:34.771 -> x: 156     y: 4095     z: 4043 
21:56:35.006 -> x: 155     y: 4095     z: 4051 
21:56:35.240 -> x: 169     y: 4095     z: 4081 
21:56:35.523 -> x: 160     y: 4095     z: 4052 
21:56:35.759 -> x: 138     y: 4095     z: 4035 
21:56:35.996 -> x: 166     y: 4095     z: 4047 
21:56:36.279 -> x: 142     y: 4095     z: 4056 

Turns out to be something a little odd. I had been using non-standard SPI pins and, when testing something else, I used the default pins (18,19,23) and the touchscreen now worked.

I have raised a possible bug with the library's developer here: Touchscreen SPI seems hardcoded (ESP32) · Issue #1431 · Bodmer/TFT_eSPI · GitHub