stm32/uart: Fix LPUART init failure with low baudrate.

UART prescaler value should set up correctly to initialize LPUART with low
baudrate for STM32G0/G4/H5.  This can be implemented similarly to
STM32H7/N6/WB.

Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
This commit is contained in:
Yuuki NAGAO
2025-09-15 14:04:37 +09:00
committed by Damien George
parent 7cbe083b2c
commit c4d99f34ae

View File

@@ -673,7 +673,7 @@ bool uart_init(machine_uart_obj_t *uart_obj,
huart.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
#endif
#if defined(STM32H7) || defined(STM32N6) || defined(STM32WB)
#if defined(STM32G0) || defined(STM32G4) || defined(STM32H5) || defined(STM32H7) || defined(STM32N6) || defined(STM32WB)
// Compute the smallest prescaler that will allow the given baudrate.
uint32_t presc = UART_PRESCALER_DIV1;
if (uart_obj->uart_id == PYB_LPUART_1) {