Wemos D1 mini pro OTA problem

I'm using a Wemos D1 mini pro and I'm running into problems doing an OTA update. Serial everything works fine. I get connected tot the wifi selected et. I get an error
image
After writing with serial cable the IP appears in the IDE to select.
I have tried another same HW device but same issue. (I've got like 10 of them)
I'm using the LOLIN (Wemos) D1 mini pro board from the board manager.


Via serial I can easily upload sketches that run properly. (blink, send MQTT messages, webserver,...)

Any idea's?

#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>

#ifndef STASSID
#define STASSID "mywifi"
#define STAPSK  "mywifi_psw"
#endif

const char* ssid = STASSID;
const char* password = STAPSK;

void setup() {
  Serial.begin(115200);
  Serial.println("Booting");
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.waitForConnectResult() != WL_CONNECTED) {
    Serial.println("Connection Failed! Rebooting...");
    delay(5000);
    ESP.restart();
  }

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

    // NOTE: if updating FS this would be the place to unmount FS using FS.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();
}

Have you reset the Wemos after you did the upload through Serial ?

Yes, i did, i totally decoupled from power as well.

I may have found a solution. I tried to use the Generic ESP8266 board and that seems to work

The board configuration that works with Serial upload, should also work with OTA upload.

Wel, it doesn't for some reason.

Error 9 seems to have something to do with the flash size,
The LOLIN WEMOS D1 MINI PRO is supposed to have 16M (15M SPIFFS) , but maybe yours doesn't. What do you have selected when you select generic ESP8266 ?
From the picture you posted, it seems to have a 32Mbit flash chip which is 4MB . So the board you have does not meet the 'PRO' specifications, and as such you can select LOLIN WEMOS D1 R2 & Mini which does have 4MB flash.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.