Need a better OTA example

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!

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

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.

[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.

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

floresta:
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?

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.

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

Pieter

PieterP:
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!

Hello,

I have tried OTA but there is a issue. The issue which I am facing is that for me the Network port is not showing. Can anyone help me solve this issue???? Waiting for your responses

Your question is not relevant to the thread, so posting a new thread would be a much more sensible option than dragging this one out of its grave.

On top of that, you didn't provide any useful information.

That being said, I'm going to take a wild guess and assume you're using Windows, and you didn't install python 2.7.