drivers: serial: stm32: Add Line Break Detection

The current driver doesn't handle the LBD flag, this leads
uart_stm32_err_check to return always true if a Line Break
is detected.

This PR adds Line Break Detection and the related flag clearing,
F0 series it's excluded from the changes.

Fixes zephyrproject-rtos#41339

Signed-off-by: Andrea Campanella <andrea.campanella@helvar.com>
This commit is contained in:
Andrea Campanella 2021-12-21 16:09:15 +00:00 committed by Carles Cufí
commit b2190fd703

View file

@ -586,6 +586,16 @@ static int uart_stm32_err_check(const struct device *dev)
err |= UART_ERROR_FRAMING;
}
#if !defined(CONFIG_SOC_SERIES_STM32F0X) || defined(USART_LIN_SUPPORT)
if (LL_USART_IsActiveFlag_LBD(UartInstance)) {
err |= UART_BREAK;
}
if (err & UART_BREAK) {
LL_USART_ClearFlag_LBD(UartInstance);
}
#endif
if (err & UART_ERROR_OVERRUN) {
LL_USART_ClearFlag_ORE(UartInstance);
}
@ -597,7 +607,6 @@ static int uart_stm32_err_check(const struct device *dev)
if (err & UART_ERROR_FRAMING) {
LL_USART_ClearFlag_FE(UartInstance);
}
/* Clear noise error as well,
* it is not represented by the errors enum
*/