ILI9341 and XPT2046 libs together

Hi All,

This is my first experience with SPI and I'm strugling with something that should be quite simple.

I'm using a Touch TFT from Waveshare originaly design for Rpi. The controller on the TFT is the ILI9341 and the touch controller is the XPT2046, both of them over SPI.

I'm using Adafruit's lib for the TFT and the PaulStoffregen XPT2046 touch lib.

I can sucessfuly draw on the TFT and use the touch as long as I don't do it both, so the libs and the wiring seams correct.

As soon as I initialize both the tft and the touch, I get Touch but no image. My first guess would be some conflict on sharing the SPI between them, but was not able to find the issue.

Can you please give a hand with this?

#define TFT_DC   6
#define TFT_CS   5
#define TFT_MOSI 11
#define TFT_MISO 12
#define TFT_CLK  13
#define TFT_RST  4
#define TP_CS    8

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
XPT2046_Touchscreen ts(TP_CS);

void setup() 
{
  // Configure TFT
  tft.begin();
  ts.begin();
  tft.setRotation(3); // Rotate 90º
    
  // Draw home screen
  drawHome();
}

Thanks to all, Luís

And your TFT model is...

Spotpear 3.2'' from waveshare... Running on a 3.3v uno.

Got it working with the Utouch lib... Still no ideia what was failing, but this works for me...