SainSmart 2.8" touch problems - no touches registering

Hi all. I'm new to Arduino, so bear with me.

I bought the SainSmart 2.8" TFT touch screen with the Due shield for my SainSmart Due clone.

Using Henning Karlsen's UTFT I got the screen working (UTFT myGLCD(CTE28, 25, 26, 27, 28)) and uncommenting that Shield define in the hardware folder. I was able to run several demo programs and they drew on the screen just fine.

I then installed the UTOUCH library, and have been attempting to get touch data. Neither the calibration program nor the other examples register any touches. Everything is drawn just fine, just no touches are registered.

I initialized the UTOUCH with UTouch myTouch( 6, 5, 4, 3, 2);

Since I'm new to Arduino and didn't know any better way to debug this, I started inserting Serial.println() statements into the calibration code to see how far I was getting.

It was hanging in his waitForTouch() function in the while (myTouch.dataAvailable() == false) {} line.

I went into the UTouch.cpp file and added the following to UTouch::dataAvailable() right after the line avail = !(rbi(P_IRQ, B_IRQ);

static byte printCount = 0;

if (avail == true) {
Serial.print("X");
delay(50);
}
else {
Serial.print(".");
printCount++;
if (printCount == 80) Serial.println("");
printCount %= 80;
}

I could now watch in the serial monitor as page after page of the . character flew by with not a single X, despite touching the screen in numerous places with a stylus, my finger, or anything else.

Has anyone else gotten UTouch to work with this screen? Is it likely I've got a bad touchscreen, or (my gut feeling here) is this just a programming issue? Are there different pins I should be using in my UTouch initialization than the 6, 5, 4, 3, 2 Due default?

I didn't realize SainSmart were the bad guys in this drama until reading more on Henning Karlsen's site. I've also searched the forum archives here without finding anything that solved this. I did find comments by Henning calling the SainSmart product crappy, and that he has never and will never support it. So I know better than to ask him. If I'd known this in advance I would have bought my screen from another company.

Thanks for any help!

It is a pity more people didn't use the forums BEFORE they bought Sainshit products!! But since you have it now, there is an alternative set of pins on the DUE but on my shield, I had to put a solder blob on one of the jumper, and my touch pins are now 6,5,32,3,2. Worth a try? UTouch  myTouch(6,5,32,3,2);

Regards,

Graham

I haven't modified a shield before. So you put a solder blob on a jumper, and now the shield's pin 4 is connected to pin 32 on the Due? Are you using the Sainsmart shield, or whatever design they ripped off? If so, which jumper was that? I'm looking at it, but haven't figure it out.

Thanks!

I compared this SainSmart CTE shield with a photo of another company's CTE shield for Due, and there were some differences.

On the SainSmart board JP1 was shorted, not JP2, so it's running at 5V instead of 3.3V. I'm happy I haven't fried the Due yet with this. (or have I?)

JP3 was shorted, not JP4, so the backlight is also running at 5V instead of 3.3V. I'm not sure if that's a big deal, since I don't think that's connected to any outputs on the Due.

I've gone ahead and opened JP1 and JP3, and shorted JP2 and JP4, so the board and backlight are running at 3.3V.

The touches still don't register.

I also changed my UTouch initializer to pin 32 instead of pin 4. Still didn't register any touches. I've tried both 4 and 32 at both 3.3V and the original 5V. None of them register any touches.

Is it likely that a pin on my Due has been fried trying to receiving signals from the touch IC at 5V instead of 3.3V?

Well, I will give you points for trying! :stuck_out_tongue:

In case you didn’t realise, I don’t like Saincrap! If you spend as much time on the forums as I have, you will rapidly realise they are the leading supplier of problems :’( . The number of posts from newbies and their first post goes like ‘I just bought a Sainsmart XXX and it don’t work, help’ is unbelievable!

Is your JP10 Bridged? This is what makes pin 4 TP_Din. JP10 open is pin 32. You were right to change LCD_VCC and LEDA+ to 3.3V, my GENUINE CTE shield was supplied that way! :wink: But you don’t need to worry about frying the DUE, if anything is fried, it will be the LCD. You should check the datasheet for your display to what the correct voltages are.

I have attached the CTE shield PDF in case you don’t already have it.

So now let’s try to get SOMETHING out of your touch screen…

#include <UTFT.h>
#include <UTouch.h>
UTFT     myGLCD(XXXX, 25, 26, 27, 28);
UTouch  myTouch( 6, 5, 32, 3, 2);
//UTouch  myTouch( 6, 5, 4, 3, 2);
void setup()
{
  myGLCD.InitLCD();
  myGLCD.clrScr();
  myTouch.InitTouch();
  myTouch.setPrecision(PREC_MEDIUM);
  Serial.begin(115200);
}
void loop()
{
  long x, y;
  myTouch.read();
  x = myTouch.getX();
  y = myTouch.getY();
  Serial.print("x ");
  Serial.print(x);
  Serial.print(" y ");
  Serial.println(y);
}

Good luck,

Graham

DUE_Shield_schematic.pdf (16.3 KB)

Graham, thanks for your help! It's still not solved, but I appreciate your efforts.

JP10 was open on my board, so pin 32 is the right one. For kicks, I shorted JP10 and tried it with pin 4, and it didn't work, so I wicked up the solder again and am continuing with pin 32.

I tried your sample code and all I get is -1 for X and Y.

At some point I'll pass a critical mass of bullshit and just buy a new screen/shield from someone else that actually is reputable, and works. When I decided to try Arduino I bought my crap off eBay after an hour or two's reading (just enough to know that I wanted the Due rather than the UNO). I'll never buy SainSmart again of course, that goes without saying. Not just the fact that this touch isn't working. Just looking at those voltage jumpers and realizing they shipped a Due shield with 5V enabled instead of 3.3V was alarming, to say the least. Could have fried my board.

I'll spend a little more time poking around in UTouch.cpp. I'd like to see where that -1 is coming from. I'll look at the things coming back from the lower-level code and see what I find. I totally grok that I'm a newb here, and there's nothing like a good education to set me up for the future.