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

[U(S)ART] hardware flow control support #1634

Merged
merged 6 commits into from Feb 2, 2022

Conversation

akasona
Copy link
Contributor

@akasona akasona commented Jan 26, 2022

Summary

Add hardware flow control configuration APIs for U(S)ART. (list item of #1418)

void setRts(_rts);
void setCts(_cts);
void setRtsCts(_rts, _cts);

You can enable flow control on RTS/CTS separately, or enable both.
These APIs accept either uint32_t pin number or PinName.

Validation

  • All CI checks are passed.
  • I tested RTS/CTS controls with logic analyzer.
  • Tested on STM32L476RG. (Our product development board)

void setRts(_rts);
void setCts(_cts);
void setRtsCts(_rts, _cts);

These APIs accept either uint32_t pin number or PinName.
@akasona
Copy link
Contributor Author

akasona commented Jan 26, 2022

Screenshots

CTS control

The external devices's RTS signal (STM32's CTS input) rises every 4 characters, and the STM32 stops transmitting. (460800bps)

test_serial_data_integrity_with_flow_control_CTS1

RTS control

Disable the STM32's RX interrupt every 10 character reception, and the RTS signal keeps HIGH while stopping receiving. (460800bps)
Every 1 character reception causes RTS edge (I think it's because the UART has only 8bits hardware buffer).

test_serial_data_integrity_slowly_RTS

@akasona akasona mentioned this pull request Jan 26, 2022
4 tasks
@fpistm fpistm requested a review from ABOSTM January 26, 2022 12:59
@fpistm fpistm added this to In progress in STM32 core based on ST HAL via automation Jan 26, 2022
@fpistm fpistm added this to the 2.3.0 milestone Jan 26, 2022
Copy link
Contributor

@ABOSTM ABOSTM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akasona, thanks for this Pull Request.
Few inlines comments, otherwise LGTM

libraries/SrcWrapper/src/stm32/uart.c Show resolved Hide resolved
cores/arduino/HardwareSerial.cpp Outdated Show resolved Hide resolved
STM32 core based on ST HAL automation moved this from In progress to Needs review Jan 28, 2022
@akasona akasona requested a review from ABOSTM January 29, 2022 12:28
Copy link
Contributor

@ABOSTM ABOSTM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

STM32 core based on ST HAL automation moved this from Needs review to Reviewer approved Jan 31, 2022
@akasona akasona requested review from fpistm and ABOSTM January 31, 2022 13:10
@fpistm fpistm removed their request for review January 31, 2022 13:17
@fpistm fpistm merged commit 497ea5a into stm32duino:main Feb 2, 2022
STM32 core based on ST HAL automation moved this from Reviewer approved to Done Feb 2, 2022
@fpistm
Copy link
Member

fpistm commented Feb 5, 2022

Fixes #394

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

Successfully merging this pull request may close these issues.

None yet

3 participants