stm32/uart: Handle correctly the char overrun case of RXNE=0 and ORE=1.

Fixes issue #3375.
This commit is contained in:
Damien George 2019-03-29 12:56:24 +11:00
parent 2848a613ac
commit 7b5bf5f6fd
1 changed files with 10 additions and 0 deletions

View File

@ -745,6 +745,16 @@ void uart_irq_handler(mp_uint_t uart_id) {
}
}
}
// If RXNE is clear but ORE set then clear the ORE flag (it's tied to RXNE IRQ)
#if defined(STM32F4)
else if (self->uartx->SR & USART_SR_ORE) {
(void)self->uartx->DR;
}
#else
else if (self->uartx->ISR & USART_ISR_ORE) {
self->uartx->ICR = USART_ICR_ORECF;
}
#endif
// Set user IRQ flags
self->mp_irq_flags = 0;