I try to OTA esp8266 using “ESP8266WebServer”.
I using example “Arduino IDE 2.3.2 ESP8266WebServer/WebUpdate”.
But everytime occur exception 29 when after reset by OTA done..
epc1 is alaways 0x4000e1c3.
Board is “ESP-WROOM-02D”
Try to OTA by my code, sample code in web and Arduino IDE example code.
I expecting OTA done
This is example code.
/*
To upload through terminal you can use: curl -F "[email protected]" esp8266-webupdate.local/update
*/
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#ifndef STASSID
#define STASSID "your-ssid"
#define STAPSK "your-password"
#endif
const char* host = "esp8266-webupdate";
const char* ssid = STASSID;
const char* password = STAPSK;
ESP8266WebServer server(80);
const char* serverIndex = "<form method='POST' action='/update' enctype='multipart/form-data'><input type='file' name='update'><input type='submit' value='Update'></form>";
void setup(void) {
Serial.begin(115200);
Serial.println();
Serial.println("Booting Sketch...");
WiFi.mode(WIFI_AP_STA);
WiFi.begin(ssid, password);
if (WiFi.waitForConnectResult() == WL_CONNECTED) {
MDNS.begin(host);
server.on("/", HTTP_GET, []() {
server.sendHeader("Connection", "close");
server.send(200, "text/html", serverIndex);
});
server.on(
"/update", HTTP_POST, []() {
server.sendHeader("Connection", "close");
server.send(200, "text/plain", (Update.hasError()) ? "FAIL" : "OK");
ESP.restart();
},
[]() {
HTTPUpload& upload = server.upload();
if (upload.status == UPLOAD_FILE_START) {
Serial.setDebugOutput(true);
WiFiUDP::stopAll();
Serial.printf("Update: %sn", upload.filename.c_str());
uint32_t maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000;
if (!Update.begin(maxSketchSpace)) { // start with max available size
Update.printError(Serial);
}
} else if (upload.status == UPLOAD_FILE_WRITE) {
if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) {
Update.printError(Serial);
}
} else if (upload.status == UPLOAD_FILE_END) {
if (Update.end(true)) { // true to set the size to the current progress
Serial.printf("Update Success: %unRebooting...n", upload.totalSize);
} else {
Update.printError(Serial);
}
Serial.setDebugOutput(false);
}
yield();
});
server.begin();
MDNS.addService("http", "tcp", 80);
Serial.printf("Ready! Open http://%s.local in your browsern", host);
} else {
Serial.println("WiFi Failed");
}
}
void loop(void) {
server.handleClient();
MDNS.update();
}
And maybe exeception occur in WiFi.mode();
Added stack log
09:39:53.441 -> ets Jan 8 2013,rst cause:1, boot mode:(3,7)
09:39:53.441 ->
09:39:53.441 -> load 0x4010f000, len 3424, room 16
09:39:53.478 -> tail 0
09:39:53.478 -> chksum 0x2e
09:39:53.478 -> load 0x3fff20b8, len 40, room 8
09:39:53.478 -> tail 0
09:39:53.478 -> chksum 0x2b
09:39:53.478 -> csum 0x2b
09:39:53.478 -> v00050ae0
09:39:53.478 -> ~ld
09:39:53.516 -> ����n�r��n|��l�rlb��|r�l�n��n�l`��r�l�l��After OTA
09:39:53.551 -> Booting Sketch…
09:39:53.551 ->
09:39:53.551 -> ————— CUT HERE FOR EXCEPTION DECODER —————
09:39:53.551 ->
09:39:53.551 -> Exception (29):
09:39:53.551 -> epc1=0x4000e1c3 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000018 depc=0x00000000
09:39:53.551 ->
09:39:53.551 -> >>>stack>>>
09:39:53.551 ->
09:39:53.551 -> ctx: cont
09:39:53.551 -> sp: 3ffffc60 end: 3fffffd0 offset: 0150
09:39:53.551 -> 3ffffdb0: 40228716 00000000 40240000 0000000a
09:39:53.551 -> 3ffffdc0: 00000000 3fff025c 00000020 40100d74
09:39:53.551 -> 3ffffdd0: 4024009e 402359c2 3fff025c 402400c3
09:39:53.583 -> 3ffffde0: 402289e2 3fff025c 3ffefd6c 00000000
09:39:53.583 -> 3ffffdf0: 0000000a 3ffed3c4 3ffed340 3ffed5b0
09:39:53.583 -> 3ffffe00: 00000000 40240783 3ffed340 3ffefd6c
09:39:53.583 -> 3ffffe10: 00000018 00000003 00000003 00000003
09:39:53.583 -> 3ffffe20: 40246e68 00000064 3ffffe58 402240c1
09:39:53.583 -> 3ffffe30: 3ffed340 3ffefd6c 00000003 00000045
09:39:53.619 -> 3ffffe40: 00000064 402240a8 3ffefd6c 00000003
09:39:53.619 -> 3ffffe50: 03a3c9ca 0000b940 00000000 00000000
09:39:53.619 -> 3ffffe60: 00000000 00000000 00000000 00000000
09:39:53.619 -> 3ffffe70: 00000000 00000000 00000000 00000000
09:39:53.619 -> 3ffffe80: 00000000 00000000 00000000 40225417
09:39:53.619 -> 3ffffe90: 3ffefd6c 00000003 00000003 4022545f
09:39:53.619 -> 3ffffea0: 00000000 3ffed3c4 3ffee238 00000000
09:39:53.619 -> 3ffffeb0: 40243be1 00000003 00000003 00000003
09:39:53.619 -> 3ffffec0: 40243d43 00000003 00000003 40243cf7
09:39:53.655 -> 3ffffed0: 00000003 00000000 00000000 3ffef7ac
09:39:53.655 -> 3ffffee0: 40243e1a 3ffee7f1 3ffe8e6c 4023c76c
09:39:53.655 -> 3ffffef0: 402039a6 3ffee7f1 0001c200 00000000
09:39:53.655 -> 3fffff00: 2d505345 30343330 00003942 00000000
09:39:53.655 -> 3fffff10: 00000000 00000000 00000000 00000000
09:39:53.655 -> 3fffff20: 3ffe8800 fffffffc 3ffee89c 40209d28
09:39:53.655 -> 3fffff30: 40209c90 3ffe8868 3ffee89c 3ffeea78
09:39:53.655 -> 3fffff40: 3fffdad0 00000011 3ffee89c 3ffeea78
09:39:53.689 -> 3fffff50: 3fffdad0 3ffee7f0 3ffee89c 4020187a
09:39:53.689 -> 3fffff60: feefeffe feefeffe feefeffe feefeffe
09:39:53.689 -> 3fffff70: feefeffe feefeffe feefeffe feefeffe
09:39:53.689 -> 3fffff80: feefeffe feefeffe feefeffe feefeffe
09:39:53.689 -> 3fffff90: feefeffe feefeffe feefeffe feefeffe
09:39:53.689 -> 3fffffa0: feefeffe feefeffe feefeffe 3ffeea78
09:39:53.723 -> 3fffffb0: 3fffdad0 00000000 3ffeea4c 4020caa8
09:39:53.723 -> 3fffffc0: feefeffe feefeffe 3fffdab0 40100361
09:39:53.723 -> <<<stack<<<