I'm sending data over Serial to a FRDM-kl25z via a printf statement on another uC;
for (int i = 0; i <320; i++)
{
left--;
right++;
sprintf(left_arr, "%d", left);
sprintf(right_arr, "%d", right);
frdm.printf("%s,%s \n\r", left_arr, right_arr);
}
And I receive the data with this code in a serial interrupt - called rx_data;
void rx_data()
{
pc.printf("rx interrupted!\n\r");
string current = "";
while (rpi.readable())
{
current += rpi.getc();
}
PC.printf("%s", current);
}
I'm defining rpi as below;
Serial rpi(PTC4, PTC3); // tx, rx
It only gets the first character, so the first byte, of the Serial transmission. I've tested with a counter too and the port is only readable for 1 loop iteration.
I've tested the code with other uC's - the LPC1768 - and it works fine.
It must be the fault of the Serial port on the FRDM I think, does it only have a 1 byte buffer or something?
Thanks!