Imp Serial problem with Due

I have an IMP talking to an Arduino Due, both are 3.3 volt system. The Imp can send to the arduino without issue. The problem is the imp cannot receive the from the arduino correctly. It does not happen all the time but once every 10 -50 exchanges the imp serial buffer is screwed up. I have tied Serial1 to Serial3 on the arduino to have a “loopback”. I write on 1 read on 3 to see what was written. Here is the arduino code:
void setup() {
Serial.begin(9600);
Serial3.begin(230400);
Serial1.begin(230400);
Serial3.flush();
Serial.println(“Ready”);
}

void loop() {
Serial.println(“Sending Hello”);
Serial3.write(“Hello\r
”);

while (Serial1.available())
{
char retChars = Serial1.read();
Serial.print(retChars);
}
delay(5000);
}

Here is the IMP code
function readPort()
{
server.log(“Trying to read port”);
local retChar = arduino.read();
if ( retChar == -1 )
{
server.log(“No Data”);
}
while( retChar != -1 )
{
local tmpString = format(“Char was : %c”, retChar)
server.log(tmpString);
retChar = arduino.read();
}

}
// Set an alarm for 5s from now
arduino <- hardware.uart12;
arduino.configure(230400, 8, PARITY_NONE, 1, NO_CTSRTS, readPort);

Here is the output from the IMP dashboard.
2013-12-15 14:13:51 UTC-7: [Device] Trying to read port
2013-12-15 14:13:51 UTC-7: [Device] Char was : H
2013-12-15 14:13:51 UTC-7: [Device] Char was : e
2013-12-15 14:13:51 UTC-7: [Device] Char was : l
2013-12-15 14:13:51 UTC-7: [Device] Char was : l
2013-12-15 14:13:51 UTC-7: [Device] Char was : o
2013-12-15 14:13:51 UTC-7: [Device] Char was :
2013-12-15 14:13:51 UTC-7: [Device] Char was :
2013-12-15 14:13:51 UTC-7: [Device] Trying to read port
2013-12-15 14:13:51 UTC-7: [Device] No Data
2013-12-15 14:13:56 UTC-7: [Device] Trying to read port
2013-12-15 14:13:56 UTC-7: [Device] Char was :
2013-12-15 14:13:56 UTC-7: [Device] Char was :
2013-12-15 14:13:56 UTC-7: [Device] Char was : o
2013-12-15 14:13:56 UTC-7: [Device] Char was : l
2013-12-15 14:13:56 UTC-7: [Device] Char was : l
2013-12-15 14:13:56 UTC-7: [Device] Char was : e
2013-12-15 14:13:56 UTC-7: [Device] Char was : H
2013-12-15 14:13:56 UTC-7: [Device] Trying to read port
2013-12-15 14:13:56 UTC-7: [Device] No Data
2013-12-15 14:14:01 UTC-7: [Device] Trying to read port
2013-12-15 14:14:01 UTC-7: [Device] Char was : H
2013-12-15 14:14:01 UTC-7: [Device] Char was : e
2013-12-15 14:14:01 UTC-7: [Device] Char was : l
2013-12-15 14:14:01 UTC-7: [Device] Char was : l
2013-12-15 14:14:01 UTC-7: [Device] Char was : o
2013-12-15 14:14:01 UTC-7: [Device] Char was :
2013-12-15 14:14:01 UTC-7: [Device] Char was :
2013-12-15 14:14:01 UTC-7: [Device] Trying to read port
2013-12-15 14:14:01 UTC-7: [Device] No Data
2013-12-15 14:14:06 UTC-7: [Device] Char was :
2013-12-15 14:14:06 UTC-7: [Device] Char was :
2013-12-15 14:14:06 UTC-7: [Device] Char was : o
2013-12-15 14:14:06 UTC-7: [Device] Char was : l
2013-12-15 14:14:06 UTC-7: [Device] Char was : l
2013-12-15 14:14:06 UTC-7: [Device] Char was : e
2013-12-15 14:14:06 UTC-7: [Device] Char was : H
2013-12-15 14:14:06 UTC-7: [Device] Trying to read port
2013-12-15 14:14:06 UTC-7: [Device] No Data
2013-12-15 14:14:06 UTC-7: [Device] Trying to read port
2013-12-15 14:14:11 UTC-7: [Device] Trying to read port
2013-12-15 14:14:11 UTC-7: [Device] Char was : H
2013-12-15 14:14:11 UTC-7: [Device] Char was : e
2013-12-15 14:14:11 UTC-7: [Device] Char was : l
2013-12-15 14:14:11 UTC-7: [Device] Char was : l
2013-12-15 14:14:11 UTC-7: [Device] Char was : o
2013-12-15 14:14:11 UTC-7: [Device] Char was :
2013-12-15 14:14:11 UTC-7: [Device] Char was :
2013-12-15 14:14:11 UTC-7: [Device] Trying to read port
2013-12-15 14:14:11 UTC-7: [Device] No Data
2013-12-15 14:14:16 UTC-7: [Device] Trying to read port
2013-12-15 14:14:16 UTC-7: [Device] Char was : H
2013-12-15 14:14:16 UTC-7: [Device] Char was : e
2013-12-15 14:14:16 UTC-7: [Device] Char was : l
2013-12-15 14:14:16 UTC-7: [Device] Char was : l
2013-12-15 14:14:16 UTC-7: [Device] Char was : o
2013-12-15 14:14:16 UTC-7: [Device] Char was :
2013-12-15 14:14:16 UTC-7: [Device] Char was :

Note that two are flipped, it is not always flipped, sometime just a few characters are out of place.

Any ideas? I have tried 9600 baud, more buffering
2013-12-15 14:19:02 UTC-7: [Device] Trying to read port
2013-12-15 14:19:02 UTC-7: [Device] No Data
2013-12-15 14:19:07 UTC-7: [Device] Trying to read port
2013-12-15 14:19:07 UTC-7: [Device] Char was : H
2013-12-15 14:19:07 UTC-7: [Device] Char was : e
2013-12-15 14:19:07 UTC-7: [Device] Char was : l
2013-12-15 14:19:07 UTC-7: [Device] Trying to read port
2013-12-15 14:19:07 UTC-7: [Device] Char was : l
2013-12-15 14:19:07 UTC-7: [Device] Char was : o
2013-12-15 14:19:07 UTC-7: [Device] Char was :
2013-12-15 14:19:07 UTC-7: [Device] No Data
2013-12-15 14:19:07 UTC-7: [Device] Trying to read port
2013-12-15 14:19:07 UTC-7: [Device] Char was :
2013-12-15 14:19:12 UTC-7: [Device] Trying to read port
2013-12-15 14:19:12 UTC-7: [Device] Char was : H
2013-12-15 14:19:12 UTC-7: [Device] Char was : e
2013-12-15 14:19:12 UTC-7: [Device] Char was : l
2013-12-15 14:19:12 UTC-7: [Device] Trying to read port
2013-12-15 14:19:12 UTC-7: [Device] Char was : l
2013-12-15 14:19:12 UTC-7: [Device] Char was : o
2013-12-15 14:19:12 UTC-7: [Device] Char was :
2013-12-15 14:19:12 UTC-7: [Device] Char was :

matt

That is probably just the weird issue with the agent logging. Sometimes logs get flipped. Your data is probably correct, even though it doesn’t look like it. Its a known issue.

Hmm, okay. I will try and buffer it and compare it.

Thanks,

@mtstarr - if it’s just a “logging out of order” issue - refreshing your browser should fix it (ie - if you refresh your browser, the logs will be in the correct order).