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

ESP8266: Fix serial flow control inconsistency on reconnect #15240

Merged

Conversation

ccli8
Copy link
Contributor

@ccli8 ccli8 commented Mar 3, 2022

Summary of changes

The PR tries to address the test failure of connectivity-netsocket-tests-tests-network-interface. In the test, serial channel will break with the sequence:

: `ESP8266Interface::connect()` > `ESP8266Interfacedisconnect()` > `ESP8266Interfaceconnect()`

In the first connect, both board's and ESP8266's serial flow control default to disabled, and then enabled. However, in the second connect, board's serial flow control keeps enabled but ESP8266's resets to disabled, causing inconsistency between two ends.

The approach is explicitly disable board's serial flow control on ESP8266 re-power or reset in (re-)connect.


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Mar 3, 2022
@ciarmcom
Copy link
Member

ciarmcom commented Mar 3, 2022

@ccli8, thank you for your changes.
@ARMmbed/mbed-os-maintainers please review.

0xc0170
0xc0170 previously requested changes Mar 3, 2022
* @return true if started
*/
bool stop_uart_hw_flow_ctrl();
bool stop_uart_hw_flow_ctrl(bool board_only);
Copy link
Contributor

Choose a reason for hiding this comment

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

As this is public method, this would be breaking, wouldn't it?

What if we add overload adding boolean argument, we could deprecate the old method if it is necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about C++ default argument:

bool stop_uart_hw_flow_ctrl(bool board_only = false);

The call to stop_uart_hw_flow_ctrl() without board_only specified will translate to stop_uart_hw_flow_ctrl(false) for compatibility.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to go with default parameter

The commit will address the test failure of connectivity-netsocket-tests-tests-network-interface.
In the test, serial channel will break with the sequence: ESP8266Interface::connect() > disconnect() > connect()
In the first connect, both board's and ESP8266's serial flow control default to disabled, and then enabled.
In the second connect, board's serial flow control keeps enabled but ESP8266's resets to disabled, causing inconsistency between two ends.

The approach: Explicitly disable board's serial flow control on re-power or reset in (re-)connect
@ccli8 ccli8 force-pushed the nuvoton_esp8266_flow_control_reconnect branch from 08e9732 to 0d2de99 Compare March 7, 2022 10:31
@mergify mergify bot dismissed 0xc0170’s stale review March 7, 2022 10:31

Pull request has been modified.

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 8, 2022

CI started

@mergify mergify bot added needs: CI and removed needs: work labels Mar 8, 2022
@mbed-ci
Copy link

mbed-ci commented Mar 8, 2022

Jenkins CI Test : ✔️ SUCCESS

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️

@0xc0170 0xc0170 merged commit 170aea5 into ARMmbed:master Mar 9, 2022
@mergify mergify bot removed the ready for merge label Mar 9, 2022
@ccli8 ccli8 deleted the nuvoton_esp8266_flow_control_reconnect branch March 10, 2022 09:56
@mbedmain mbedmain added release-version: 6.16.0 Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants