Skip to content

WiFi stuck in unknown state during OTA update if connection lost then #5626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
6 tasks done
AyushMarsian opened this issue Jan 17, 2019 · 1 comment
Closed
6 tasks done

Comments

@AyushMarsian
Copy link

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: [ESP-12E]
  • Core Version: [2.4.2]
  • Development Env: [Arduino IDE]
  • Operating System: [Windows]

Settings in IDE

  • Module: [NodeMCU 1.0(ESP-1E Module)]
  • Flash Size: [4MB]
  • Debug port: [Serial]
  • Debug Level: [OTA]
  • lwip Variant: [v2 Higher Bandwidth]
  • CPU Frequency: [80Mhz]
  • Upload Using: [OTA]

Problem Description

I used to upload bin file in NodeMCU using OTA method by web browser. Though, everything was working quite well, but before some day I was trying to upload code by same method, after that I observed that my WiFi was not working, it was stuck in unknown state. However, when I reset the MCU then it started to work perfectly, but I was confused because of this behavior of WiFi

After certain testing I got problem that, when Host sending file to the MCU during that period if host lost the connection, due to network issue, range issue and many other than WiFi goes to unknown state. For recovery I have to do hard reset compulsory or else perform power off and on operation.

Is there solution available, by which I can recover my WiFi without resetting ?

Sketch

/*
  To upload through terminal you can use: curl -F "image=@firmware.bin" esp8266-webupdate.local/update
*/

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <ESP8266HTTPUpdateServer.h>

const char* host = "esp8266-webupdate";
const char* ssid = "office1";
const char* password = "123456789";

ESP8266WebServer httpServer(80);
ESP8266HTTPUpdateServer httpUpdater(true);

void setup(void) {

  Serial.begin(9600);
  Serial.println();
  Serial.println("Booting Sketch...");
  WiFi.mode(WIFI_AP);
  WiFi.begin(ssid, password);

  while (WiFi.waitForConnectResult() != WL_CONNECTED) {
    WiFi.begin(ssid, password);
    Serial.println("WiFi failed, retrying.");
  }
  Serial.print(WiFi.localIP());
  MDNS.begin(host);

  httpUpdater.setup(&httpServer);
  httpServer.begin();

  MDNS.addService("http", "tcp", 80);
  Serial.printf("HTTPUpdateServer ready! Open http://%s.local/update in your browser\n", host);
}

void loop(void)
{
  httpServer.handleClient();
}

Debug Messages

⸮�⸮=⸮⸮⸮
SDK:2.2.1(cfd48f3)/Core:2.4.2/lwIP:2.0.3(STABLE-2_0_3_RELEASE/glue:arduino-2.4.1-13-g163bb82)/BearSSL:6d1cefc

Booting Sketch...
scandone
del if0
mode : softAP(a2:20:a6:13:18:2b)
mode : sta(a0:20:a6:13:18:2b) + softAP(a2:20:a6:13:18:2b)
add if0
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 6
cnt 

connected with office1, channel 2
dhcp client start...
ip:192.168.31.53,mask:255.255.255.0,gw:192.168.31.1
192.168.31.53HTTPUpdateServer ready! Open http://esp8266-webupdate.local/update in your browser
Update: WebUpdater.ino.nodemcu.bin
sleep disable
...................
@AyushMarsian AyushMarsian changed the title WiFi Stuck in unknown state during OTA update if connection lost then WiFi stuck in unknown state during OTA update if connection lost then Jan 17, 2019
@mcspr
Copy link
Collaborator

mcspr commented Jul 12, 2022

looks like a dup of #8618
(closing in favour of the issue having a bit more info)

@mcspr mcspr closed this as completed Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants