UART double callback

I’m testing two Kelly reference designs with the code below, and it appears that I am getting a double callback. I simply have TX and RX connected on the DB9 output. Both Imps are recently updated to firmware release 30.

`text <- “”;
function readSerial() {
local ch = null;
while ((ch = uart.read()) != -1) {
// drop most control characters
if (ch > 0x20) {
// Append the string to the end
text = text + ch.tochar();
}
else {
//Reset the buffer
text = “”;
}
}
server.log(text);
}

// Configure UART
uart <- hardware.uart1289;
uart.configure(115200, 8, PARITY_NONE, 1, NO_CTSRTS, readSerial);
uart.write(“ABC”);`

And I get this:
2014-09-06 10:30:06 UTC-4 [Status] Downloading new code; 2.51% program storage used
2014-09-06 10:30:07 UTC-4 [Device] ABC
2014-09-06 10:30:07 UTC-4 [Device] ABC

I believe this is normal behaviour. Before the first callback executed another callback from the next character entering the RX buffer could have been queued. When the callback executes it might actually empty the buffer on the first run through and hence the next callback happens with no data pending.

I’m actually surprised that you got the entire string in the first callback…

Yeah, something else is going on that I am trying to determine. That only happens at a high baud rate. I’m actually getting a callback when the TX and RX pins aren’t even connected, as though there were a short in the hardware.

Yep, continuity test confirms that TX and RX are somehow shorted on both of my Kelly’s.

Ooops, apparently, I placed a couple of DNS components.

Edit… and my Kellys’ are chatting happily with each other.