It seems that after the very first upload of your code (like the BasicOTA example), you must cycle the physical RESET button or power it down for a moment. From then on I have had no problems uploading the code!
You should reboot your ESP after every Serial flash. It is nothing to do with OTA and an OTA flash doesn’t have this bug.
Many people don’t know about the bug as they simply reboot their ESP if they have a problem but when you start doing OTA this is not possible. So the initial Serial flash of the sketch containing the OTA elements is the problem that stops the device rebooting during the OTA update.
If you don’t want to read all the Github thread then Ivan’s (Mr ESP, @igrr) last post is all you need to know.
Are you following these steps?
- upload initial code into module over serial
- power off the module
- power it back on
- perform OTA
The failure to reset after a Serial flash can occur with any sketch at any time and AFAIK there is no known fix at this current time. You will see that the Github thread was started last November and the milestone for the fix just keeps moving on. This bug only affects the FIRST software reset after the serial flash, any subsequent software resets are fine.
I have always just replied on the upload managing the reset… as I have never had a problem in the past.
Also I point out that all the time I have problems, I was not physically close to the hardware… it was already plugged in to the computer and I was remote desktoping in from work.
I would not have had these issues if I had been able to reset it.
Yes it is the ESP.restart() that has the bug but only on first restart after a serial, not OTA, flash.
Restart the ESP manually once you have flashed the initial code via Serial and your future OTA updates will be fine.
Awesome advice! Cheers!
I have linked to your post (43) in my first post so people will know to skip past all the issues I had to find an answer if they also have the issue… or just want to know.
I am currently going around and recoding all my ESP’s around the house so I never have to unplug them again! Game changer!
The bug is generally only encountered when you are testing the system in house. In a real life situation once you have done the Serial flash you normally send or take the ESP to the remote location. Unless you are sending / taking the ESP to the remote location in a powered up state i.e. connected to batteries since the last Serial flash, the bug will not occur.
Amazing , i have just tried it now and inserted it in line with my code and 100% working.
to clarify i use the below command in between my code ,for any modification thanks to informs me
Sketch uses 265,915 bytes (53%) of program storage space. Maximum is 499,696 bytes.
Global variables use 36,592 bytes (44%) of dynamic memory, leaving 45,328 bytes for local variables. Maximum is 81,920 bytes.
java.io.IOException: Cannot run program "python.exe": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:26)
at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:130)
at cc.arduino.packages.uploaders.GenericNetworkUploader.uploadUsingPreferences(GenericNetworkUploader.java:97)
at cc.arduino.UploaderUtils.upload(UploaderUtils.java:78)
at processing.app.Sketch.upload(Sketch.java:1186)
at processing.app.Sketch.exportApplet(Sketch.java:1160)
at processing.app.Sketch.exportApplet(Sketch.java:1132)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2409)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
at java.lang.ProcessImpl.start(ProcessImpl.java:137)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 9 more
OK, restarted and tried again - so windows firewall was blocking it, now i allow Python I get:
Sketch uses 265,035 bytes (53%) of program storage space. Maximum is 499,696 bytes.
Global variables use 36,368 bytes (44%) of dynamic memory, leaving 45,552 bytes for local variables. Maximum is 81,920 bytes.
21:54:36 [ERROR]: No response from device
@Dave1829 now your first problem solved
for the Error : No response from device you must
1-Allocate the Flash size of your module to the right one
2-upload the Basic OTA sketch again with the right Flash size with Serial connection
3-embedded the OTA code it between your code and upload it using OTA…
(for my ESP12 it was 4M(1M SPIFFS) )