Skip to content
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

Add halfduplex to serial::config::Config and example #408

Merged
merged 3 commits into from
Mar 8, 2023

Conversation

dsmcfarl
Copy link
Contributor

@dsmcfarl dsmcfarl commented Jan 1, 2023

This allows the USART's to be used with serial devices that operate in a half-duplex mode (transmit and receive on one wire). An example was also added (serial-halfduplex) and has been tested with a NUCLEO-H723ZG board. It has also been tested with a Frysky RX4R RC receiver Smart Port interface.

@richardeoin
Copy link
Member

Thanks for the PR! This looks really nice and I appreciate the explaination of the setup in the example.

In the existing HAL it was already possible to configure synchronous mode (3 wires!) by passing 3 pins during the initialisation. That then sets the CLKEN bit high here.

let mut usart6 = dp
        .USART6
        .serial((usart6txpin, usart6rxpin, usart6clk), ...);

According to the reference manual the CLKEN and HDSEL bits are mutually exclusive - so you can't set both at the same time. I think the HAL should return an error or panic in that configuration rather than just going ahead. Could you add a check and return Err() for this?

@richardeoin
Copy link
Member

The CI should now pass

bors try

bors bot added a commit that referenced this pull request Feb 23, 2023
@richardeoin
Copy link
Member

I would like to have this PR merged for the next release, so at some point I will make the change I described in my earlier comment. @dsmcfarl please let me know if that's a problem or you would prefer something else!

dsmcfarl and others added 2 commits March 6, 2023 23:18
This allows the USART's to be used with serial devices that operate in a half-duplex mode (transmit and receive on one wire). An example was also added (serial-halfduplex) and has been tested with a NUCLEO-H723ZG board. It has also been tested with a Frysky RX4R RC receiver Smart Port interface.
@richardeoin
Copy link
Member

Updated and rebased onto master

@richardeoin richardeoin added this to the v0.14.0 release milestone Mar 6, 2023
@richardeoin
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Mar 8, 2023

@bors bors bot merged commit c1a9d82 into stm32-rs:master Mar 8, 2023
@dsmcfarl
Copy link
Contributor Author

dsmcfarl commented Apr 8, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants