aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/hal/ports/STM32/LLD/USARTv1/serial_lld.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/os/hal/ports/STM32/LLD/USARTv1/serial_lld.c b/os/hal/ports/STM32/LLD/USARTv1/serial_lld.c
index 45140b88c..69b725d10 100644
--- a/os/hal/ports/STM32/LLD/USARTv1/serial_lld.c
+++ b/os/hal/ports/STM32/LLD/USARTv1/serial_lld.c
@@ -165,11 +165,16 @@ static void serve_interrupt(SerialDriver *sdp) {
/* Data available.*/
osalSysLockFromISR();
- while (sr & USART_SR_RXNE) {
+ while (sr & (USART_SR_RXNE | USART_SR_ORE | USART_SR_NE | USART_SR_FE |
+ USART_SR_PE)) {
+ uint8_t b;
+
/* Error condition detection.*/
if (sr & (USART_SR_ORE | USART_SR_NE | USART_SR_FE | USART_SR_PE))
set_error(sdp, sr);
- sdIncomingDataI(sdp, u->DR);
+ b = u->DR;
+ if (sr & USART_SR_RXNE)
+ sdIncomingDataI(sdp, b);
sr = u->SR;
}
osalSysUnlockFromISR();