Closed
Description
Using e.g. UART2 which has no FIFO, an overrun can cause the following unwelcome behaviour:
if (serial_readable(s)) {
c = serial_getc(s); // Hangs forever if no further character received
...
When serial_readable detects an overrun error, it calls UART_ClearStatusFlags; this reads S1 and D, which as well as clearing the overrun flag also clears the RDRF flag. serial_getc now loops calling serial_readable which now returns false.