- Notifications
You must be signed in to change notification settings - Fork1k
fix(SoftwareSerial): correct TX to RX switch when using half-duplex#1771
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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
fpistm approved these changesJul 26, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM
ABOSTM approved these changesJul 26, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@dominikberse
thanks for sharing your findings.
Patch LGTM
julien33510 added a commit to julien33510/arduino_essai1 that referenced this pull requestOct 2, 2023
mise en place de la librairie semi-duplex trouvé sur github (stm32duino/Arduino_Core_STM32#1771) et ajout de la spécificité pour les bits de parité et les 2 bits stop=> succès
Sign up for freeto 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.
Summary
When working with single-pin half-duplex SoftwareSerial, I noticed that after the call to
listen()
receiving data is not possible until data is written. In factsetRXTX(true)
is only called withinsend()
, which in turn is only called as long asactive_out
is set (i.e. ongoing transmission). Since at the beginning oflisten()
completion of any ongoing transmissions is awaited, the SoftwareSerial will not actively listen before another transmission is completed.This PR fixes/implements the followingbugs/features
This occurs if the communication is not initiated by the STM32. Otherwise, one would simply call
listen()
and then send whatever will trigger the other side to respond.In my case, I wanted to use a second line to indicate the direction of communication (which however can not be used as a second line for full-duplex). I must admit that this is probably a very rare case, and the fix I suggest will in fact change the current behavior of calling
listen()
before sending data. However it took me a few hours to debug this and I thought I should at least mention this finding in case someone else stumbles upon it.