2.8" TFTLCD - Couldn't start touchscreen controller

Hi,

I have been unable to get my LCD screen to work, i only get a back light and I keep getting this error when i start the Paint example:

Couldn't start touchscreen controller

Using UnoR3
4wire resistive 2.8" touch
Driver IC: IL19341

the test example goes through the motions and displays in serial but nothing displays on screen, just white backlight :confused:
I've been trying to get this to work for hours and finally given up after trawling the internet with no answer.

Any help would be appreciated!

What board are you using, how is it wired and what libraries are you using for both display and touch?

HazardsMind:
What board are you using, how is it wired and what libraries are you using for both display and touch?

Board: UNO
Wired: Directly on top

Libraries & code until it stops:

#include <Adafruit_GFX.h> // Core graphics library
#include <SPI.h>
#include <Wire.h>
#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 PENRADIUS 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");

Serial
Touch Paint!
Couldn't start touchscreen controller

Any ideas?

When Mr HazardsMind asked which board, we expected to see which display you have. e.g. make, model, link to website.

If you have bought an Adafruit display directly from Adafruit, the example code that Adafruit give you will just work.

If it is an anonymous Ebay display, still post a link to the actual sale or one with the same photos, dimensions etc.

Adafruit will be believable. Ebay sites often have inaccurate descriptions. So if the item in your hand does not match the Ebay photo, say what the difference(s) are.

David.

Apologies Guys,

I think i was using the wrong libraries after all, got the touch working, just need to display something now.

Should have been using these:

#include <stdint.h>
#include <TouchScreen.h>
#include <TFT.h>

Thanks

Well if you showed us what display you actually have then we could maybe help you. but you haven't provided us with any links.

You said you were using the ILI9341 display and it was on a stackable board, perhaps this library is what you need.

HazardsMind:
Well if you showed us what display you actually have then we could maybe help you. but you haven't provided us with any links.

You said you were using the ILI9341 display and it was on a stackable board, perhaps this library is what you need.
GitHub - adafruit/Adafruit_ILI9341: Library for Adafruit ILI9341 displays

No those ones don't work, they are the ones i get the problem: wont start the touchscreen

I used these to test the touch: GitHub - adafruit/Adafruit_TouchScreen: Arduino library for 4-wire resistive touchscreens

Code:

#include <stdint.h>
#include "TouchScreen.h"

// These are the pins for the shield!
#define YP A1 // must be an analog pin, use "An" notation!
#define XM A2 // must be an analog pin, use "An" notation!
#define YM 7 // can be a digital pin
#define XP 6 // can be a digital pin

#define MINPRESSURE 10
#define MAXPRESSURE 1000

// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

void setup(void) {
Serial.begin(9600);
}

void loop(void) {
// a point object holds x y and z coordinates
TSPoint p = ts.getPoint();

// we have some minimum pressure we consider 'valid'
// pressure of 0 means no pressing!
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
Serial.print("X = "); Serial.print(p.x);
Serial.print("\tY = "); Serial.print(p.y);
Serial.print("\tPressure = "); Serial.println(p.z);
}
}

and this one to test the TFT: LCD display with ILI9341 driver on Arduino - Displays - Arduino Forum

Code:

#include <stdint.h>
#include "TFTv2.h"
#include "SPI.h"

void setup()
{
TFT_BL_ON; // turn on the background light
Tft.TFTinit(); // init TFT library
}

void loop()
{
for(int r=0;r<115;r=r+2) //set r : 0--115
{
Tft.drawCircle(119,160,r,random(0xFFFF)); //draw circle, center:(119, 160), color: random
}
delay(10);
}

Seriously, if you reveal which display you have, you would get some sound advice. e.g. which libraries are the most effective. What to do if the Touch seems to work the wrong way. etc.

David.

Stokez:
Apologies Guys,

I think i was using the wrong libraries after all, got the touch working, just need to display something now.

Should have been using these:

#include <stdint.h>
#include <TouchScreen.h>
#include <TFT.h>

Thanks

i did say sorry and i have it working !!!

Perhaps English is not your native language.

The only screen that would use the <TFT.h> library would be this one: https://www.arduino.cc/en/Main/GTFT

which is 1.77" diagonal and does not have a TouchScreen.

Adafruit has a 2.8" diagonal Touchscreen : 2.8 TFT LCD with Touchscreen Breakout Board w/MicroSD Socket [ILI9341] : ID 1770 : $29.95 : Adafruit Industries, Unique & fun DIY electronics and kits
but it certainly would not work with <TFT.h>

Seriously, if you say which display that you have, you would get an accurate answer very quickly.

David.

I'm new to this site and Arduino David but thank you for your kind replies, i do have mine working but i understand others may also benefit if they are having similar issues.

So here is my screen, it uses the <TFT.h> library which i have a modified version from nid69ita (which is working really well), now all i need to do is get the SD card reader working and job done:

Link
http://linksprite.com/wiki/index.php5?title=Touch_LCD_Shield