Skip to content

Commit 31ede6e

Browse files
committed
fix:stm32 uart timout
1 parent a63b97e commit 31ede6e

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

bsp/stm32/libraries/HAL_Drivers/drivers/drv_usart.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
static void stm32_dma_config(struct rt_serial_device *serial, rt_ubase_t flag);
3535
#endif
3636

37-
/* Number of while blocking timeouts for the stm32_putc */
38-
#define TX_BLOCK_TIMEOUT 2000
39-
4037
enum
4138
{
4239
#ifdef BSP_USING_UART1
@@ -233,8 +230,7 @@ static rt_err_t stm32_configure(struct rt_serial_device *serial, struct serial_c
233230
return -RT_ERROR;
234231
}
235232
uart->DR_mask = stm32_uart_get_mask(uart->handle.Init.WordLength, uart->handle.Init.Parity);
236-
uart->tx_block_timeout = TX_BLOCK_TIMEOUT;
237-
233+
uart->tx_block_timeout = (rt_uint32_t)(10 * HAL_RCC_GetSysClockFreq() / cfg->baud_rate / 4) ;
238234
return RT_EOK;
239235
}
240236

0 commit comments

Comments
 (0)