Skip to content

Commit 0bc9d15

Browse files
author
Laurent MEUNIER
committed
[STM32L0] Fix baudrate initialisation
Issue #2074 Assuming that OverSampling is initialized, the baudrate is now correctly computed inside CMSIS (STM32 HAL) layer. This was not the case before but most probably was fixed during latest L0 cube firmware upgrade: commit ce436d5 Author: svastm <[email protected]> Date: Thu Apr 14 14:39:53 2016 +0200 Update STM32CUBE_L0 from v1.2 to v1.5
1 parent 07958da commit 0bc9d15

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)