Go Down

Topic: [FIXED] 3.2" touchscreen strange behaviour, sometimes works, sometimes doesn't (Read 1 time) previous topic - next topic

Timtomm

Dear Builders,

Recently I've got my SainSmart 2560 Rev 3 board + LCD shield + 3.2" LCD Touch panel from SainSmart. It was a hard work to get it into work properly, and I've reached a good milestone. At this point, I'm a bit frustrated. In short:
-- pinout is good,
-- LCD works good with other (not touch) examples,
-- all libraries are up to date and included (UTFT, UTouch, as well as calibration).

As soon as I plug in the USB cable, and upload a sketch (for example, QuickDraw, as seen on the YouTube vid below), everything is working fine. After I unplug the cable and start use the board with externap power source (or by the same USB cable as I've used to upload the sketch), touch starts to work improperly (see video). 8 out of 10 attempts are bringing into this situation. I found out, that resetting the board may help this (7 out of 10 attempts are going to bring good results). If I upload the sketch again, it's always working fine (10 out of 10 attempts).

Every sketchs are exactly the same as provided in UTouch.rar from http://www.henningkarlsen.com/electronics/ .

See YouTube video:
http://www.youtube.com/watch?v=D40PpzNX5Nc.

How can I fix this problem?

Thanks for all the replies.

Best wishes,

Tamas

eclipsegst

Hi,

maybe you can solve this with adding some delay to HW_AVR.inc
=====================================================================================
word UTouch::touch_ReadData()
{
   word data = 0;

   for(byte count=0; count<12; count++)
   {
      data <<= 1;
      sbi(P_CLK, B_CLK);
      cbi(P_CLK, B_CLK);
               delayMicroseconds(1); //// added to get more stable readings?   
      if (rbi(P_DOUT, B_DOUT))
         data++;
   }
   return(data);
}
=======================================================================================

Timtomm

Hi,
Thank you very much for the fast help. I was a chellenging task to find the right file and the right place, but it fixed the issue.
Have a nice day,
Tom

antonius1

Thank you very much. I had the same problem, and this fixed my problems.

antonius

tfuglsang

Thank you!!

I have used the last 3 days trying to solve this problem, but this solution seems solid!

We need to spread this to the forums, we are not the only one who have this issue, and it seems like the support at Sainsmart.com are completely mute on this.

Again, thank you!

cbonsell


en_tarak

hi dear eclipsegst,
my 3.2" UTFT touch sometimes work, sometimes it doesnt work. as u told in your previoue post "adding some delay to HW_AVR.inc".. i couldnt follow this point. can u plz elaborate ho to add this section of code and at what location / where to save.
thanks

ghlawrence2000

"adding some delay to HW_AVR.inc".. i couldnt follow this point. can u plz elaborate ho to add this section of code and at what location / where to save.
thanks
Arduino\Libraries\UTouch\hardware\avr\HW_AVR.inc should look like this :-
Code: [Select]
void UTouch::touch_WriteData(byte data)
{
byte temp;

temp=data;
cbi(P_CLK, B_CLK);

for(byte count=0; count<8; count++)
{
if(temp & 0x80)
sbi(P_DIN, B_DIN);
else
cbi(P_DIN, B_DIN);
temp = temp << 1;
cbi(P_CLK, B_CLK);                
sbi(P_CLK, B_CLK);
}
}

word UTouch::touch_ReadData()
{
word data = 0;

for(byte count=0; count<12; count++)
{
data <<= 1;
sbi(P_CLK, B_CLK);
cbi(P_CLK, B_CLK);
delayMicroseconds(1); //// added to get more stable readings?  
if (rbi(P_DOUT, B_DOUT))
data++;
}
return(data);
}


Regards,

Graham
UTFT_SdRaw now included in library manager!! ;) High speed image drawing from SD card to UTFT displays for Mega & DUE.
UTFT_GHL. A vastly upgraded version of the UTFT_CTE library, available for purchase NOW! PM for details.

QB_Doctor

+1 for this fix - had my Sainsmart touch screen kit for 18 months only got it to work after modding HW_AVT.inc

Cheers
Simon

ghlawrence2000

+1 for this fix - had my Sainsmart touch screen kit for 18 months only got it to work after modding HW_AVT.inc

Cheers
Simon
It is not enough to type '+1', you actually need to click [add] at the side of Karma! :P

But thanks for the thought.

Regards,

Graham
UTFT_SdRaw now included in library manager!! ;) High speed image drawing from SD card to UTFT displays for Mega & DUE.
UTFT_GHL. A vastly upgraded version of the UTFT_CTE library, available for purchase NOW! PM for details.

QB_Doctor

It is not enough to type '+1', you actually need to click [add] at the side of Karma! :P

But thanks for the thought.

Regards,

Graham
thank you for helping me with that - having no doubt noticed my post count you must have realised that I needed tuoring in the ways of righteousness  ;)

Cheers
Simon

ghlawrence2000

UTFT_SdRaw now included in library manager!! ;) High speed image drawing from SD card to UTFT displays for Mega & DUE.
UTFT_GHL. A vastly upgraded version of the UTFT_CTE library, available for purchase NOW! PM for details.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy