diff --git a/os/hal/platforms/STM32/USARTv1/serial_lld.c b/os/hal/platforms/STM32/USARTv1/serial_lld.c index 9a9596424..eb344ebc0 100644 --- a/os/hal/platforms/STM32/USARTv1/serial_lld.c +++ b/os/hal/platforms/STM32/USARTv1/serial_lld.c @@ -161,7 +161,7 @@ static void serve_interrupt(SerialDriver *sdp) { chSysLockFromIsr(); chnAddFlagsI(sdp, SD_BREAK_DETECTED); chSysUnlockFromIsr(); - u->SR &= ~USART_SR_LBD; + u->SR = ~USART_SR_LBD; } /* Data available.*/ @@ -194,8 +194,8 @@ static void serve_interrupt(SerialDriver *sdp) { chSysLockFromIsr(); chnAddFlagsI(sdp, CHN_TRANSMISSION_END); chSysUnlockFromIsr(); - u->CR1 = cr1 & ~USART_CR1_TCIE; - u->SR &= ~USART_SR_TC; + u->CR1 = cr1 & ~(USART_CR1_TXEIE | USART_CR1_TCIE); + u->SR = ~USART_SR_TC; } }