Skip to content

Commit 3c09c21

Browse files
warasilapmMaureenHelm
authored andcommitted
drivers: serial: uart_stm32: tx/rx swap in init()
Previously, the uart_stm32 driver was extended in #44487 to support swapping the tx and rx pins of supported STM32 UART peripherals. However, the original change applied this configuration during the call to the uart_stm32_configure() function. This has now been added to the uart_stm32_init() function to ensure this behavior on startup for ports like the virtual com port. Signed-off-by: Peter Maxwell Warasila <[email protected]>
1 parent cefb004 commit 3c09c21

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/serial/uart_stm32.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -473,12 +473,6 @@ static int uart_stm32_configure(const struct device *dev,
473473
data->baud_rate = cfg->baudrate;
474474
}
475475

476-
#ifdef LL_USART_TXRX_SWAPPED
477-
if (config->tx_rx_swap) {
478-
LL_USART_SetTXRXSwap(config->usart, LL_USART_TXRX_SWAPPED);
479-
}
480-
#endif
481-
482476
LL_USART_Enable(config->usart);
483477
return 0;
484478
};
@@ -1612,6 +1606,12 @@ static int uart_stm32_init(const struct device *dev)
16121606
LL_USART_EnableHalfDuplex(config->usart);
16131607
}
16141608

1609+
#ifdef LL_USART_TXRX_SWAPPED
1610+
if (config->tx_rx_swap) {
1611+
LL_USART_SetTXRXSwap(config->usart, LL_USART_TXRX_SWAPPED);
1612+
}
1613+
#endif
1614+
16151615
LL_USART_Enable(config->usart);
16161616

16171617
#ifdef USART_ISR_TEACK

0 commit comments

Comments
 (0)