drivers: uart: Add support for st single wire mode
An additional devicetree poperty `single-wire` is added to uart and usart bindings of stm32. The driver checks this value during initialization and enables the single wire mode when set. Signed-off-by: Jonathan Hahn <Jonathan.Hahn@t-online.de>
This commit is contained in:
parent
ab1caef8c3
commit
32f9dcf328
4 changed files with 26 additions and 0 deletions
|
@ -1585,6 +1585,11 @@ static int uart_stm32_init(const struct device *dev)
|
|||
/* Set the default baudrate */
|
||||
uart_stm32_set_baudrate(dev, data->baud_rate);
|
||||
|
||||
/* Enable the single wire / half-duplex mode */
|
||||
if (config->single_wire) {
|
||||
LL_USART_EnableHalfDuplex(UartInstance);
|
||||
}
|
||||
|
||||
LL_USART_Enable(UartInstance);
|
||||
|
||||
#ifdef USART_ISR_TEACK
|
||||
|
@ -1701,6 +1706,7 @@ static const struct uart_stm32_config uart_stm32_cfg_##index = { \
|
|||
.hw_flow_control = DT_INST_PROP(index, hw_flow_control), \
|
||||
.parity = DT_INST_ENUM_IDX_OR(index, parity, UART_CFG_PARITY_NONE), \
|
||||
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(index), \
|
||||
.single_wire = DT_INST_PROP_OR(index, single_wire, false), \
|
||||
STM32_UART_POLL_IRQ_HANDLER_FUNC(index) \
|
||||
}; \
|
||||
\
|
||||
|
|
|
@ -23,6 +23,8 @@ struct uart_stm32_config {
|
|||
bool hw_flow_control;
|
||||
/* initial parity, 0 for none, 1 for odd, 2 for even */
|
||||
int parity;
|
||||
/* switch to enable single wire / half duplex feature */
|
||||
bool single_wire;
|
||||
const struct pinctrl_dev_config *pcfg;
|
||||
#if defined(CONFIG_PM) \
|
||||
&& !defined(CONFIG_UART_INTERRUPT_DRIVEN) \
|
||||
|
|
|
@ -11,6 +11,15 @@ properties:
|
|||
interrupts:
|
||||
required: true
|
||||
|
||||
single-wire:
|
||||
type: boolean
|
||||
required: false
|
||||
description: |
|
||||
Enable the single wire half-duplex communication.
|
||||
Using this mode, TX and RX lines are internally connected and
|
||||
only TX pin is used afterwards and should be configured.
|
||||
RX/TX conflicts must be handled on user side.
|
||||
|
||||
pinctrl-0:
|
||||
required: true
|
||||
|
||||
|
|
|
@ -11,6 +11,15 @@ properties:
|
|||
interrupts:
|
||||
required: true
|
||||
|
||||
single-wire:
|
||||
type: boolean
|
||||
required: false
|
||||
description: |
|
||||
Enable the single wire half-duplex communication.
|
||||
Using this mode, TX and RX lines are internally connected and
|
||||
only TX pin is used afterwards and should be configured.
|
||||
RX/TX conflicts must be handled on user side.
|
||||
|
||||
pinctrl-0:
|
||||
required: true
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue