Re: amulet and serial connection speed
"Ryan Garner" <[email protected]>
| Newsgroups | gmane.comp.hardware.microcontrollers.tini |
|---|---|
| Message-ID | <001601c40e1d$421a0b20$6401a8c0@computer> |
Has anyone had trouble with transferring many requests (RPC or String Set)
from Amulet to TStik? I'm trying to send 30+ string updates using the UART
protocol. My program simply parses the data then copies it. I find that
when sending that many requests all in one HREF request from Amulet, many of
the requests simply never make it to my Java program. I've found that if I
set each update to occur approx 1 sec apart, the problem goes away. It can
usually do about 10 or so without the delay before havinging issues. I also
found that it seemed that the SerialEventListenter would also cause data
loss, I just monitor the inputSteam only. Any advise/examples on how to
inprove speed/reliability would be great.
Thanks,
Ryan Garner
My amulet code looks like :
<meta http-equiv="refresh"
content="0,.01;URL=Amulet:UART.string(5).setValue(Amulet:internalRAM.String(
125).getValue)">
(32 times for difft addresses)
My java/tStik looks like :
public void run() {
int numBytes = 0;
int temp = 0;
String tString="";
String s="";
int lastIndex=0;
while (true) {
try {
//if input Stream available
while (inStream.available() > 0) {
temp = inStream.read();
//if data keep reading til no data left
if (temp > 0) {
strCmd += new Character( (char) temp).toString();
}
else {
tString = strCmd;
strCmd = "";
s= " " + tString.substring(1) + " ";
test = s.getBytes();
lastIndex= s.length() - 1;
if ( (int) tString.charAt(0) == 216) {
test[0] = (byte) 0xE8;
}
else if ( (int) tString.charAt(0) == 215) {
test[0] = (byte) 0xE8;
}
test[lastIndex] = (byte) 0x00;
//send ack for RPC
outStream.write(test);
messageHandler(tString);
}
}
//Thread.sleep(50);
}
catch (Exception ees) {}
}
}
_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini