Also, when using simple debug code:
#include "mbed.h"
DigitalOut myled(LED1);
Serial pc(USBTX,USBRX);
Serial gps(p13,p14);
Serial imu(p9,p10);
int main() {
pc.baud(921600);
gps.baud(115200);
imu.baud(57600);
pc.printf("mbed Serial Terminal");
wait(1);
while (1) {
if (pc.readable()) {
imu.putc(pc.getc());
}
if (imu.readable()) {
pc.putc(imu.getc());
}
}
}
I get this:
mbed Serial Terminal$@�0B¥H¥)¥JJ•*Æ„$@�0R¥H¥)¥JJ•*Æ„å3�¤Äß–B¥H¥)¥�JJu„%%©R!*Æ
Æ'þ$@�0B¥Hå)¥JJ•*Æ„å3�¤Äß–B¥Hå)¥�JJu„%%©R!*ÆÆí'þ$@�0Z¥H%)¥JJ•*Æ„å3sÄÄß–B¥H%)
¥�JJu„%%©R!*ÆÆmOü$@�0Z¥He)¥JJ•*Æ„å3sÄÄß–B¥He)¥�JJu„%%©R!*ÆÆ-Oü$@�0B¥ˆ%)¥JJ•*Æ
„å3�$Äß–B¥ˆ%)¥�JJu„%%©R!*ÆÆOü$@�0Z¥ˆe)¥JJ•*Æ„å3s�Äß–B
If I connect the GPS or IMU to my pc using a usb-to-serial transceiver, they work fine so the mbed is at fault somewhere.
Hi all,
I have 2 serial devices connected to my mbed, one is communicating at 57600 baud, and the other at 115200 baud. Both devices send sentences of around 30-80 bytes long that always terminate in the LF char ('/n' I guess).
I would simply like some way of attaching an interrupt when a whole sentence is received rather than handling stuff on a char by char basis. I see some of you have started to write libraries to handle similar things but I'm not sure where to get started. Any help appreciated!