Skip to content

Prevent ESP8266 stopping HW control on init #9173

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

Merged

Conversation

michalpasztamobica
Copy link
Contributor

Description

When trying to connect ESP8266 to WiFi, after it was previously disconnect, AT commands time out. This does not occur if CTS/RTS is disabled (for example, by not configuring the pins in mbed_app.json or hardcoding them to NC in ESP8266 class constructor). This also does not occur if we do not stop the HW control inside _init() when reconnecting. The stop function was anyway immediately overwritten by the call to start_uart_hw_flow_ctrl(), right after the reset, so the change should be otherwise neutral.

Pull request type

[x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Reviewers

@SeppoTakalo, @VeijoPesonen , please review.

@ciarmcom ciarmcom requested review from SeppoTakalo, VeijoPesonen and a team December 20, 2018 14:00
@ciarmcom
Copy link
Member

@michalpasztamobica, thank you for your changes.
@VeijoPesonen @SeppoTakalo@ARMmbed/mbed-os-ipcore @ARMmbed/mbed-os-maintainers please review.

@michalpasztamobica
Copy link
Contributor Author

michalpasztamobica commented Dec 20, 2018

@VeijoPesonen , I tested the scenario you mentioned in a discussion: if I press the ESP reset button between the disconnection, the chip still reconnects.
I think the only scenario that would justify the usage of the stop_hw_uart_flow_control function would be that the MCU resets and runs without the UART HW control pins, while ESP is not reset and still runs with the CTS/RTS configuration. I wouldn't consider this a possible scenario, though...

@cmonr
Copy link
Contributor

cmonr commented Dec 28, 2018

@michalpasztamobica question.

Will this change also be getting backported to https://github.com/ARMmbed/esp8266-driver, since the original code was introduced here #8689?

I think the only scenario that would justify the usage of the stop_hw_uart_flow_control function would be that the MCU resets and runs without the UART HW control pins, while ESP is not reset and still runs with the CTS/RTS configuration. I wouldn't consider this a possible scenario, though...

Is there a reason we don't want to consider the use case where the MCU isn't communicating with flow control, or am I misunderstanding this statement?

@SeppoTakalo
Copy link
Contributor

@cmonr We don't backport to that repository as we only support one version of the ESP driver, and it is always the latest one in Mbed OS repository.

There is no reason to use the driver from that repository as it is just older version of this one. All development now happens in Mbed OS repository.

@michalpasztamobica
Copy link
Contributor Author

@cmonr , answering your question:

Is there a reason we don't want to consider the use case where the MCU isn't communicating with flow control, or am I misunderstanding this statement?

Normally the reset of the MCU will also reset the ESP board - in this case both will run with or without the flow control, depending solely on the mbed_app.json config. We support both scenarios.

The unrealistic scenario, which I mentioned and which we would not handle, would be that the MCU resets with a modified flow control configuration while the ESP does not reset. If the MCU has a different flow control configuration than ESP8266, they would never be able to communicate.
I think that running into this situation is more of a design issue on the user's side and I would not worry about it. It could also lead to other problems (ESP unexpectedly feeding incoming data, as it is already connected to a network or reporting unexpected network status).
Does this makes things clear?

@JanneKiiskila
Copy link
Contributor

@adbridge @0xc0170 - please target to next patch release.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 2, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Jan 2, 2019

Test run: FAILED

Summary: 1 of 11 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_greentea-test

@cmonr
Copy link
Contributor

cmonr commented Jan 2, 2019

Will need to restart once CI issue is resolved.

@cmonr
Copy link
Contributor

cmonr commented Jan 2, 2019

#9173 (comment)
Does this makes things clear?

@michalpasztamobica It absolutely does, thank you for clarifying!

@JanneKiiskila
Copy link
Contributor

@adbridge - one more push, can we get this merged in please?

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 3, 2019

@adbridge - one more push, can we get this merged in please?

It was waiting for release candidate to complete, now it can proceed.
Restarted CI (accidentally entire build), should be quick as this is second in the queue now

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 3, 2019

Exporter failure is being looked at , not related here

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 3, 2019

Exporter restarted

@mbed-ci
Copy link

mbed-ci commented Jan 3, 2019

Test run: FAILED

Summary: 3 of 11 test jobs failed
Build number : 2
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_dynamic-memory-usage
  • jenkins-ci/mbed-os-ci_exporter
  • jenkins-ci/mbed-os-ci_greentea-test

@cmonr
Copy link
Contributor

cmonr commented Jan 3, 2019

CI job restarted: jenkins-ci/mbed-os-ci_greentea-test

Something weird happened with a target across multiple jobs.

@cmonr cmonr removed the needs: CI label Jan 4, 2019
@0xc0170 0xc0170 merged commit 26b8a96 into ARMmbed:master Jan 4, 2019
@SeppoTakalo SeppoTakalo deleted the esp8266_remove_stop_uart_hw_ctrl branch January 15, 2019 10:31
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.

8 participants