Hi Richard,
- Does getc() block forever when it is waiting for input ?
- While getc() is not getting called, does the mbed buffer incoming bytes on that port ? And if so, how big is the buffer ?
Yes, getc() blocks forever. You can use readable() to see if there is anything to read or not (and hence would block). e.g.
while(myserial.readable()) {
char c = myserial.getc();
}
The UART hardware has a buffer of 16-bytes, so you will get some buffering, but any more than this and they'll be getting dropped.
We are just experimenting with some interrupt driven UART abstractions which would allow you to build things like a software buffered UART very easily if that is of interest.
Simon
I'm talking to a camera over a serial connection, and I seem to be losing bytes. Which raises two questions:
- Does getc() block forever when it is waiting for input ?
- While getc() is not getting called, does the mbed buffer incoming bytes on that port ? And if so, how big is the buffer ?
Thanks,
Richard