drivers/periph/uart: add periph_uart_tx_ondemand feature#20108
Merged
benpicco merged 4 commits intoRIOT-OS:masterfrom Dec 14, 2023
Merged
drivers/periph/uart: add periph_uart_tx_ondemand feature#20108benpicco merged 4 commits intoRIOT-OS:masterfrom
benpicco merged 4 commits intoRIOT-OS:masterfrom
Conversation
benpicco
commented
Nov 24, 2023
| #ifndef SOFT_UART_PARAMS_H | ||
| #define SOFT_UART_PARAMS_H | ||
|
|
||
| #include "board.h" |
Contributor
Author
There was a problem hiding this comment.
This is not exactly related to this PR, but without it SOFT_UART_PARAM_xx set in board.h would not get applied.
I first thought of using the software UART to invert the line polarity, but then I found I can use a real UART instead if I re-configure the TX pin.
maribu
reviewed
Dec 10, 2023
1ea4955 to
ce92bcc
Compare
ce92bcc to
9cde80e
Compare
maribu
approved these changes
Dec 14, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
We have a one-wire bus where the idle level is LOW:
If two sensors pull the bus high at the same time, no-one will be able to send anything.
To make this work with standard UART where idle is LOW, we employ a little hack in which we de-mux the UART TX pin when we are not sending and only mux it to TX when we want to send a frame.
This generates a spurious 0 byte after the de-muxing, but since our DOSE frames are well delimited, this noise outside the frame is no issue.
Testing procedure
This bus is really slow (2400 Baud) but it works:
Issues/PRs references
previous attempt at this was #14300