The STM32 USARTv2 driver has various errors in hal/platforms/STM32/USARTv2/uart_lld.c:
1. Various bits in CR2 and CR3 can only be written while the UART is disabled. Therefore the order of updating CR1..CR3 in uart_start() needs to be reversed, to do CR1 last.
Some 16-bit values need to be 32-bit to reflect the underlying register sizes:
96: translate_errors() should probably take a 32-bit parameter
156: usart_start() - cr1 to be 32-bit
271: serve_usart_irq() - isr to be 32-bit
Possible coding efficiency:
177 usart_start() - should be no need to reset pending interrupts; done by disabling UART.
Annotated file attached