Go Down

Topic: Need a better OTA example (Read 125 times) previous topic - next topic

lvmake

Hello,

I need an example of a sketch that both has OTA capability AND uses the WIFI for something other than OTA. So far all my attempts to actually use the WIFI while retaining working OTA code have failed. All the examples I can find EITHER have OTA or use wifi one way or another.

Thanks!

PieterP

Nothing special. Just make sure you don't write blocking code and handle the OTA every time the loop repeats.
For example. Or this.

Pieter

lvmake

Thanks Pieter.

Steps:

1) Use serial to push the BasicOTA sketch onto my 8266.
2) Push the same BasicOTA sketch over the top via WiFi (ie, verified OTA is working)
3) Take the code from the first link you referenced and compile the sketch (success).
4) Push the example sketch OTA - FAILED

This is what I keep getting stuck on. Any time I try to push a sketch that includes both OTA functionality AND other WiFi functionality it fails like this:

Sketch uses 309115 bytes (61%) of program storage space. Maximum is 499696 bytes.
Global variables use 40532 bytes (49%) of dynamic memory, leaving 41388 bytes for local variables. Maximum is 81920 bytes.
11:51:28 [ERROR]: No response from device
11:51:28 [ERROR]: No response from device

What I'm seeing on the serial output of the 8266 is the ever useful "Error[1]: Begin Failed"

After this sketch fails, if I try the BasicOTA again it works just fine.

I don't know what else to try as extensive searching hasn't turned up anything.

floresta

Quote
[ERROR]: No response from device
Check your router to see if it is connected to your ESP8266 and check the available ports in the IDE to see if the ESP8266 shows up.



Quote
What I'm seeing on the serial output of the 8266 is the ever useful "Error[1]: Begin Failed"
At the present time you can't (successfully) use the serial monitor for troubleshooting if OTA programming is enabled.

I have been successful using the ubiquitous 'PuTTY' program.  I had to set the 'Serial Line' and the 'Speed' fields and also go to the 'Terminal' section and check 'Implicit CR in every LF'.


Don

lvmake

Check your router to see if it is connected to your ESP8266 and check the available ports in the IDE to see if the ESP8266 shows up.
I think maybe you missed what I was saying. I can push the BasicOTA sketch via WIFI as many times as I want and it works just fine. Once I load that sketch via serial, the 8266 shows up on the network and everything works as expected - EXCEPT that certain sketches won't load. Which is the source of my confusion. Why would the contents of the sketch *I am loading* cause an issue?


Quote
At the present time you can't (successfully) use the serial monitor for troubleshooting if OTA programming is enabled.
You might mean something specific when you say "use the serial monitor for troubleshooting". I currently have a raspberry pi connected to the 8266 on serial and I am successfully watching info coming off the device. When I push BasicOTA from my laptop to the 8266 I see the progress indicator on serial (it's part of the BasicOTA sketch), and likewise when I try to push the example sketch from above I see the error about Begin Failed.

PieterP

Your ESP seems to have only 512KiB of memory. You need twice the size of your sketch for OTA to work.

Pieter

lvmake

Your ESP seems to have only 512KiB of memory. You need twice the size of your sketch for OTA to work.

Pieter
I just came back to say almost this, in case anyone else runs into a similar problem. My ESP does have 1MB, but the default settings from all the examples/tutorials I looked at was for 1M/512k SPIFFS. So net result was the same, when a sketch ran over 50% of the 512k of remaining space then I was getting the Begin Failed thing. Turned that down to 128k SPIFFS and seems thing to be working.

Thanks!

Go Up