Skip to content

Support U[S]ART Inversion on STM32U0 #2669

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ndoo opened this issue Mar 4, 2025 · 2 comments · Fixed by #2701
Closed

Support U[S]ART Inversion on STM32U0 #2669

ndoo opened this issue Mar 4, 2025 · 2 comments · Fixed by #2701
Labels
duplicate This issue or pull request already exists enhancement New feature or request
Milestone

Comments

@ndoo
Copy link
Contributor

ndoo commented Mar 4, 2025

STM32U0 (and possibly other parts) support level inversion with the following:

huartx.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_TXINVERT_INIT;
huartx.AdvancedInit.TxPinLevelInvert = UART_ADVFEATURE_TXINV_ENABLE;

Please support these through the Arduino core.

Alternative workarounds include inverting the content before sending, or using an inverting buffer, but supporting this natively would be preferable.

Additional context

This is to support SDI-12 using the single-pin mode of the USART.

@ndoo ndoo added the enhancement New feature or request label Mar 4, 2025
@fpistm fpistm added the duplicate This issue or pull request already exists label Mar 4, 2025
@fpistm
Copy link
Member

fpistm commented Mar 4, 2025

Hi @ndoo
this issue is a duplicate of #1160 and already reference in #1418.
Feel free to contribute, for example UART Tx Rx pin swap function was added by a contributor in #2601.

@fpistm fpistm closed this as completed Mar 4, 2025
@fpistm fpistm mentioned this issue Mar 4, 2025
4 tasks
@ndoo
Copy link
Contributor Author

ndoo commented Mar 5, 2025

Hi @fpistm, thanks for capturing it on the list.

For now my plan is to add the inversion in hardware as I'm also adding a level shifter to 5V, but if I find some time I will take a look at #2601.

ndoo added a commit to ndoo/Arduino_Core_STM32 that referenced this issue Mar 27, 2025
This enables UART Tx and Rx invert function on STM32 families that support it.

In order to enable Tx and Rx invert, call respectively:

```c++
Serial1.setTxInvert();
Serial1.setRxInvert();
```

Fixes: stm32duino#1160 stm32duino#2669
See also: stm32duino#1418

Signed-off-by: Andrew Yong <me@ndoo.sg>
ndoo added a commit to ndoo/Arduino_Core_STM32 that referenced this issue Mar 27, 2025
This enables UART Tx and Rx invert function on STM32 families that support it.

In order to enable Tx and Rx invert, call respectively:

```c++
Serial1.setTxInvert();
Serial1.setRxInvert();
```

Fixes: stm32duino#1160 stm32duino#2669
See also: stm32duino#1418

Signed-off-by: Andrew Yong <me@ndoo.sg>
ndoo added a commit to ndoo/Arduino_Core_STM32 that referenced this issue Mar 28, 2025
This enables UART Tx and Rx invert function on STM32 families that support it.

In order to enable Tx and Rx invert, call respectively:

```c++
Serial1.setTxInvert();
Serial1.setRxInvert();
```

Fixes: stm32duino#1160 stm32duino#2669
See also: stm32duino#1418

Signed-off-by: Andrew Yong <me@ndoo.sg>
ndoo added a commit to ndoo/Arduino_Core_STM32 that referenced this issue Mar 28, 2025
This enables UART Tx, Rx and data invert function on STM32 families that support it.

In order to enable Tx, Rx and/or data invert, call respectively:

```c++
Serial1.setTxInvert();
Serial1.setRxInvert();
Serial1.setDataInvert();
```

Fixes: stm32duino#1160 stm32duino#2669
See also: stm32duino#1418

Signed-off-by: Andrew Yong <me@ndoo.sg>
ndoo added a commit to ndoo/Arduino_Core_STM32 that referenced this issue Mar 28, 2025
This enables UART Tx, Rx and data invert function on STM32 families that support it.

In order to enable Tx, Rx and/or data invert, call respectively:

```c++
Serial1.setTxInvert();
Serial1.setRxInvert();
Serial1.setDataInvert();
```

Fixes: stm32duino#1160 stm32duino#2669
See also: stm32duino#1418

Signed-off-by: Andrew Yong <me@ndoo.sg>
ndoo added a commit to ndoo/Arduino_Core_STM32 that referenced this issue Mar 29, 2025
This enables UART Tx, Rx and data invert function on STM32 families that support it.

In order to enable Tx, Rx and/or data invert, call respectively:

```c++
Serial1.setTxInvert();
Serial1.setRxInvert();
Serial1.setDataInvert();
```

Fixes: stm32duino#1160 stm32duino#2669
See also: stm32duino#1418

Signed-off-by: Andrew Yong <me@ndoo.sg>
@fpistm fpistm added this to the 2.11.0 milestone Mar 31, 2025
@fpistm fpistm linked a pull request Mar 31, 2025 that will close this issue
3 tasks
fpistm pushed a commit that referenced this issue Mar 31, 2025
This enables UART Tx, Rx and data invert function on STM32 families that support it.

In order to enable Tx, Rx and/or data invert, call respectively:

```c++
Serial1.setTxInvert();
Serial1.setRxInvert();
Serial1.setDataInvert();
```

Fixes: #1160 #2669
See also: #1418

Signed-off-by: Andrew Yong <me@ndoo.sg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

2 participants