Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(serial): add timeout support to flush()#2124

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
fpistm merged 2 commits intostm32duino:mainfromfpistm:Serial_flush_timeout
Sep 11, 2023

Conversation

fpistm
Copy link
Member

@fpistmfpistm commentedSep 8, 2023
edited
Loading

when called byend().
Default, no timeout (0). When called byend(), default timeout is
TX_TIMEOUT which can be redefined if needed.

Fixes#2122.

Tested with below sketch on a Nucleo-WL55JC1.
Serial1 is instantiate with CTS/RTS. With original code, it wait forever while with this PR it continue afterTIMEOUT_TX expiration.

HardwareSerialSerial1(PB7, PB6, PB3, PB4);uint32_t baud_val[] = {1200,2400,4800,9600,115200,250000};// the setup routine runs once when you press reset:voidsetup() {// initialize serial communication at 9600 bits per second:  Serial.begin(9600);}// the loop routine runs over and over again forever:voidloop() {for (uint8_t idx =0; idx <6; idx++) {    Serial1.end();    Serial.printf("Test %u\n", baud_val[idx]);    Serial1.begin(baud_val[idx]);    Serial1.println("ATE0");  }delay(100);}
Output
09:20:52.421 -> Test 120009:20:53.419 -> Test 240009:20:54.384 -> Test 480009:20:55.383 -> Test 960009:20:56.380 -> Test 11520009:20:57.379 -> Test 25000009:20:58.473 -> Test 120009:20:59.471 -> Test 240009:21:00.470 -> Test 480009:21:01.465 -> Test 9600

Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
when called by end().Default, no timeout (0). When called by end(), default timeout isTX_TIMEOUT which can be redefined if needed.Fixesstm32duino#2122Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
@fpistmfpistm added enhancementNew feature or request fix 🩹Bug fix labelsSep 8, 2023
@fpistmfpistm added this to the2.7.0 milestoneSep 8, 2023
@fpistmfpistm merged commit6f39b41 intostm32duino:mainSep 11, 2023
@fpistmfpistm deleted the Serial_flush_timeout branchSeptember 11, 2023 07:19
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
enhancementNew feature or requestfix 🩹Bug fix
Projects
Milestone
2.7.0
Development

Successfully merging this pull request may close these issues.

HardwareSerial hangs in flush() with flow control enabled and no device attached
1 participant
@fpistm

[8]ページ先頭

©2009-2025 Movatter.jp