8000 stm32/uart: Handle correctly the char overrun case of RXNE=0 and ORE=1. · rlucia/micropython@7b5bf5f · GitHub
[go: up one dir, main page]

Skip to content

Commit 7b5bf5f

Browse files
committed
stm32/uart: Handle correctly the char overrun case of RXNE=0 and ORE=1.
Fixes issue micropython#3375.
1 parent 2848a61 commit 7b5bf5f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ports/stm32/uart.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,16 @@ void uart_irq_handler(mp_uint_t uart_id) {
745745
}
746746
}
747747
}
748+
// If RXNE is clear but ORE set then clear the ORE flag (it's tied to RXNE IRQ)
749+
#if defined(STM32F4)
750+
else if (self->uartx->SR & USART_SR_ORE) {
751+
(void)self->uartx->DR;
752+
}
753+
#else
754+
else if (self->uartx->ISR & USART_ISR_ORE) {
755+
self->uartx->ICR = USART_ICR_ORECF;
756+
}
757+
#endif
748758

749759
// Set user IRQ flags
750760
self->mp_irq_flags = 0;

0 commit comments

Comments
 (0)
0