Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when using with Adafruit ILI9341 (and ILI9341_t3) TFT library #42

Open
Hannes0O0 opened this issue Feb 14, 2022 · 0 comments
Open

Comments

@Hannes0O0
Copy link

Description

When I use this library in combination with the Adafruit_ILI9341.h library or the ILI9341_t3.h library, the display shows either white, or a combination of blue and black (with the Adafruit library). Everything related to touch works fine. If I upload the graphic test from Adafruit first and reupload the Sketch from before again, everything suddenly works just fine. When I power off and on the Teensy after that the TFT stops working.

Steps To Reproduce Problem

  1. Connect the TFT to a Teensy 4.1.
  2. Upload the Sketch.

Hardware & Software

Board: Teensy 4.1
Shields / modules used: 2.8 Inch SPI TFT
Arduino IDE version: 1.8.13
Teensyduino version (if using Teensy): 1.53
Operating system & version: Windows 10 home 64bit

Arduino Sketch

#include <Arduino.h>
#include "SPI.h"
#include "XPT2046_Touchscreen.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

//Pin definitions
#define TFT_MOSI 11
#define TFT_MISO 12
#define TFT_CLK 13
#define TFT_DP_CS 10
#define TFT_DP_RST 8
#define TFT_DP_DC 9
#define TFT_TS_CS 7
#define TFT_TS_IRQ 6

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_DP_CS, TFT_DP_DC, TFT_MOSI, TFT_CLK, TFT_DP_RST, TFT_MISO);
XPT2046_Touchscreen ts(TFT_TS_CS);

void setup() {
pinMode(TFT_DP_CS, OUTPUT);
pinMode(TFT_TS_CS, OUTPUT);
digitalWrite(TFT_DP_CS, HIGH);
digitalWrite(TFT_TS_CS, HIGH);
Serial.begin(38400);
//TFT init
tft.begin();
tft.setRotation(2);
//Tochscreen init
ts.begin();
ts.setRotation(2);
tft.fillScreen(0x0A0F);
}

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();
}
}
//This Sketch would normally change the color of the screen and Serial.print the Tochposition

//------------------------------------------------------------------------------------------------------------------------------------

//When I remove the code for the touch functionality it works as expected (=changes the coler of the screen):

#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

//Pin definitions
#define TFT_MOSI 11
#define TFT_MISO 12
#define TFT_CLK 13
#define TFT_DP_CS 10
#define TFT_DP_RST 8
#define TFT_DP_DC 9

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_DP_CS, TFT_DP_DC, TFT_MOSI, TFT_CLK, TFT_DP_RST, TFT_MISO);

void setup() {
pinMode(TFT_DP_CS, OUTPUT);
pinMode(TFT_TS_CS, OUTPUT);
digitalWrite(TFT_DP_CS, HIGH);
digitalWrite(TFT_TS_CS, HIGH);
Serial.begin(38400);
//TFT init
tft.begin();
tft.setRotation(2);
tft.fillScreen(0x0A0F);
}

void loop() {
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant