EDIT: SOLVED. The problem was that I had wired SDI(MOSI) to the wrong pin.
Hi, I try to get the ILI9341 working on a new Teensy 3.6 setup here. The touch works (verified by serial terminal outputs) but there is nothing displayed on the ILI9341.
I have an audio board connected and used the wiring in the guide here https://www.pjrc.com/store/display_ili9341_touch.html for when the audio board is connected.
Can someone help me with how to debug this?
Below is the code I run. I know the code runs because there is serial output showing the touch x and y positions.
This is my platformio.ini file contents:
Hi, I try to get the ILI9341 working on a new Teensy 3.6 setup here. The touch works (verified by serial terminal outputs) but there is nothing displayed on the ILI9341.
I have an audio board connected and used the wiring in the guide here https://www.pjrc.com/store/display_ili9341_touch.html for when the audio board is connected.
Can someone help me with how to debug this?
Below is the code I run. I know the code runs because there is serial output showing the touch x and y positions.
Code:
#include <Arduino.h>
#include <ILI9341_t3.h>
#include <font_Arial.h> // from ILI9341_t3
#include <XPT2046_Touchscreen.h>
#include <SPI.h>
#define CS_PIN 8
#define TIRQ_PIN 2
// MOSI=11, MISO=12, SCK=13
XPT2046_Touchscreen ts(CS_PIN, TIRQ_PIN);
//XPT2046_Touchscreen ts(CS_PIN); // Param 2 - NULL - No interrupts
//XPT2046_Touchscreen ts(CS_PIN, 255); // Param 2 - 255 - No interrupts
//XPT2046_Touchscreen ts(CS_PIN, TIRQ_PIN); // Param 2 - Touch IRQ Pin - interrupt enabled polling
// For optimized ILI9341_t3 library
#define TFT_DC 20
#define TFT_CS 21
#define TFT_RST 255 // 255 = unused, connect to 3.3V
#define TFT_MOSI 7
#define TFT_SCLK 14
#define TFT_MISO 12
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_MISO);
void setup() {
Serial.begin(38400);
tft.begin();
tft.setRotation(1);
tft.fillScreen(ILI9341_BLACK);
ts.begin();
ts.setRotation(1);
while (!Serial && (millis() <= 1000));
}
boolean wastouched = true;
void loop() {
boolean istouched = ts.touched();
if (istouched) {
TS_Point p = ts.getPoint();
if (!wastouched) {
tft.fillScreen(ILI9341_BLACK);
tft.setTextColor(ILI9341_YELLOW);
tft.setFont(Arial_60);
tft.setCursor(60, 80);
tft.print("Touch");
}
tft.fillRect(100, 150, 140, 60, ILI9341_BLACK);
tft.setTextColor(ILI9341_GREEN);
tft.setFont(Arial_24);
tft.setCursor(100, 150);
tft.print("X = ");
tft.print(p.x);
tft.setCursor(100, 180);
tft.print("Y = ");
tft.print(p.y);
Serial.print(", x = ");
Serial.print(p.x);
Serial.print(", y = ");
Serial.println(p.y);
} else {
if (wastouched) {
tft.fillScreen(ILI9341_BLACK);
tft.setTextColor(ILI9341_RED);
tft.setFont(Arial_48);
tft.setCursor(120, 50);
tft.print("No");
tft.setCursor(80, 120);
tft.print("Touch");
}
Serial.println("no touch");
}
wastouched = istouched;
delay(100);
}
This is my platformio.ini file contents:
Code:
[env:teensy36]
platform = teensy
board = teensy36
framework = arduino
build_flags = -D USB_SERIAL
lib_deps =
paulstoffregen/ILI9341_t3@0.0.0-alpha+sha.ff4bba3e15
paulstoffregen/XPT2046_Touchscreen@0.0.0-alpha+sha.26b691b2c8
Last edited: