-
Notifications
You must be signed in to change notification settings - Fork 13.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 sketch upload fails with Failed to connect to ESP8266: Timed out waiting for packet header #7050
Comments
Hello, |
Thanks for your reply. The boards.txt file will be whatever the Arduino IDE Boards Manager has installed. I have not made any manual changes. The ESP8266 library was installed using the Boards Manager in Arduino IDE. In the Additional Boards Manager URL's field in preferences I have used the following URL, which can be found in a number of online references: http://arduino.esp8266.com/stable/package_esp8266com_index.json One assumes when installing support for a particular board, that the IDE Boards Manager will perform the necessary actions to install the correct resources. I can confirm that during the installation process, the version number directory (which on my computer is located at /home/user/.arduino15/packages/esp8266/hardware/esp8266/x.x.x - where x.x.x represents the version number, e.g. 2.6.3) gets deleted and then re-created with the version number corresponding to whatever version of the ESP8266 library has been selected to be installed. It would therefore seem that the complete library, including the boards.txt file, is getting updated during the install process. Since there is no indication of version within the boards.txt file, whether the supplied file correctly corresponds with the ESP8266 library version I could not say. |
the first run of esptool is successful. (this is for the erase, but it only prints informations, because you have Sketch only selected). but then the reset takes too long and the chip doesn't go into flashing mode. |
No, only the USB cable is connected. Nothing attached to the GPIO pins. After some further investigation I might be able to shed some more light on the matter. Looking at the output in the Arduino IDE after the upload, it shows that the following command line is being used to upload the binary code: $ python upload.py --chip esp8266 --port /dev/ttyUSB0 --baud 115200 --before no_reset --after soft_reset write_flash 0x0 AR488-wifi.bin Note that for clarity I have removed the full path to the python and tools directory in the esp8266 library hierarchy and simply ran the above from ~/.arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools. This results in the same error condition. Since the error output showed an unexpected reset at the start of the upload, I ran the command again but without the '--before no_reset' parameter: $ python upload.py --chip esp8266 --port /dev/ttyUSB0 --baud 115200 --before no_reset --after soft_reset write_flash 0x0 AR488-wifi.bin This time the upload worked so the problem appears to be associated with the use of this parameter which is not used in the version 2.5.2 call: python upload.py --chip esp8266 --port /dev/ttyUSB0 --baud 115200 --trace version --end --chip esp8266 --port /dev/ttyUSB0 --baud 115200 --trace write_flash 0x0 /tmp/arduino_build_299222/AR488-wifi.ino.bin --end Although references to the '--before no_reset' parameter appear in both 2.5.2 and 2.6.3 versions of esptool.py, they only start appearing in boards.txt.py file from version 2.6.0 onwards. Version 2.5.2:
Version 2.6.0:
Version 2.6.3:
Might this provide some clue? |
the upload.py should run esptool only once since 2.6.1. before it run it twice, first for erase then for upload.. |
That difference perhaps explains the reset attempt. The output in the original post came from 2.6.0. There is indeed a difference with version 2.6.3 as there seems to be no reset attempt, although with the original command line as per Arduino IDE the upload still fails. Shown here are the outputs from 2.6.3 of both the failed and successful attempt with the modified command line: Fail (with --begin no_reset):
Success (without --begin no_reset):
|
@Twilight-Logic Please try a new install from scratch for 2.6.3. Don't forget to delete the .arduino15 dir. |
Well, I must admit to being sceptical about this suggestion, but tried it anyway. I renamed .arduino15 to .arduino15.bak and re-launched the IDE. My preferences were lost (as expected) so had to be set up again, although this takes just a few moments. I installed the ESP8266 library and also had to update the AVR boards library to bring it up to date. After some 5 minutes that was all done and I tried again. I can report that this time the upload was successful. I guess something must have got out of sync during the update process at some point.... The only drawback to this fix is that if someone has other categories of boards installed then they are all going to have to be re-installed but it doesn't take too long so not a big deal I guess. Thanks for that suggestion. |
Although I appreciate that deleting the whole of ~/.arduino15 might be "safer", it seems that it is sufficient to delete only ~/.arduino15/packages/esp8266. This avoids loosing preferences and having to re-install other board libraries. |
When moving back and forth between versions with a core, the IDE can sometimes mess up something somewhere, and you end up with an install that is a mix of files. This is not unique to us, I've had it happen with other cores. Me, when moving from one version to another in either direction, I prefer to uninstall - clean - install the new one, because paranoia. |
Basic Infos
Platform
Settings in IDE
Problem Description
When I upload a sketch using the Arduino IDE, with library version 2.6.0 or later I get the following error:
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
The problem does not occur when library version 2.5.2 is used, or when the upload is perfomed manually. I have tested 2.6.0, 2.6.3 and 3.0 with the following command:
./esptool.py --port /dev/ttyUSB2 write_flash 0x000000 mybinary.bin
I also substituted 3.0 for 2.6.3 in the Arduino library directory, but this did not help. The problem has been reported to me by others, including Windows users, trying to upload to an ESP8266, although the errors tend to vary somewhat..
Full output:
Note the hard reset after detecting the flash size? This does not happen when esptool.py is run manually from the command line or with library version 2.5.2.
The text was updated successfully, but these errors were encountered: