Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By mlefevre
#76151 I'm trying to get OTA updates working on a new design using the ArduinoOTA component in the ESP8266 library on github. I have an ESP-07 attached via an FTDI adapter to a Win10 system running PlatformIO inside Atom.

I have built the example sketch as shown below and it uploads via the serial port and runs just fine. However, after enabling OTA upload in my platform.ini file, it always fails with no response from the ESP. I have scoured the web and tried the solutions that have helped others including setting a specific port number, enabling authentication (which fails to authenticate), and have tried different IP addresses (static and DHCP). I started with a board = esp07 and the same env, and have tried switching to nodemcu and nodemcuv2 without any change in behavior. I don't know how to troubleshoot this any further.

My sketch:
Code: Select allinclude <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>

const char* ssid = ".....";
const char* password = ".....";
const IPAddress me(10, 248, 0, 171);
const IPAddress gateway(10, 248, 0, 1);
const IPAddress dnsServer(10, 248, 0, 1);
const IPAddress subnetMask(10, 248, 0, 171);

void setup() {
  Serial.begin(115200);
  Serial.println("Booting");

  WiFi.mode(WIFI_STA);
  WiFi.config(me, gateway, subnetMask);
  WiFi.begin(ssid, password);
  while (WiFi.waitForConnectResult() != WL_CONNECTED) {
    Serial.println("Connection Failed! Rebooting...");
    delay(5000);
    ESP.restart();
  }

  // Port defaults to 8266
  ArduinoOTA.setPort(8266);

  // Hostname defaults to esp8266-[ChipID]
  ArduinoOTA.setHostname("myesp8266");

  // No authentication by default
  //ArduinoOTA.setPassword("admin");

  // Password can be set with it's md5 value as well
  // MD5(admin) = 21232f297a57a5a743894a0e4a801fc3
  // ArduinoOTA.setPasswordHash("21232f297a57a5a743894a0e4a801fc3");

  ArduinoOTA.onStart([]() {
    String type;
    if (ArduinoOTA.getCommand() == U_FLASH) {
      type = "sketch";
    } else { // U_SPIFFS
      type = "filesystem";
    }

    // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
    Serial.println("Start updating " + type);
  });
  ArduinoOTA.onEnd([]() {
    Serial.println("\nEnd");
  });
  ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
    Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
  });
  ArduinoOTA.onError([](ota_error_t error) {
    Serial.printf("Error[%u]: ", error);
    if (error == OTA_AUTH_ERROR) {
      Serial.println("Auth Failed");
    } else if (error == OTA_BEGIN_ERROR) {
      Serial.println("Begin Failed");
    } else if (error == OTA_CONNECT_ERROR) {
      Serial.println("Connect Failed");
    } else if (error == OTA_RECEIVE_ERROR) {
      Serial.println("Receive Failed");
    } else if (error == OTA_END_ERROR) {
      Serial.println("End Failed");
    }
  });

  ArduinoOTA.begin();
  Serial.println("Ready");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
  ArduinoOTA.handle();
  Serial.println("Alive!");
  delay(1000);
}


My platformio.ini file:
Code: Select all[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2 ;esp07
framework = arduino
upload_port = 10.248.0.171
;upload_flags = --auth=admin --port=8266
upload_flags = --port=8266


And, the error I get:
Code: Select allConfiguring upload protocol...
Looking for upload port...
Use manually specified: 10.248.0.171
Uploading .pioenvs\nodemcuv2\firmware.bin
10:49:11 [DEBUG]: Options: {'esp_ip': '10.248.0.171', 'host_port': 56463, 'image': '.pioenvs\\nodemcuv2\\firmware.bin', 'host_ip': '0.0.0.0', 'auth': '', 'esp_port': 8266, 'spiffs': False, 'debug': True
, 'progress': True}

10:49:11 [INFO]: Starting on 0.0.0.0:56463
10:49:11 [INFO]: Upload size: 287952
Sending invitation to 10.248.0.171 ..........
10:49:19 [ERROR]: No response from the ESP
*** [upload] Error 1
User avatar
By Mickbaer
#76251 Hello,
I have the same error at the BasicOTA.ino example

I parsed it and found it cames from the function:
bool UpdaterClass::begin(size_t size, int command) out of the Updater.cpp
this function came back with an error,
It is an function at ESP core and Im not able to parse him to get information
whats gongi wrong on the ESP when beginning OTA update.

Can some body give me an hint to help to fix it.
Thanks in advance.

I have the following settings
Platformio IDE 2.1.4 426.976 Core 3.5.4a1 all Lib on the newest state running on an WIN10 64bit
Here my setting
-------------------------------------------------------------------------------------------------
[06/03/18 13:17:11] Processing esp07 (platform: espressif8266; framework: arduino; board: esp07)
PLATFORM: Espressif 8266 > Espressif Generic ESP8266 ESP-07
SYSTEM: ESP8266 80MHz 80KB RAM (4MB Flash)
Converting BasicOTA.ino
LDF MODES: FINDER(deep) COMPATIBILITY(soft)
Collected 29 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ESP8266mDNS>
| |-- <ESP8266WiFi> v1.0
|-- <ESP8266WiFi> v1.0
|-- <ArduinoOTA_Juni2018>
| |-- <ESP8266mDNS>
| | |-- <ESP8266WiFi> v1.0
| |-- <ESP8266WiFi> v1.0

Checking program size
text data bss dec hex filename
279512 5276 30432 315220 4cf54 .pioenvs\esp07\firmware.elf
Building .pioenvs\esp07\firmware.bin
Configuring upload protocol...
Looking for upload port...
Use manually specified: 192.168.111.42
Uploading .pioenvs\esp07\firmware.bin
13:17:18 [DEBUG]: Options: {'esp_ip': '192.168.111.42', 'host_port': 48763, 'image': '.pioenvs\\esp07\\firmware.bin', 'host_ip': '0.0.0.0', 'auth': '', 'esp_port': 8266, 'spiffs': False, 'debug': T
rue, 'progress': True}
13:17:18 [INFO]: Starting on 0.0.0.0:48763
13:17:18 [INFO]: Upload size: 288928
Sending invitation to 192.168.111.42 ..........
13:17:24 [ERROR]: No response from the ESP
*** [upload] Error 1
[ERROR] Took 12.77 seconds

I have no idear how to fix it.
Can any body help here please,
User avatar
By Mickbaer
#76254 Thanks for the hint with the Flash size.
My Esp07 has one Mega byte flash, but on this i found an miss settings in the Platformio board setting.
So I have to use the esp01_1m setting to fix this Flash size issues.
Afther that, the begining error did not came up any more, but it fails at uploading 2%
with an missing end error.
So I give up for the OTA direct upload here
and used the OTA Webupdater.ino and it works perfectly.
Greetings from Mickbaer Berlin Germany