Hi,
I’m working on a project where my imp needs to talk to another device over a serial port.
I’m using uart57, which is working well for sending data. However when it reads incoming bytes it seems to get stuck in a loop.
here is my read function:
`
// This function reads any data from the serial port
function readSerial(){
server.log("Reading Serial");
local byte = matrix.read();
while (byte != -1) {
server.log("serial: " + byte);
}
}
`
And the configuration:
matrix <-hardware.uart57; matrix.configure(115200,8, PARITY_NONE,1, NO_CTSRTS, readSerial);
Now when I send a command to the device, it will echo back the characters to the serial port. And then once it’s completed the command it sends <done>
back.
But the imp seems to keep printing this constantly until I unplug it:
2014-05-08 19:13:27 UTC+1: [Device] serial: 115 2014-05-08 19:13:27 UTC+1: [Device] serial: 115 2014-05-08 19:13:27 UTC+1: [Device] serial: 115 2014-05-08 19:13:27 UTC+1: [Device] serial: 115 2014-05-08 19:13:27 UTC+1: [Device] serial: 115 2014-05-08 19:13:27 UTC+1: [Device] serial: 115 2014-05-08 19:13:27 UTC+1: [Device] serial: 115 2014-05-08 19:13:27 UTC+1: [Device] serial: 115 2014-05-08 19:13:27 UTC+1: [Device] serial: 115 2014-05-08 19:13:27 UTC+1: [Device] serial: 115
I’ve checked the RX and TX with my logic analyser and I can confirm that nothing strange is being sent from the device.
Does anyone know what might be causing this?
Thanks,
James