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).
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
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.
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
en_tarak:
"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 :-
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);
}
Old Post, but the information is still valid.
You don't want to know how many swear words has come from my mouth with this problem.
And fixed with one line. Thanks
Just to add, if you did the calibration (Like I tried, many times), go back to the default settings in URTouchCD.h
I think it's also related to the input voltage,
so for an arduino mega copy, I found (by accident) that at 7 volts it works correctly.
5V USB is dodgy, 9V never worked on this one.
On another setup with genuine arduino mega, 5V USB is dodgy and it works on 9v if you remove and replug the psu 2-3 times.
Probably should try this at 7v as well...
I am using the afforementioned delay in both setups.
I didn't had this problem when compiling back in 2012-2013 with similar hardware.