-
Notifications
You must be signed in to change notification settings - Fork 3k
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: Avoid duplicate data sends (5.15) #13164
ESP8266: Avoid duplicate data sends (5.15) #13164
Conversation
We are now checking if ESP8266 has confirmed receiving data over serial port with an undocumented (but existing) "Recv x bytes" message. Next we are explicitly waiting for an official "SEND OK".
1. Fix 'spurious close' by adding close() in open(). 'spurious close' gets frequent and cannot ignore when send() changes to asynchronous. User can retry open() until 'spurious close' gets true. 2. Allow only one actively sending socket because: (1) ESP8266 AT packets 'SEND OK'/'SEND FAIL' are not associated with socket ID. No way to tell them. (2) In original implementation, ESP8266::send() is synchronous, which implies only one actively sending socket. 3. Register 'SEND OK'/'SEND FAIL' oobs, like others in ESP8266::ESP8266 constructor. Don't get involved in oob management with send status because ESP8266 modem possibly doesn't reply these packets on error case. 4. Now that ESP8266::send() changes to asynchronous, drop the code with _parser.recv("SEND OK")/_parser.recv("SEND FAIL"). _parser.recv("SEND OK")/_parser.recv("SEND FAIL") and 'SEND OK'/'SEND FAIL' oobs both consume 'SEND OK'/'SEND FAIL' packets and complicate flow control.
This is because the ESP8266 is now waiting for SEND OK and takes much more to complete the send_repeat, and echo_burst tests in RAAS. (but has higher pass ratio).
@ccli8, thank you for your changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the fix is required on the 5.15 branch, then I don't mind. Technically this looks sane.
@michalpasztamobica Some Nuvoton's targets use ESP8266 as default network interface and still need to maintain 5.15 support. So backport this PR. |
CI started |
Test run: FAILEDSummary: 2 of 10 test jobs failed Failed test jobs:
|
The greentea failures look relevant, they happenned on K66F+ESP8266, not on other targets:
@ccli8 , are you able to try it on your desk and see if you can reproduce it? The dynamic memory check look rather suspicious, as it claims to have failed with K66F and ethernet:
|
@michalpasztamobica Reproducible on my NUMAKER_IOT_M487. With |
@ccli8 , I wonder - is the |
With send(...) changing to non-block, modem can be busy in sending previous data and 'busy' the current 'AT+CIPCLOSE' command. In blocking mode, add retries to avoid spurious close to some degree. This is required to pass GT netsocket-tcp/netsocket-tls tests which expect close(...) to be OK.
07ad4a8
to
935134e
Compare
@michalpasztamobica Recover |
CI started |
Test run: SUCCESSSummary: 10 of 10 test jobs passed |
Approved by @andypowers |
Update to mbed-os 6.0 is suspended due to incompatibility. Update to mbed-os 5.15.5 which fixes ESP8266 driver issue: ARMmbed/mbed-os#13164
Update to mbed-os 6.0 is suspended due to incompatibility. Update to mbed-os 5.15.5 which fixes ESP8266 driver issue: ARMmbed/mbed-os#13164
Update to mbed-os 5.15.5 which fixes ESP8266 driver issue: ARMmbed/mbed-os#13164
Update to mbed-os 6.0 is suspended due to incompatibility. Update to mbed-os 5.15.5 which fixes ESP8266 driver issue: ARMmbed/mbed-os#13164
Update to mbed-os 6.0 is suspended due to incompatibility. Update to mbed-os 5.15.5 which fixes ESP8266 driver issue: ARMmbed/mbed-os#13164
Summary of changes
Backport of #12157 to mbed-os-5.15.
Pull request type
Test results
Reviewers
@michalpasztamobica