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

[2.4.0] Communication issue between ArduinoOTA and espota.py #4283

Closed
dhzl84 opened this issue Feb 3, 2018 · 9 comments
Closed

[2.4.0] Communication issue between ArduinoOTA and espota.py #4283

dhzl84 opened this issue Feb 3, 2018 · 9 comments
Labels
waiting for feedback Waiting on additional info. If it's not received, the issue may be closed.

Comments

@dhzl84
Copy link

dhzl84 commented Feb 3, 2018

Basic Infos

I'm not a python developer and also new to all this here so please have mercy.
While migrating my project from 2.3.0 to 2.4.0 I experienced the OTA to behave different.
espota.py is not closed like it was in 2.3.0

Hardware

Hardware: ESP-07
Core Version: 2.4.0

Description

ArduinoOTA
espota.py is waiting for an "OK" from ArduinoOTA library after upload was successful but only receives "K", thus not closing connection.
The "O" seems to get lost somewhere.

With 2.3.0 version of espota.py this was not an issue since espota.py closed anyway.
#4053 introduced this new handling

Hack
By trial and error I just added a leading character to the char array ArduinoOTA returns and it was working:
image

Fix?
Next try was then to provide a String instead of char*
image

Settings in IDE

Module: Generic ESP8266 Module
Flash Size: 1 MB
CPU Frequency: 80Mhz
Flash Mode: qio
Flash Frequency: 40Mhz
Upload Using: OTA
Reset Method: ck

Sketch

basicOTA.ino

Debug

espota.py 2.3.0 - prints error "K" but flashed successful
image

espota 2.4.0 - hangs there forever but sketch is updated and ESP restarts fine (I canclled execution some minutes after)
image

espota 2.4.0 + ArduioOTA hack - nice and smooth
image

espota 2.4.0 + ArduioOTA fix? - nice and smooth
image

@devyte
Copy link
Collaborator

devyte commented Feb 3, 2018

There have been fixes merged since 2.4 release that might be relevant. Please test with latest git.

@devyte devyte added the waiting for feedback Waiting on additional info. If it's not received, the issue may be closed. label Feb 3, 2018
@dhzl84
Copy link
Author

dhzl84 commented Feb 4, 2018

Hey, latest git works.
Eventhough I did spend some time on it prior to open a new issue I wasn't able to find a related issue or pr.
Maybe someone can reference it.

Thank you @devyte

@devyte
Copy link
Collaborator

devyte commented Feb 4, 2018

Closing as already fixed.

@devyte devyte closed this as completed Feb 4, 2018
@washcroft
Copy link

washcroft commented Dec 8, 2018

@devyte I don't believe this issue has been fixed... all the recent issues with OTA seems to be caused by the changes @d-a-v made to the espota.py OTA script in the IDE, not the ESP8266 OTA code itself.

https://github.com/esp8266/Arduino/blob/master/tools/espota.py#L163 assumes it will always be more than 1000 bytes of data received/written (reads 4 bytes of numerical characters) when the device responds with the length after each packet, however in practice this is not always the case.

Even if all the chunks of data of an upload are > 1000 bytes (usually 1460 depending on MTU), there is no guarantee the last chunk would be, that depends on the total size of the binary being uploaded.

If this last chunk is say 900 bytes, L163 will still read 4 bytes, first 3 would be "900" and the fourth would be "O" from the "OK" that https://github.com/esp8266/Arduino/blob/master/tools/espota.py#L180 is waiting for.

@devyte
Copy link
Collaborator

devyte commented Dec 8, 2018

@washcroft what is your proposal? If you have one, please make a PR, explain the bug, how your proposal fixes it, and how you tested it. We can then discuss further in the PR.

@washcroft
Copy link

@devyte I have no PR, I’m not a python developer - but I can understand the logic and I am merely pointing out why so many people are having issues with OTA uploads. Take it or leave it.

@d-a-v
Copy link
Collaborator

d-a-v commented Dec 8, 2018

@washcroft did you actually run into the issue ?

d-a-v added a commit to d-a-v/Arduino that referenced this issue Dec 8, 2018
@d-a-v d-a-v mentioned this issue Dec 8, 2018
devyte pushed a commit that referenced this issue Dec 8, 2018
@washcroft
Copy link

washcroft commented Dec 9, 2018

@d-a-v yes, that’s how I ended up investigating the cause ;) thanks for correcting your bug with the new PR

@d-a-v
Copy link
Collaborator

d-a-v commented Dec 9, 2018

Thanks for that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for feedback Waiting on additional info. If it's not received, the issue may be closed.
Projects
None yet
Development

No branches or pull requests

4 participants