TFT_eSPI ESP32 SPI_Multiple_Buses

I need to connect 4 SPI devices on my ESP32:

ili 9488
Touch controller
SD Card

TFT_eSPI library mentions this:
// The ESP32 has 2 free SPI ports i.e. VSPI and HSPI, the VSPI is the default.
// If the VSPI port is in use and pins are not accessible (e.g. TTGO T-Beam)
// then uncomment the following line:
//#define USE_HSPI_PORT

Each SPI bus can handle up to three devices so I would like to put: "ili 9488" "Touch controller" and "SD Card" in one bus and the MPC23s17 on the second.

There are some ways to use both SPI ports on ESP32, here there is one:

I am wondering how much effort will require to achieve this. Also there is an I2C version of the MCP which might be hips easier to implement.

any ideas or suggestions?

With the ESP32 the TFT_eSPI library can be configured to use either the HDPI port or the VSPI port.

The TFT_eSPI library has a built in touch controller for the XPT2046 type driver, in this case the touch controller must be on the same port as the TFT but different pins must be used for the two chip selects.

SPI ports can have many devices connected. TFT_eSPI controlls the chip select lines in the software so this means the hardware controlled chip select pin limit is not a limiting factor.

I have working both SPI bus, TFT in VSPI and the MCP23s17 in HSPI. TFT works but the touch not sure if working properly.

In my test I have connected only the TFT and Touch to the ESP32 and I am running two library examples:

Touch_Controller_Demo only prints x & Y in the display but no serial when I touch the screen

Test_Touch_Controller prints continuously this: (not sure about "y")

x: 0 y: 3700 z: 23
x: 0 y: 3701 z: 28
x: 0 y: 3711 z: 20
x: 0 y: 3701 z: 27
x: 0 y: 3722 z: 34
x: 0 y: 3700 z: 29
x: 0 y: 3685 z: 27
x: 0 y: 3683 z: 31
x: 0 y: 3684 z: 5
x: 0 y: 3682 z: 15

If I touch, like move around and change level of pressure get this:

x: 1800 y: 2325 z: 1832
x: 2712 y: 768 z: 2363
x: 3059 y: 850 z: 2444
x: 3337 y: 2104 z: 2061
x: 2152 y: 2576 z: 1823
x: 1770 y: 1092 z: 2232
x: 3528 y: 1069 z: 2420
x: 3120 y: 2817 z: 1851
x: 1244 y: 2804 z: 1570
x: 1694 y: 1234 z: 2223
x: 3628 y: 1431 z: 2292

This is my setup ( I avoid to use TFT_CS 15 as GPIO15 is HSPI CSO )

#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS 17 // Chip select control pin
#define TFT_DC 2 // Data Command control pin
#define TFT_RST 4 // Reset pin (could connect to RST pin)
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
#define TOUCH_CS 16

I'm trying all the available library with Rpi display ili 9488 and touch XPT2046.with stm32 bluebill,Arduino ide.
When I use both touch and display then both goes very slow l refreshing like 2,3 seconds.
Very unusable result.
If used without touch,no problem.very fast
If used only touch,no problem,very vast .
SPI with touch is not usable on Rpi ili 9488.not sure about smaller display.
they share same clk,miso,mosi.I think its slow because of that.
Therefore,now I'm going to do some tests With Parallel 16 bit display .

Mode30: have you tried disconnecting the TFT SDO/MISO connection? Some ILI9488 don’t tristate MISO properly and can conflict with the touch controller’s SPI transactions.

I think I got working the TFT and the touch. My only concern is that I am getting this results Y when running the test and not touching the screen:

x: 0 y: 3760 z: 35
x: 0 y: 3752 z: 4
x: 0 y: 3774 z: 5
x: 0 y: 3747 z: 24
x: 0 y: 3760 z: 5
x: 0 y: 3748 z: 27
x: 0 y: 3760 z: 5
x: 0 y: 3756 z: 34
x: 0 y: 3748 z: 36
x: 0 y: 3752 z: 5
x: 0 y: 3759 z: 5

shouldn't be y:0 ?

Go on. You should look at the "z" value. This indicates the pressure.

Look at the results you posted in #2

Best regards Bodmer, David and everyone!
Has any adaptation of the example ‘TFT_Clock’ (Analog) from the excellent library ‘TFT_ILI9341_ESP’ (your Bodmer!) Been made to a Display 3.5 Breakout SPI ILI9488 (NOT Shield!) With ESP8266 or ESP32 with the TFT_eSPI library?
I would very much like to make this Clock (TFT_Clock) with the Display mentioned but I am not knowledgeable enough in Arduino programming to adapt the sketch for this Display.
Or, if anyone here has done something similar or has any Display Clock mentioned, if you want and can, by kindness, share here, I would be very grateful!
The sketch, the Display and a Clock Engraving are attached;
Thank you all

InternetClock_ILI9341.ino (10.8 KB)

InternetClock_ILI9341.ino (10.8 KB)

Sorry, for an error, the .ino file was repeated and I am attaching the image of the desired clock here.