I think there's a logical bug in fsl_uart.c
/* If RX overrun. */
if (UART_S1_OR_MASK & base->S1) {
/* Read base->D to clear overrun flag, otherwise the RX does not work. */
while (base->S1 & UART_S1_RDRF_MASK) {
(void) base->D;
}
The "while (base->S1 & UART_S1_RDRF_MASK)" creates a problem when the routine gets preempted by another interrupt. The RDRF can be set again, causing the routine to eat up extra bytes and/or generate additional Rx OR interrupts. After removing the while loop and reading "(void) base->D;" exactly once, the problems go away.
Hello Paul,
Which chip do you used?
I randomly check one SDK package (FRDM-K22),
it just read D once :
BR
Alice
Hi Alice_Yang,
It's the same in the latest SDK for TWR-K65F180M (2.4.1 2018-09-14).
Many thanks
Biafra
Hi,
Same problem with SDK 2.4.1 and K22FN51212
Best regards,
Nicolas
FRDM-KL25Z
I've wrote my own IRQ handler.
It would be very useful if the UART async driver could callback after receiving "special" character specified in the xfer structure, similar to SPI. (I.E. NewLine, CarriageReturn, NULL or whatever)