aboutsummaryrefslogtreecommitdiff
path: root/ports
diff options
context:
space:
mode:
authorDamien George2019-03-29 12:56:24 +1100
committerDamien George2019-04-01 13:40:35 +1100
commit7b5bf5f6fda0cfec6894c0512a3168039575405e (patch)
treebdc20332e1d93e425ec4787bc8bf1da1f089a888 /ports
parent2848a613ac61fce209962354c2698ee587a2c26a (diff)
stm32/uart: Handle correctly the char overrun case of RXNE=0 and ORE=1.
Fixes issue #3375.
Diffstat (limited to 'ports')
-rw-r--r--ports/stm32/uart.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ports/stm32/uart.c b/ports/stm32/uart.c
index e514709b7..415655103 100644
--- a/ports/stm32/uart.c
+++ b/ports/stm32/uart.c
@@ -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;