Skip to content

K64F serial_readable gives misleading result after overrun error #1987

Closed
@infinnovation-dev

Description

@infinnovation-dev

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions