I'm trying to connect a cheap 4" TFT from AliExpress which has an ILI9488 display and an XPT2046 touchscreen with a Teensy 4.1 (this has two additional PSRAM chips fitted but I doubt this is relevant).
I have the LCD connected to SPI0 and touch to SPI1 with pinouts detailed at the start of the code below.
The bizarre issue is when the tft.fillScreen(ILI9488_BLACK) line is uncommented I get spurious touch responses, this doesn't happen when the other colours (red, green or blue) code lines are used instead!
Output with no touches and black screen is as follows:
10:13:49.794 -> ::begin 0 11 12 13
10:13:49.794 -> MOSI:11 MISO:12 SCK:13
10:13:49.794 -> ILI9488_t3::begin - End
10:13:50.287 -> Pressure = 422, x = 1577, y = 2251
10:13:50.334 -> Pressure = 434, x = 1576, y = 2253
10:13:50.402 -> Pressure = 436, x = 1573, y = 2244
10:13:50.647 -> Pressure = 338, x = 1576, y = 2254
10:13:50.785 -> Pressure = 357, x = 1575, y = 2251
10:13:50.852 -> Pressure = 438, x = 1575, y = 2251
10:13:50.985 -> Pressure = 363, x = 1577, y = 2251
10:13:51.019 -> Pressure = 323, x = 1578, y = 2251
10:13:51.086 -> Pressure = 335, x = 1575, y = 2252
10:13:51.186 -> Pressure = 301, x = 1574, y = 2244
10:13:51.285 -> Pressure = 392, x = 1577, y = 2253
10:13:51.319 -> Pressure = 346, x = 1576, y = 2243
Thanks for any help.
I have the LCD connected to SPI0 and touch to SPI1 with pinouts detailed at the start of the code below.
The bizarre issue is when the tft.fillScreen(ILI9488_BLACK) line is uncommented I get spurious touch responses, this doesn't happen when the other colours (red, green or blue) code lines are used instead!
Code:
#include <ILI9488_t3.h>
#include <XPT2046_Touchscreen.h>
#define TFT_RST 8
#define TFT_DC 9
#define TFT_CS 10
#define TFT_MOSI 11
#define TFT_MISO 12
#define TFT_CLK 13
ILI9488_t3 tft = ILI9488_t3(10, TFT_DC, TFT_RST, TFT_MOSI, TFT_CLK, TFT_MISO);
#define TS_CS 0
#define TS_MISO 1
#define TS_MOSI 26
#define TS_CLK 27
XPT2046_Touchscreen ts(TS_CS);
void setup() {
Serial.begin(921600);
tft.begin();
tft.fillScreen(ILI9488_BLACK);
//tft.fillScreen(ILI9488_RED);
//tft.fillScreen(ILI9488_GREEN);
//tft.fillScreen(ILI9488_BLUE);
ts.begin(SPI1);
while (!Serial && (millis() <= 1000));
}
void loop() {
if (ts.touched()) {
TS_Point p = ts.getPoint();
Serial.print("Pressure = ");
Serial.print(p.z);
Serial.print(", x = ");
Serial.print(p.x);
Serial.print(", y = ");
Serial.print(p.y);
delay(30);
Serial.println();
}
}
Output with no touches and black screen is as follows:
10:13:49.794 -> ::begin 0 11 12 13
10:13:49.794 -> MOSI:11 MISO:12 SCK:13
10:13:49.794 -> ILI9488_t3::begin - End
10:13:50.287 -> Pressure = 422, x = 1577, y = 2251
10:13:50.334 -> Pressure = 434, x = 1576, y = 2253
10:13:50.402 -> Pressure = 436, x = 1573, y = 2244
10:13:50.647 -> Pressure = 338, x = 1576, y = 2254
10:13:50.785 -> Pressure = 357, x = 1575, y = 2251
10:13:50.852 -> Pressure = 438, x = 1575, y = 2251
10:13:50.985 -> Pressure = 363, x = 1577, y = 2251
10:13:51.019 -> Pressure = 323, x = 1578, y = 2251
10:13:51.086 -> Pressure = 335, x = 1575, y = 2252
10:13:51.186 -> Pressure = 301, x = 1574, y = 2244
10:13:51.285 -> Pressure = 392, x = 1577, y = 2253
10:13:51.319 -> Pressure = 346, x = 1576, y = 2243
Thanks for any help.