Just got the 2.8" LCD TFT screen (ILI9341), along with the Resistive Touch Screen Controller (STMPE610). On its own the screen works as expected with the example graphicstest sketch wired for hardware SPI without the STMPE610 wired.
The Touch screen works with Touchtest sketch (with screen wired).
When I load touchpaint sketch from the examples Confirming the code and putting the STMPE610 on pin 8) I get a white screen and thats it.
I then tryed to use the graphicstest sketch again with the STMPE610 wired and it will no longer work. The serial debulg shows all of the modes and formats as 0x0 and the screen will not cycle through the test modes, just white.
What am I missing? why wont the touchpaint sketch work, its seems to be written for both of these pieces of hardware.
TFT LCD problems with STMPE STMPE610
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- zerodegreec
- Posts: 13
- Joined: Wed Aug 20, 2014 10:55 pm
Re: TFT LCD problems with STMPE STMPE610
Maybe I should have put this in "Glowy Things"?
Update, Still no joy BUT if I put a pull down resistor (330ohm)on Pin 8 (the Resistive Touch Screen CS) and do a digitalWrite(8,LOW) I can get the test screen to show up. So obviously there is a problem with the two SPI devices having an argument. Plus once I do this the touch screen is all over the place and not calibrated at all when I load the paint sketch.
Help?!?!
Update, Still no joy BUT if I put a pull down resistor (330ohm)on Pin 8 (the Resistive Touch Screen CS) and do a digitalWrite(8,LOW) I can get the test screen to show up. So obviously there is a problem with the two SPI devices having an argument. Plus once I do this the touch screen is all over the place and not calibrated at all when I load the paint sketch.
Help?!?!
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: TFT LCD problems with STMPE STMPE610
Sounds like you have a pin conflict on the CS lines.
Post a photo of your hardware (showing connections) and your code (in CODE tags please) and we'll see what we can find.
Post a photo of your hardware (showing connections) and your code (in CODE tags please) and we'll see what we can find.
- zerodegreec
- Posts: 13
- Joined: Wed Aug 20, 2014 10:55 pm
Re: TFT LCD problems with STMPE STMPE610
I abandoned the SPI for the touch screen (out of necessity of continuing the current project) and went with i2c BUT I would like to have this resolved just for my sanity and future setups.
Like I said the screen and the touch control work just fine on their own, so its not a wiring issue. I dont have a photo of the two setup on SPI mode as its now wired as mentioned above. I am using this code on a Redboard and not a genuine UNO but I cant see that being an issue.
Like I said the screen and the touch control work just fine on their own, so its not a wiring issue. I dont have a photo of the two setup on SPI mode as its now wired as mentioned above. I am using this code on a Redboard and not a genuine UNO but I cant see that being an issue.
Code: Select all
/***************************************************
This is our touchscreen painting example for the Adafruit ILI9341 Shield
----> http://www.adafruit.com/products/1651
Check out the links above for our tutorials and wiring diagrams
These displays use SPI to communicate, 4 or 5 pins are required to
interface (RST is optional)
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution
****************************************************/
#include <Adafruit_GFX.h> // Core graphics library
#include <SPI.h>
#include <Wire.h> // this is needed even tho we aren't using it
#include <Adafruit_ILI9341.h>
#include <Adafruit_STMPE610.h>
// This is calibration data for the raw touch data to the screen coordinates
#define TS_MINX 150
#define TS_MINY 130
#define TS_MAXX 3800
#define TS_MAXY 4000
// The STMPE610 uses hardware SPI on the shield, and #8
#define STMPE_CS 8
Adafruit_STMPE610 ts = Adafruit_STMPE610(STMPE_CS);
// The display also uses hardware SPI, plus #9 & #10
#define TFT_CS 10
#define TFT_DC 9
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// Size of the color selection boxes and the paintbrush size
#define BOXSIZE 40
#define BANNED 3
int oldcolor, currentcolor;
void setup(void) {
// while (!Serial); // used for leonardo debugging
Serial.begin(9600);
Serial.println(F("Touch Paint!"));
tft.begin();
if (!ts.begin()) {
Serial.println("Couldn't start touchscreen controller");
while (1);
}
Serial.println("Touchscreen started");
tft.fillScreen(ILI9341_BLACK);
// make the color selection boxes
tft.fillRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_RED);
tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_YELLOW);
tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_GREEN);
tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_CYAN);
tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_BLUE);
tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_MAGENTA);
// select the current color 'red'
tft.drawRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
currentcolor = ILI9341_RED;
}
void loop()
{
// See if there's any touch data for us
if (ts.bufferEmpty()) {
return;
}
/*
// You can also wait for a touch
if (! ts.touched()) {
return;
}
*/
// Retrieve a point
TS_Point p = ts.getPoint();
/*
Serial.print("X = "); Serial.print(p.x);
Serial.print("\tY = "); Serial.print(p.y);
Serial.print("\tPressure = "); Serial.println(p.z);
*/
// Scale from ~0->4000 to tft.width using the calibration #'s
p.x = map(p.x, TS_MINX, TS_MAXX, 0, tft.width());
p.y = map(p.y, TS_MINY, TS_MAXY, 0, tft.height());
/*
Serial.print("("); Serial.print(p.x);
Serial.print(", "); Serial.print(p.y);
Serial.println(")");
*/
if (p.y < BOXSIZE) {
oldcolor = currentcolor;
if (p.x < BOXSIZE) {
currentcolor = ILI9341_RED;
tft.drawRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
} else if (p.x < BOXSIZE*2) {
currentcolor = ILI9341_YELLOW;
tft.drawRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
} else if (p.x < BOXSIZE*3) {
currentcolor = ILI9341_GREEN;
tft.drawRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
} else if (p.x < BOXSIZE*4) {
currentcolor = ILI9341_CYAN;
tft.drawRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
} else if (p.x < BOXSIZE*5) {
currentcolor = ILI9341_BLUE;
tft.drawRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
} else if (p.x < BOXSIZE*6) {
currentcolor = ILI9341_MAGENTA;
tft.drawRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
}
if (oldcolor != currentcolor) {
if (oldcolor == ILI9341_RED)
tft.fillRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_RED);
if (oldcolor == ILI9341_YELLOW)
tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_YELLOW);
if (oldcolor == ILI9341_GREEN)
tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_GREEN);
if (oldcolor == ILI9341_CYAN)
tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_CYAN);
if (oldcolor == ILI9341_BLUE)
tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_BLUE);
if (oldcolor == ILI9341_MAGENTA)
tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_MAGENTA);
}
}
if (((p.y-BANNED) > BOXSIZE) && ((p.y+BANNED) < tft.height())) {
tft.fillCircle(p.x, p.y, BANNED, currentcolor);
}
}
- WalesHighlander
- Posts: 3
- Joined: Thu Sep 13, 2018 6:48 pm
Re: TFT LCD problems with STMPE STMPE610
I have the same hardware (ILI9341 + STMPE610) and have not even found how to electrically connect the two. Where is the documentation for the electrical connections please?
Please be positive and constructive with your questions and comments.