Skip to content

Commit 1963e0e

Browse files
authored
Merge pull request #2078 from LMESTM/fix_l0_lpuart_baudrate
[STM32L0] Fix baudrate initialisation
2 parents 26e9aa4 + 0bc9d15 commit 1963e0e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

hal/targets/hal/TARGET_STM/TARGET_STM32L0/serial_api.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,13 @@ static void init_uart(serial_t *obj)
5353
{
5454
UartHandle.Instance = (USART_TypeDef *)(obj->uart);
5555

56-
if (obj->uart == LPUART_1) {
57-
UartHandle.Init.BaudRate = obj->baudrate >> 1;
58-
} else {
59-
UartHandle.Init.BaudRate = obj->baudrate;
60-
}
56+
UartHandle.Init.BaudRate = obj->baudrate;
6157
UartHandle.Init.WordLength = obj->databits;
6258
UartHandle.Init.StopBits = obj->stopbits;
6359
UartHandle.Init.Parity = obj->parity;
6460
UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
61+
UartHandle.Init.OverSampling = UART_OVERSAMPLING_16;
62+
UartHandle.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_ENABLE;
6563

6664
if (obj->pin_rx == NC) {
6765
UartHandle.Init.Mode = UART_MODE_TX;

0 commit comments

Comments
 (0)