-
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: Pelion connect fails with 'send tcp data' timeout #11544
Comments
cc @ARMmbed/mbed-os-wan please review |
Internal Jira reference: https://jira.arm.com/browse/MBOCUSTRIA-1805 |
Hi @ccli8 , Ad 1) About the ESP8266_SEND_TIMEOUT - I can see you found a workaround by manually overriding the macro value in mbed_app.json. I think the current timeout is quite a reasonable value, as we keep running this in our CI every day and tests are pretty much always passing. What I can offer is that we can add a more convenient way of changing this configuration, like it was don for some pins config in this PR: #11331 Ad 2) This line:
Is a mere debug print showing what we expect to receive.
And only this is a confirmation that the data was indeed sent. Regarding the |
@teetak01 , have you seen ESP8266's tcp send timeout causing Pelion connection to fail? |
Without timeout, I can see |
@michalpasztamobica does this not look similar to https://jira.arm.com/browse/ONME-4352 ?
|
I assumed that Pelion connect will be something happening at the very beginning of operation, meaning that there would be no data pending to be received. Also - @ccli8 mentioned that the problem disappears when he increases timeout to 10 seconds. In ONME-4352 ESP gets stuck for minutes... But just to be sure... Regarding your question in the last post. I confirm, only Just a side note - you can enable some higher-level debug traces by adding a call to |
It doesn't completely disappear. In most cases, send tcp data can complete (confirmed by receiving
During the 10 seconds for 'send tcp data', I don't see tcp read-out taking place. I guess when network status is bad, ESP8266 module doesn't receive ack from remote peer, so 'send tcp data' is not completed, and then no |
Ok, so it seems your case is not the one, that @teetak01 mentioned. Poor network connectivity state may always cause some issue with connecting. Is there a retry mechanism that you could use instead of increasing the deeply buried HW-dependent timeout? If not, then coming back to my original idea - would it be helpful for you if we provided a possibility of configuring the ESP8266_SEND_TIMEOUT inside mbed_app.json, in a similar way to how the pins or baudrate are configured now? |
Hi @juhaylinen , |
According to the log of #11544 (comment), there has been a retry mechanism. But I have concern with return code of Allow configuring the ESP8266_SEND_TIMEOUT in mbed_app.json is fine. But I think above is the point. |
I see your point, @ccli8 . We are in the grey area here - the data has been successfully sent to ESP8266 over UART, and unofficially acknowledged with Please, bear in mind - the To confirm if the data is sent twice or not - may I ask you to take another look into your logs? If the data is indeed sent twice we would see a stray Either way - double packets in TCP are not an issue, but I understand we want to avoid them for battery savings. |
To see duplicate packets easily, I decrease First accepted
Because
Second accepted
Expect
Still repeat
Finally, see
See two
The duplicate comes from AT layer. TCP is unaware of it and still treats it as distinct packets. |
I also do an experiment to show my above idea: decrease mbed-os/components/wifi/esp8266-driver/ESP8266/ESP8266.cpp > ESP8266::send(...): if (_parser.write((char *)data, (int)amount) >= 0 /*&& _parser.recv("SEND OK")*/) {
ret = NSAPI_ERROR_OK;
}
New data
New data
Another new data
Finally, new data
|
@ccli8 , thanks a lot for these logs and explanation. You definitely have a point here - the driver's behavior needs improvement. Extending the timeout is a good workaround, but I think we should rework the driver:
FYI, @AnttiKauppila |
Update for it? |
Hi @ccli8 . We are actively working on this in the current sprint. Just trying to figure out the least intrusive change that would make most sense. |
1. Support Nuvoton targets: - NUMAKER_IOT_M487 V1.3 Compared to V1.2, V1.3 adds support for ESP8266 RTS/CTS/RST pins. V1.3 is incompatible with V1.2 on ESP8266. 2. Change storage to NUSD (SD card in SDIO bus mode) from SD (SD card SPI bus mode) (1) Add COMPONENT_NUSD.lib. (2) Add component NUSD (target.components_add). (3) Change default BlockDevice to NUSD: Override BlockDevice::get_default_instance (nusd.provide-default-blockdevice). Required since mbed-cloud-client 2.1.0 (arm_uc_blockdevice_ext) or in: mbed-bootloader/modules/storage/pal-blockdevice/source/arm_uc_pal_blockdevice_mbed.cpp (4) Enable kvstore with blockdevice type being "other". i) Override get_other_blockdevice() (nusd.provide-kvstore-other-blockdevice). ii) Configure storage type to "FILESYSTEM". iii)Configure file system type to "LITTLE". vi) Configure block device type to "other". v) Configure external size to 64MiB, which cannot overlap with update-client. storage-address/update-client.storage-size. 3. Change back UARTSerial tx/rx buffer size from 1024/1024 to 256/256. This can reduce memory footprint by (1024 - 256) * 2 = 1.5KiB. Because this configuration influences both ESP8266 and default console (platfrom/mbed_retarget.cpp), memory reduction can achieve 1.5KiB x 2 = 3KiB. 4. Enlarge ESP8266 'send tcp data' timeout on Nuvoton targets Pelion connection has some failure rate with this. Enlarging ESP8266_SEND_TIMEOUT can just relieve the issue. A ticket has raised to address it: ARMmbed/mbed-os#11544
1. Support Nuvoton targets: - NUMAKER_IOT_M263A 2. Change storage to NUSD (SD card in SDIO bus mode) from SD (SD card SPI bus mode) (1) Add COMPONENT_NUSD.lib. (2) Add component NUSD (target.components_add). (3) Change default BlockDevice to NUSD: Override BlockDevice::get_default_instance (nusd.provide-default-blockdevice). Required since mbed-cloud-client 2.1.0 (arm_uc_blockdevice_ext) or in: mbed-bootloader/modules/storage/pal-blockdevice/source/arm_uc_pal_blockdevice_mbed.cpp (4) Enable kvstore with blockdevice type being "other". i) Override get_other_blockdevice() (nusd.provide-kvstore-other-blockdevice). ii) Configure storage type to "FILESYSTEM". iii)Configure file system type to "LITTLE". vi) Configure block device type to "other". v) Configure external size to 64MiB, which cannot overlap with update-client. storage-address/update-client.storage-size. 3. Change back UARTSerial tx/rx buffer size from 1024/1024 to 256/256. This can reduce memory footprint by (1024 - 256) * 2 = 1.5KiB. Because this configuration influences both ESP8266 and default console (platfrom/mbed_retarget.cpp), memory reduction can achieve 1.5KiB x 2 = 3KiB. 4. Enlarge ESP8266 'send tcp data' timeout on Nuvoton targets Pelion connection has some failure rate with this. Enlarging ESP8266_SEND_TIMEOUT can just relieve the issue. A ticket has raised to address it: ARMmbed/mbed-os#11544
Description
Environment
mbed-os-example-pelion
656809a Merge pull request #14 from ARMmbed/remove-patches
mbed-clout-client
3.4.0
mbed-os
83fca60 Merge pull request #11454 from Tharazi97/LSI_VALUE_STM
Target
NU_PFM_M2351_NPSA_NS
Pelion connection has some failure rate. For my check, I enable ESP8266 debug log. From the log, pelion connection failure results from send tcp data failing. Some questions with it:
AT+CIPSEND=0,642
fails due to timeout. If I enlargeESP8266_SEND_TIMEOUT
from 2000ms to e.g. 10000ms, the failure rate can decrease. But what is reasonable value ofESP8266_SEND_TIMEOUT
? It depends on network status.AT+CIPSEND=0,642
times out, a secondAT+CIPSEND=0,642
is retried. But there isRecv 642 bytes
from ESP8266 module in the firstAT+CIPSEND=0,642
. In my understanding, this means ESP8266 module has received 642 bytes from host mcu and is sending it out to remote peer. If the secondAT+CIPSEND=0,642
succeeds, then642 bytes
is duplicate sent?Issue request type
The text was updated successfully, but these errors were encountered: