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

HttpUpdate Example - HTTP_UPDATE_FAILD Error (-104): Wrong HTTP code #2022

Closed
Zyxmn opened this Issue May 13, 2016 · 31 comments

Comments

Projects
None yet
@Zyxmn

Zyxmn commented May 13, 2016

I have tried to implement the HttpUpdate Example albeit it with a few changes. Here is my sketch:

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**

  • httpUpdate.ino
    *
  • Created on: 27.11.2015

*/

include "Arduino.h"

include "ESP8266WiFi.h"

include "ESP8266HTTPClient.h"

include "ESP8266httpUpdate.h"

const char* ssid = "ssid";
const char* password = "password";

void setup()
{
// put your setup code here, to run once:
Serial.begin(115200);
delay(100);

// We start by connecting to a WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}

Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
delay(500);

}

void loop()
{

    t_httpUpdate_return ret = ESPhttpUpdate.update("https://rawgit.com/Zyxmn/esp8266_BlinkyBin/master/Blinky.cpp.bin");

    delay(500);
    switch(ret) {
        case HTTP_UPDATE_FAILED:
            Serial.printf("HTTP_UPDATE_FAILD Error (%d): %s", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
            Serial.println();
            Serial.println();
            Serial.println();
            break;

        case HTTP_UPDATE_NO_UPDATES:
            Serial.println("HTTP_UPDATE_NO_UPDATES");
            Serial.println();
            Serial.println();
            break;

        case HTTP_UPDATE_OK:
            Serial.println("HTTP_UPDATE_OK");
            Serial.println();
            Serial.println();
            Serial.println();
            break;
    }
    delay(500);

}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

I get the wrong http code error as mentioned in the title, I tried looking online but could not find anything useful. I was wondering if anyone can help me figure out how to resolve it.

Thanks a lot in advance fellas! Appreciate the help.

@igrr

This comment has been minimized.

Show comment
Hide comment
@igrr

igrr May 13, 2016

Member

Which version of ESP8266 Arduino core are you using?

Member

igrr commented May 13, 2016

Which version of ESP8266 Arduino core are you using?

@Zyxmn

This comment has been minimized.

Show comment
Hide comment
@Zyxmn

Zyxmn May 13, 2016

The Adafruit Huzzah Board. The sketch has the libraries not showing;

These are the ones I use. I completely replaced the setup section of the example. To the one shown above.
#include Arduino.h
#include ESP8266WiFi.h
#include ESP8266HTTPClient.h
#include ESP8266httpUpdate.h

Zyxmn commented May 13, 2016

The Adafruit Huzzah Board. The sketch has the libraries not showing;

These are the ones I use. I completely replaced the setup section of the example. To the one shown above.
#include Arduino.h
#include ESP8266WiFi.h
#include ESP8266HTTPClient.h
#include ESP8266httpUpdate.h

@igrr

This comment has been minimized.

Show comment
Hide comment
@igrr

igrr May 13, 2016

Member

I mean, which version of software did you install? 2.0.0, 2.1.0, 2.2.0, 2.3.0-rc1, etc?

Member

igrr commented May 13, 2016

I mean, which version of software did you install? 2.0.0, 2.1.0, 2.2.0, 2.3.0-rc1, etc?

@Zyxmn

This comment has been minimized.

Show comment
Hide comment
@Zyxmn

Zyxmn May 13, 2016

Oh yeah sorry, its 2.2.0 .

Zyxmn commented May 13, 2016

Oh yeah sorry, its 2.2.0 .

@igrr

This comment has been minimized.

Show comment
Hide comment
@igrr

igrr May 13, 2016

Member

Could you please try running the same with 2.3.0-rc1? There were some issues with HTTPClient library which were fixed in 2.3.0-rc1.

Edit: this version is available at http://arduino.esp8266.com/staging/package_esp8266com_index.json

Member

igrr commented May 13, 2016

Could you please try running the same with 2.3.0-rc1? There were some issues with HTTPClient library which were fixed in 2.3.0-rc1.

Edit: this version is available at http://arduino.esp8266.com/staging/package_esp8266com_index.json

@Zyxmn

This comment has been minimized.

Show comment
Hide comment
@Zyxmn

Zyxmn May 13, 2016

Installed the 2.3.0-rc1 , the code wont compile now . says

Board huzzah (platform esp8266, package esp8266) is unknown

Error compiling for board Adafruit HUZZAH ESP8266.

Zyxmn commented May 13, 2016

Installed the 2.3.0-rc1 , the code wont compile now . says

Board huzzah (platform esp8266, package esp8266) is unknown

Error compiling for board Adafruit HUZZAH ESP8266.

@igrr

This comment has been minimized.

Show comment
Hide comment
@igrr

igrr May 13, 2016

Member

Did you remove 2.2.0 before installing 2.3.0-rc1?
If not, you may need to close the IDE and remove the old package.
On Windows, it is under Users\[username]\AppData\Roaming\Arduino15\packages\esp8266\hardware.
On Mac, /Users/$USER/Library/Arduino15/packages/esp8266/hardware.
See #1514, #1387.

Member

igrr commented May 13, 2016

Did you remove 2.2.0 before installing 2.3.0-rc1?
If not, you may need to close the IDE and remove the old package.
On Windows, it is under Users\[username]\AppData\Roaming\Arduino15\packages\esp8266\hardware.
On Mac, /Users/$USER/Library/Arduino15/packages/esp8266/hardware.
See #1514, #1387.

@Zyxmn

This comment has been minimized.

Show comment
Hide comment
@Zyxmn

Zyxmn May 13, 2016

I did not remove the 2.2.0 before installing 2.3.0-rc1 . I manually deleted the 2.2.0 folder and installed the 2.3.0-rc1 like you said. The code compiles fine now.

The new HTTP error it shows now is :
HTTP_UPDATE_FAILED Error (-1): HTTP error: connection refused

Zyxmn commented May 13, 2016

I did not remove the 2.2.0 before installing 2.3.0-rc1 . I manually deleted the 2.2.0 folder and installed the 2.3.0-rc1 like you said. The code compiles fine now.

The new HTTP error it shows now is :
HTTP_UPDATE_FAILED Error (-1): HTTP error: connection refused

@igrr

This comment has been minimized.

Show comment
Hide comment
@igrr

igrr May 13, 2016

Member

Which is probably the correct behaviour now, because you are loading HTTPS URL without specifying certificate fingerprint. Could you try the same, replacing https with http in your binary URL?

Member

igrr commented May 13, 2016

Which is probably the correct behaviour now, because you are loading HTTPS URL without specifying certificate fingerprint. Could you try the same, replacing https with http in your binary URL?

@Zyxmn

This comment has been minimized.

Show comment
Hide comment
@Zyxmn

Zyxmn May 13, 2016

Tried the http version, the error is back to
HTTP_UPDATE_FAILED Error (-104): Wrong HTTP code

Zyxmn commented May 13, 2016

Tried the http version, the error is back to
HTTP_UPDATE_FAILED Error (-104): Wrong HTTP code

@igrr

This comment has been minimized.

Show comment
Hide comment
@igrr

igrr May 13, 2016

Member

Your server sends HTTP code 301, "Moved permanently". ESP8266HTTPUpdate library doesn't support HTTP redirects at this point. It expects an URL which points directly to the binary.

curl -v http://rawgit.com/Zyxmn/esp8266_BlinkyBin/master/Blinky.cpp.bin
*   Trying 104.18.62.176...
* Connected to rawgit.com (104.18.62.176) port 80 (#0)
> GET /Zyxmn/esp8266_BlinkyBin/master/Blinky.cpp.bin HTTP/1.1
> Host: rawgit.com
> User-Agent: curl/7.48.0
> Accept: */*
> 
< HTTP/1.1 301 Moved Permanently
< Date: Fri, 13 May 2016 11:52:44 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 214
< Connection: keep-alive
< Set-Cookie: __cfduid=dd3dbfc868520226a7f6f7b3f6da9855c1463140364; expires=Sat, 13-May-17 11:52:44 GMT; path=/; domain=.rawgit.com; HttpOnly
< X-Content-Type-Options: nosniff
< X-Robots-Tag: none
< RawGit-Naughtiness: 0
< Access-Control-Allow-Origin: *
< Cache-Control: public, max-age=2592000
< Location: https://raw.githubusercontent.com/Zyxmn/esp8266_BlinkyBin/master/Blinky.cpp.bin
< Vary: Accept
< RawGit-Cache-Status: HIT
< CF-Cache-Status: HIT
< Expires: Sun, 12 Jun 2016 11:52:44 GMT
< Server: cloudflare-nginx
< CF-RAY: 2a25e7eb815a16b2-ARN
Member

igrr commented May 13, 2016

Your server sends HTTP code 301, "Moved permanently". ESP8266HTTPUpdate library doesn't support HTTP redirects at this point. It expects an URL which points directly to the binary.

curl -v http://rawgit.com/Zyxmn/esp8266_BlinkyBin/master/Blinky.cpp.bin
*   Trying 104.18.62.176...
* Connected to rawgit.com (104.18.62.176) port 80 (#0)
> GET /Zyxmn/esp8266_BlinkyBin/master/Blinky.cpp.bin HTTP/1.1
> Host: rawgit.com
> User-Agent: curl/7.48.0
> Accept: */*
> 
< HTTP/1.1 301 Moved Permanently
< Date: Fri, 13 May 2016 11:52:44 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 214
< Connection: keep-alive
< Set-Cookie: __cfduid=dd3dbfc868520226a7f6f7b3f6da9855c1463140364; expires=Sat, 13-May-17 11:52:44 GMT; path=/; domain=.rawgit.com; HttpOnly
< X-Content-Type-Options: nosniff
< X-Robots-Tag: none
< RawGit-Naughtiness: 0
< Access-Control-Allow-Origin: *
< Cache-Control: public, max-age=2592000
< Location: https://raw.githubusercontent.com/Zyxmn/esp8266_BlinkyBin/master/Blinky.cpp.bin
< Vary: Accept
< RawGit-Cache-Status: HIT
< CF-Cache-Status: HIT
< Expires: Sun, 12 Jun 2016 11:52:44 GMT
< Server: cloudflare-nginx
< CF-RAY: 2a25e7eb815a16b2-ARN
@Zyxmn

This comment has been minimized.

Show comment
Hide comment
@Zyxmn

Zyxmn May 13, 2016

Thanks for that! Do you have any suggestions on servers I could use to get a direct link to the bin file?

Zyxmn commented May 13, 2016

Thanks for that! Do you have any suggestions on servers I could use to get a direct link to the bin file?

@igrr

This comment has been minimized.

Show comment
Hide comment
@igrr

igrr May 16, 2016

Member

Well using the URL from Location header above (https://raw.githubusercontent.com/Zyxmn/esp8266_BlinkyBin/master/Blinky.cpp.bin) worked for me.

Member

igrr commented May 16, 2016

Well using the URL from Location header above (https://raw.githubusercontent.com/Zyxmn/esp8266_BlinkyBin/master/Blinky.cpp.bin) worked for me.

@Zyxmn

This comment has been minimized.

Show comment
Hide comment
@Zyxmn

Zyxmn May 16, 2016

Could you please post the sketch you've used ? I have tried both the http and https URLS, and it still does not seem to be working for me.

HTTPS : gives the connection refused error
HTTP : gives the wrong http code error.

I even tried the default httpServer example, changing only the ssid password and the url . The results are the same.

Zyxmn commented May 16, 2016

Could you please post the sketch you've used ? I have tried both the http and https URLS, and it still does not seem to be working for me.

HTTPS : gives the connection refused error
HTTP : gives the wrong http code error.

I even tried the default httpServer example, changing only the ssid password and the url . The results are the same.

@igrr

This comment has been minimized.

Show comment
Hide comment
@igrr

igrr May 16, 2016

Member

Sketch was:

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>

void setup() {
  Serial.begin(115200);
  Serial.setDebugOutput(true);
  Serial.println();

  WiFi.begin("testbox1", "testbox123");
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
  }
  Serial.println("Connected, updating");
  delay(1000);

  t_httpUpdate_return ret = ESPhttpUpdate.update("https://raw.githubusercontent.com/Zyxmn/esp8266_BlinkyBin/master/Blinky.cpp.bin", "", "21 99 13 84 63 72 17 13 B9 ED 0E 8F 00 A5 9B 73 0D D0 56 58");
}
void loop() {
}

Don't forget to power cycle the ESP after uploading this sketch, otherwise it will fail to update.

Output (with some debugging enabled from Tools menu):

rl.lúû|.ål‡|....å.lÏ.b|éÇ.Ï.íríbå.båÚnnûlnnú‚Ï.b.pÏélrlrlpÚn‡....Ç.l.åú...b.n‚|.lååéébåÚnnÓ.låél`.ê..nn.l`...nréíín...åú.l.ríín...åú.l¸Çnú.
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 3
cnt 

connected with testbox1, channel 6
dhcp client start...
ip:192.168.77.138,mask:255.255.255.0,gw:192.168.77.1
Connected, updating
[HTTP-Client][begin] url: https://raw.githubusercontent.com/Zyxmn/esp8266_BlinkyBin/master/Blinky.cpp.bin
[HTTP-Client][begin] host: raw.githubusercontent.com port: 443 url: /Zyxmn/esp8266_BlinkyBin/master/Blinky.cpp.bin
[HTTP-Client][begin] httpsFingerprint: 21 99 13 84 63 72 17 13 B9 ED 0E 8F 00 A5 9B 73 0D D0 56 58
please start sntp first !
State:.sending Client Hello (1)
State:.receiving Server Hello (2)
State:.receiving Certificate (11)
State:.receiving Server Hello Done (14)
State:.sending Client Key Exchange (16)
State:.sending Finished (16)
State:.receiving Finished (16)
[HTTP-Client] connected to raw.githubusercontent.com:443
[HTTP-Client][handleHeaderResponse] RX: 'HTTP/1.1 200 OK'
[HTTP-Client][handleHeaderResponse] RX: 'Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline''
[HTTP-Client][handleHeaderResponse] RX: 'X-XSS-Protection: 1; mode=block'
[HTTP-Client][handleHeaderResponse] RX: 'X-Frame-Options: deny'
[HTTP-Client][handleHeaderResponse] RX: 'X-Content-Type-Options: nosniff'
[HTTP-Client][handleHeaderResponse] RX: 'Strict-Transport-Security: max-age=31536000'
[HTTP-Client][handleHeaderResponse] RX: 'ETag: "9a1278562c6f247c7897ef76a9c45c9fdac4af21"'
[HTTP-Client][handleHeaderResponse] RX: 'Content-Type: application/octet-stream'
[HTTP-Client][handleHeaderResponse] RX: 'Cache-Control: max-age=300'
[HTTP-Client][handleHeaderResponse] RX: 'X-GitHub-Request-Id: 67F5E015:68C0:272B0E7:57398E67'
[HTTP-Client][handleHeaderResponse] RX: 'Content-Length: 223408'
[HTTP-Client][handleHeaderResponse] RX: 'Accept-Ranges: bytes'
[HTTP-Client][handleHeaderResponse] RX: 'Date: Mon, 16 May 2016 09:12:31 GMT'
[HTTP-Client][handleHeaderResponse] RX: 'Via: 1.1 varnish'
[HTTP-Client][handleHeaderResponse] RX: 'Connection: close'
[HTTP-Client][handleHeaderResponse] RX: 'X-Served-By: cache-itm7427-ITM'
[HTTP-Client][handleHeaderResponse] RX: 'X-Cache: HIT'
[HTTP-Client][handleHeaderResponse] RX: 'X-Cache-Hits: 1'
[HTTP-Client][handleHeaderResponse] RX: 'Vary: Authorization,Accept-Encoding'
[HTTP-Client][handleHeaderResponse] RX: 'Access-Control-Allow-Origin: *'
[HTTP-Client][handleHeaderResponse] RX: 'X-Fastly-Request-ID: e112eb24a13c03efc43b78037efdc30ce39c5226'
[HTTP-Client][handleHeaderResponse] RX: 'Expires: Mon, 16 May 2016 09:17:31 GMT'
[HTTP-Client][handleHeaderResponse] RX: 'Source-Age: 152'
[HTTP-Client][handleHeaderResponse] RX: ''
[HTTP-Client][handleHeaderResponse] code: 200
[HTTP-Client][handleHeaderResponse] size: 223408
sleep disable
ssl->need_bytes=16432 > 6859
pm open,type:0 0
Alert: close notify
[HTTP-Client][end] tcp is closed
state: 5 -> 0 (0)
rm 0
pm close 7
del if0
usl

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 1264, room 16 
tail 0
chksum 0x0f
csum 0x0f
@cp:0
ld

The @cp:0 line indicates that the sketch was updated successfully.

Member

igrr commented May 16, 2016

Sketch was:

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>

void setup() {
  Serial.begin(115200);
  Serial.setDebugOutput(true);
  Serial.println();

  WiFi.begin("testbox1", "testbox123");
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
  }
  Serial.println("Connected, updating");
  delay(1000);

  t_httpUpdate_return ret = ESPhttpUpdate.update("https://raw.githubusercontent.com/Zyxmn/esp8266_BlinkyBin/master/Blinky.cpp.bin", "", "21 99 13 84 63 72 17 13 B9 ED 0E 8F 00 A5 9B 73 0D D0 56 58");
}
void loop() {
}

Don't forget to power cycle the ESP after uploading this sketch, otherwise it will fail to update.

Output (with some debugging enabled from Tools menu):

rl.lúû|.ål‡|....å.lÏ.b|éÇ.Ï.íríbå.båÚnnûlnnú‚Ï.b.pÏélrlrlpÚn‡....Ç.l.åú...b.n‚|.lååéébåÚnnÓ.låél`.ê..nn.l`...nréíín...åú.l.ríín...åú.l¸Çnú.
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 3
cnt 

connected with testbox1, channel 6
dhcp client start...
ip:192.168.77.138,mask:255.255.255.0,gw:192.168.77.1
Connected, updating
[HTTP-Client][begin] url: https://raw.githubusercontent.com/Zyxmn/esp8266_BlinkyBin/master/Blinky.cpp.bin
[HTTP-Client][begin] host: raw.githubusercontent.com port: 443 url: /Zyxmn/esp8266_BlinkyBin/master/Blinky.cpp.bin
[HTTP-Client][begin] httpsFingerprint: 21 99 13 84 63 72 17 13 B9 ED 0E 8F 00 A5 9B 73 0D D0 56 58
please start sntp first !
State:.sending Client Hello (1)
State:.receiving Server Hello (2)
State:.receiving Certificate (11)
State:.receiving Server Hello Done (14)
State:.sending Client Key Exchange (16)
State:.sending Finished (16)
State:.receiving Finished (16)
[HTTP-Client] connected to raw.githubusercontent.com:443
[HTTP-Client][handleHeaderResponse] RX: 'HTTP/1.1 200 OK'
[HTTP-Client][handleHeaderResponse] RX: 'Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline''
[HTTP-Client][handleHeaderResponse] RX: 'X-XSS-Protection: 1; mode=block'
[HTTP-Client][handleHeaderResponse] RX: 'X-Frame-Options: deny'
[HTTP-Client][handleHeaderResponse] RX: 'X-Content-Type-Options: nosniff'
[HTTP-Client][handleHeaderResponse] RX: 'Strict-Transport-Security: max-age=31536000'
[HTTP-Client][handleHeaderResponse] RX: 'ETag: "9a1278562c6f247c7897ef76a9c45c9fdac4af21"'
[HTTP-Client][handleHeaderResponse] RX: 'Content-Type: application/octet-stream'
[HTTP-Client][handleHeaderResponse] RX: 'Cache-Control: max-age=300'
[HTTP-Client][handleHeaderResponse] RX: 'X-GitHub-Request-Id: 67F5E015:68C0:272B0E7:57398E67'
[HTTP-Client][handleHeaderResponse] RX: 'Content-Length: 223408'
[HTTP-Client][handleHeaderResponse] RX: 'Accept-Ranges: bytes'
[HTTP-Client][handleHeaderResponse] RX: 'Date: Mon, 16 May 2016 09:12:31 GMT'
[HTTP-Client][handleHeaderResponse] RX: 'Via: 1.1 varnish'
[HTTP-Client][handleHeaderResponse] RX: 'Connection: close'
[HTTP-Client][handleHeaderResponse] RX: 'X-Served-By: cache-itm7427-ITM'
[HTTP-Client][handleHeaderResponse] RX: 'X-Cache: HIT'
[HTTP-Client][handleHeaderResponse] RX: 'X-Cache-Hits: 1'
[HTTP-Client][handleHeaderResponse] RX: 'Vary: Authorization,Accept-Encoding'
[HTTP-Client][handleHeaderResponse] RX: 'Access-Control-Allow-Origin: *'
[HTTP-Client][handleHeaderResponse] RX: 'X-Fastly-Request-ID: e112eb24a13c03efc43b78037efdc30ce39c5226'
[HTTP-Client][handleHeaderResponse] RX: 'Expires: Mon, 16 May 2016 09:17:31 GMT'
[HTTP-Client][handleHeaderResponse] RX: 'Source-Age: 152'
[HTTP-Client][handleHeaderResponse] RX: ''
[HTTP-Client][handleHeaderResponse] code: 200
[HTTP-Client][handleHeaderResponse] size: 223408
sleep disable
ssl->need_bytes=16432 > 6859
pm open,type:0 0
Alert: close notify
[HTTP-Client][end] tcp is closed
state: 5 -> 0 (0)
rm 0
pm close 7
del if0
usl

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 1264, room 16 
tail 0
chksum 0x0f
csum 0x0f
@cp:0
ld

The @cp:0 line indicates that the sketch was updated successfully.

@Zyxmn

This comment has been minimized.

Show comment
Hide comment
@Zyxmn

Zyxmn May 16, 2016

Thanks for the help @igrr !

Edit: After the OTA , the esp seems to require a manual reset every single time. This is what I received on my serial monitor using your sketch.

Connected, updating
please start sntp first !
sleep disable
ssl->need_bytes=16432 > 6859
state: 5 -> 0 (0)
rm 0
del if0
bcn 0
del if1
usl

ets Jan 8 2013,rst cause:2, boot mode:(1,6)

ets Jan 8 2013,rst cause:4, boot mode:(1,6)

wdt reset

The system hangs after printing this out . A manual reset after this seems to run the new sketch . The serial monitor output is different to what you have posted for the same sketch. Like , some lines are missing and the reset cause seems to be different.

Zyxmn commented May 16, 2016

Thanks for the help @igrr !

Edit: After the OTA , the esp seems to require a manual reset every single time. This is what I received on my serial monitor using your sketch.

Connected, updating
please start sntp first !
sleep disable
ssl->need_bytes=16432 > 6859
state: 5 -> 0 (0)
rm 0
del if0
bcn 0
del if1
usl

ets Jan 8 2013,rst cause:2, boot mode:(1,6)

ets Jan 8 2013,rst cause:4, boot mode:(1,6)

wdt reset

The system hangs after printing this out . A manual reset after this seems to run the new sketch . The serial monitor output is different to what you have posted for the same sketch. Like , some lines are missing and the reset cause seems to be different.

@Zyxmn Zyxmn closed this May 16, 2016

@Zyxmn Zyxmn reopened this May 16, 2016

@igrr

This comment has been minimized.

Show comment
Hide comment
@igrr

igrr May 16, 2016

Member

ESP requires manual reset after UART upload, but not after OTA upload.

Your boot mode (1,6) indicates that either you didn't reset ESP after UART upload, or GPIO0 was low at the time when it got reset after OTA.

Member

igrr commented May 16, 2016

ESP requires manual reset after UART upload, but not after OTA upload.

Your boot mode (1,6) indicates that either you didn't reset ESP after UART upload, or GPIO0 was low at the time when it got reset after OTA.

@Zyxmn

This comment has been minimized.

Show comment
Hide comment
@Zyxmn

Zyxmn May 16, 2016

Not Resetting after UART upload was the reason. OTA works perfectly now. Cheers!

Zyxmn commented May 16, 2016

Not Resetting after UART upload was the reason. OTA works perfectly now. Cheers!

@Zyxmn Zyxmn closed this May 16, 2016

@bp28203

This comment has been minimized.

Show comment
Hide comment
@bp28203

bp28203 Jun 24, 2016

Can anyone help me with this issue...

I ahve hosted the bin file on Microsft IIS server at this location http://192.168.0.5:912/blinkredLedFast.bin.

If I try to access this link from browser I do get the download option. However if I use it in the code I get error as

HTTP_UPDATE_FAILD Error (-1): HTTP error: connection refused

I tried replacing the below code

t_httpUpdate_return ret = ESPhttpUpdate.update("http://192.168.0.5:912/blinkredLedFast.bin","80");

with
t_httpUpdate_return ret = ESPhttpUpdate.update("https://raw.githubusercontent.com/Zyxmn/esp8266_BlinkyBin/master/Blinky.cpp.bin", "", "21 99 13 84 63 72 17 13 B9 ED 0E 8F 00 A5 9B 73 0D D0 56 58");

and bin files get downloaded successfully. in to my Adafruit huzzah feather.

bp28203 commented Jun 24, 2016

Can anyone help me with this issue...

I ahve hosted the bin file on Microsft IIS server at this location http://192.168.0.5:912/blinkredLedFast.bin.

If I try to access this link from browser I do get the download option. However if I use it in the code I get error as

HTTP_UPDATE_FAILD Error (-1): HTTP error: connection refused

I tried replacing the below code

t_httpUpdate_return ret = ESPhttpUpdate.update("http://192.168.0.5:912/blinkredLedFast.bin","80");

with
t_httpUpdate_return ret = ESPhttpUpdate.update("https://raw.githubusercontent.com/Zyxmn/esp8266_BlinkyBin/master/Blinky.cpp.bin", "", "21 99 13 84 63 72 17 13 B9 ED 0E 8F 00 A5 9B 73 0D D0 56 58");

and bin files get downloaded successfully. in to my Adafruit huzzah feather.

@kenpeter

This comment has been minimized.

Show comment
Hide comment
@kenpeter

kenpeter Aug 3, 2016

@igrr

ESP8266HTTPUpdate library doesn't support HTTP redirects at this point. It expects an URL which points directly to the binary.

There is a section called "Advanced updater" in https://esp8266.github.io/Arduino/versions/2.0.0/doc/ota_updates/ota_updates.html

Also in .arduino15/packages/esp8266/hardware/esp8266/2.3.0/doc/ota_updates/readme.md, line 342

It seems I can create a php script, then when hit this script, firmware will be downloaded, no need to hit the direct bin file in server. Am I correct?

Because I have a URL in laravel 5, which allows the firmware to be download dynamically. Currently, I am not able to make it working. In your comment above, esp update only allows direct hit to the bin file. Are you able to clarify?

kenpeter commented Aug 3, 2016

@igrr

ESP8266HTTPUpdate library doesn't support HTTP redirects at this point. It expects an URL which points directly to the binary.

There is a section called "Advanced updater" in https://esp8266.github.io/Arduino/versions/2.0.0/doc/ota_updates/ota_updates.html

Also in .arduino15/packages/esp8266/hardware/esp8266/2.3.0/doc/ota_updates/readme.md, line 342

It seems I can create a php script, then when hit this script, firmware will be downloaded, no need to hit the direct bin file in server. Am I correct?

Because I have a URL in laravel 5, which allows the firmware to be download dynamically. Currently, I am not able to make it working. In your comment above, esp update only allows direct hit to the bin file. Are you able to clarify?

@igrr

This comment has been minimized.

Show comment
Hide comment
@igrr

igrr Aug 3, 2016

Member

Sorry, i'm not familiar with php and laravel. Currently HTTP response has to contain the actual binary, not a redirect to another URL. I.e. response code has to be 20x and with binary file in the body of response.

Member

igrr commented Aug 3, 2016

Sorry, i'm not familiar with php and laravel. Currently HTTP response has to contain the actual binary, not a redirect to another URL. I.e. response code has to be 20x and with binary file in the body of response.

@kenpeter

This comment has been minimized.

Show comment
Hide comment
@kenpeter

kenpeter Aug 3, 2016

Hi,

This the url: https://toothfi.com/device/device/wifi_gateway/set_me_up/prod/get_firmware

  1. I test this: curl -v https://toothfi.com/device/device/wifi_gateway/set_me_up/prod/get_firmware > out.txt
    HTTP/1.1 200 OK and out.txt is the binary file.
  2. Try the code below, error: HTTP_UPDATE_FAILD Error (-1): HTTP error: connection refused
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>

void setup() {
  Serial.begin(115200);
  Serial.setDebugOutput(true);
  Serial.println();

  WiFi.begin("xyz", "xyz");
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
  }
  Serial.println("Connected, updating");
  delay(1000);

  t_httpUpdate_return ret = ESPhttpUpdate.update("https://toothfi.com/device/device/wifi_gateway/set_me_up/prod/get_firmware");

  Serial.println(F("\n---- ota update done ----\n"));
  switch(ret) 
  {
    case HTTP_UPDATE_FAILED:
      Serial.printf("HTTP_UPDATE_FAILD Error (%d): %s", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
        break;
    case HTTP_UPDATE_NO_UPDATES:
      Serial.println(F("HTTP_UPDATE_NO_UPDATES"));
      break;
    case HTTP_UPDATE_OK:
      Serial.println(F("HTTP_UPDATE_OK"));
      break;
    default:
        Serial.printf("Unexpected response code %d from ESPhttpUpdate.update\n",(int)ret);
        break;

  }
}
void loop() {
}

3.The header I am using

// https://stackoverflow.com/questions/4345322/how-can-i-allow-a-user-to-download-a-file-which-is-stored-outside-of-the-webroot
  private function get_firmware_download($file) {
    if (file_exists($file)) {
      header('Content-Description: File Transfer');
      header('Content-Type: application/octet-stream');
      header('Content-Disposition: attachment; filename='.basename($file));
      header('Content-Transfer-Encoding: binary');
      header('Expires: 0');
      header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
      header('Pragma: public');
      header('Content-Length: ' . filesize($file));
      ob_clean();
      flush();
      readfile($file);
      exit;
    }
    else {
      echo "no such file: $file";
      die;
    }
  }

kenpeter commented Aug 3, 2016

Hi,

This the url: https://toothfi.com/device/device/wifi_gateway/set_me_up/prod/get_firmware

  1. I test this: curl -v https://toothfi.com/device/device/wifi_gateway/set_me_up/prod/get_firmware > out.txt
    HTTP/1.1 200 OK and out.txt is the binary file.
  2. Try the code below, error: HTTP_UPDATE_FAILD Error (-1): HTTP error: connection refused
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>

void setup() {
  Serial.begin(115200);
  Serial.setDebugOutput(true);
  Serial.println();

  WiFi.begin("xyz", "xyz");
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
  }
  Serial.println("Connected, updating");
  delay(1000);

  t_httpUpdate_return ret = ESPhttpUpdate.update("https://toothfi.com/device/device/wifi_gateway/set_me_up/prod/get_firmware");

  Serial.println(F("\n---- ota update done ----\n"));
  switch(ret) 
  {
    case HTTP_UPDATE_FAILED:
      Serial.printf("HTTP_UPDATE_FAILD Error (%d): %s", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
        break;
    case HTTP_UPDATE_NO_UPDATES:
      Serial.println(F("HTTP_UPDATE_NO_UPDATES"));
      break;
    case HTTP_UPDATE_OK:
      Serial.println(F("HTTP_UPDATE_OK"));
      break;
    default:
        Serial.printf("Unexpected response code %d from ESPhttpUpdate.update\n",(int)ret);
        break;

  }
}
void loop() {
}

3.The header I am using

// https://stackoverflow.com/questions/4345322/how-can-i-allow-a-user-to-download-a-file-which-is-stored-outside-of-the-webroot
  private function get_firmware_download($file) {
    if (file_exists($file)) {
      header('Content-Description: File Transfer');
      header('Content-Type: application/octet-stream');
      header('Content-Disposition: attachment; filename='.basename($file));
      header('Content-Transfer-Encoding: binary');
      header('Expires: 0');
      header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
      header('Pragma: public');
      header('Content-Length: ' . filesize($file));
      ob_clean();
      flush();
      readfile($file);
      exit;
    }
    else {
      echo "no such file: $file";
      die;
    }
  }

@igrr

This comment has been minimized.

Show comment
Hide comment
@igrr

igrr Aug 3, 2016

Member

Since you're using HTTPS, you need to provide HTTPS certificate fingerprint as third argument to update.

https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h#L78-L79

edit:

ESPhttpUpdate.update("https://toothfi.com/device/device/wifi_gateway/set_me_up/prod/get_firmware", "", "80 C7 58 94 C8 D7 E0 D0 96 4D E8 E3 30 35 03 CF 4A 22 32 C2");
Member

igrr commented Aug 3, 2016

Since you're using HTTPS, you need to provide HTTPS certificate fingerprint as third argument to update.

https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h#L78-L79

edit:

ESPhttpUpdate.update("https://toothfi.com/device/device/wifi_gateway/set_me_up/prod/get_firmware", "", "80 C7 58 94 C8 D7 E0 D0 96 4D E8 E3 30 35 03 CF 4A 22 32 C2");
@DavidFi1

This comment has been minimized.

Show comment
Hide comment
@DavidFi1

DavidFi1 Dec 1, 2016

igrr commented on Aug 3
not a redirect to another URL. I.e. response code has to be 20x and with binary file in the body of response.

Can you please fix this issue?
We will be able to use google drive etc...
It could be very very useful !!!

Thank you.
David.

DavidFi1 commented Dec 1, 2016

igrr commented on Aug 3
not a redirect to another URL. I.e. response code has to be 20x and with binary file in the body of response.

Can you please fix this issue?
We will be able to use google drive etc...
It could be very very useful !!!

Thank you.
David.

@mugginsjm

This comment has been minimized.

Show comment
Hide comment
@mugginsjm

mugginsjm Mar 8, 2017

Hi maybe someone can help me. I have had some success with OTA but not with this sketch
I don't know what the problem is here?... I get:
thanks

[httpUpdate] Header read fin.
[httpUpdate] Server header:
[httpUpdate] - code: 200
[httpUpdate] - len: 360736
[httpUpdate] ESP8266 info:
[httpUpdate] - free Space: 2781184
[httpUpdate] - current Sketch Size: 363904
[httpUpdate] runUpdate flash...
sleep disable
[begin] roundedSize: 0x00059000 (364544)
[begin] updateEndAddress: 0x00300000 (3145728)
[begin] currentSketchSize: 0x00059000 (364544)
[begin] _startAddress: 0x002A7000 (2781184)
[begin] _currentAddress: 0x002A7000 (2781184)
[begin] _size: 0x00058120 (360736)
Fatal exception 0(IllegalInstructionCause):
epc1=0x40201014, epc2=0x00000000, epc3=0x400043da, excvaddr=0x00000000, depc=0x00000000

Exception (0):
epc1=0x40201014 epc2=0x00000000 epc3=0x400043da excvaddr=0x00000000 depc=0x00000000

ctx: sys
sp: 3ffefb30 end: 3fffffb0 offset: 01a0

stack>>>
3ffefcd0: 00000000 00000000 00000000 401052a1
3ffefce0: 4010644f 00000000 00000000 00000000

mugginsjm commented Mar 8, 2017

Hi maybe someone can help me. I have had some success with OTA but not with this sketch
I don't know what the problem is here?... I get:
thanks

[httpUpdate] Header read fin.
[httpUpdate] Server header:
[httpUpdate] - code: 200
[httpUpdate] - len: 360736
[httpUpdate] ESP8266 info:
[httpUpdate] - free Space: 2781184
[httpUpdate] - current Sketch Size: 363904
[httpUpdate] runUpdate flash...
sleep disable
[begin] roundedSize: 0x00059000 (364544)
[begin] updateEndAddress: 0x00300000 (3145728)
[begin] currentSketchSize: 0x00059000 (364544)
[begin] _startAddress: 0x002A7000 (2781184)
[begin] _currentAddress: 0x002A7000 (2781184)
[begin] _size: 0x00058120 (360736)
Fatal exception 0(IllegalInstructionCause):
epc1=0x40201014, epc2=0x00000000, epc3=0x400043da, excvaddr=0x00000000, depc=0x00000000

Exception (0):
epc1=0x40201014 epc2=0x00000000 epc3=0x400043da excvaddr=0x00000000 depc=0x00000000

ctx: sys
sp: 3ffefb30 end: 3fffffb0 offset: 01a0

stack>>>
3ffefcd0: 00000000 00000000 00000000 401052a1
3ffefce0: 4010644f 00000000 00000000 00000000

@Cristianistrate

This comment has been minimized.

Show comment
Hide comment
@Cristianistrate

Cristianistrate Apr 2, 2017

Hi, I got "HTTP_UPDATE_FAILD Error (-1): HTTP error: connection refused"
I use " t_httpUpdate_return ret = ESPhttpUpdate.update("http://10.10.10.20",80,"/ota.php");"
The php will give me the right file.
on CHROME it says "only for ESP8266 updater!" but I got error on esp.
Please help.

Cristianistrate commented Apr 2, 2017

Hi, I got "HTTP_UPDATE_FAILD Error (-1): HTTP error: connection refused"
I use " t_httpUpdate_return ret = ESPhttpUpdate.update("http://10.10.10.20",80,"/ota.php");"
The php will give me the right file.
on CHROME it says "only for ESP8266 updater!" but I got error on esp.
Please help.

@pieman64

This comment has been minimized.

Show comment
Hide comment
@pieman64

pieman64 Apr 2, 2017

@Cristianistrate doesn't the port need to be "80" rather than 80?
Are you able to provide details of the headers you are using in your sketch and your PHP script?

pieman64 commented Apr 2, 2017

@Cristianistrate doesn't the port need to be "80" rather than 80?
Are you able to provide details of the headers you are using in your sketch and your PHP script?

@Cristianistrate

This comment has been minimized.

Show comment
Hide comment
@Cristianistrate

Cristianistrate Apr 2, 2017

Tried "80". same error.
!check_header('HTTP_X_ESP8266_STA_MAC') ||
!check_header('HTTP_X_ESP8266_AP_MAC') ||
!check_header('HTTP_X_ESP8266_FREE_SPACE') ||
!check_header('HTTP_X_ESP8266_SKETCH_SIZE') ||
!check_header('HTTP_X_ESP8266_SKETCH_MD5') ||
!check_header('HTTP_X_ESP8266_CHIP_SIZE') ||
!check_header('HTTP_X_ESP8266_SDK_VERSION')

Cristianistrate commented Apr 2, 2017

Tried "80". same error.
!check_header('HTTP_X_ESP8266_STA_MAC') ||
!check_header('HTTP_X_ESP8266_AP_MAC') ||
!check_header('HTTP_X_ESP8266_FREE_SPACE') ||
!check_header('HTTP_X_ESP8266_SKETCH_SIZE') ||
!check_header('HTTP_X_ESP8266_SKETCH_MD5') ||
!check_header('HTTP_X_ESP8266_CHIP_SIZE') ||
!check_header('HTTP_X_ESP8266_SDK_VERSION')

@kandev

This comment has been minimized.

Show comment
Hide comment
@kandev

kandev Apr 28, 2017

I guess the error is because you check for "HTTP_X_ESP8266_SKETCH_MD5" header.
Although it's written in all the examples around the net, it's never sent by ESP8266. Maybe it's bug, maybe I'm doing it wrong, but HTTP_X_ESP8266_SKETCH_MD5 header is missing on my ESPs.

kandev commented Apr 28, 2017

I guess the error is because you check for "HTTP_X_ESP8266_SKETCH_MD5" header.
Although it's written in all the examples around the net, it's never sent by ESP8266. Maybe it's bug, maybe I'm doing it wrong, but HTTP_X_ESP8266_SKETCH_MD5 header is missing on my ESPs.

@davisonja

This comment has been minimized.

Show comment
Hide comment
@davisonja

davisonja Apr 30, 2017

davisonja commented Apr 30, 2017

@cirdiam

This comment has been minimized.

Show comment
Hide comment
@cirdiam

cirdiam May 6, 2017

I can get OTA updates working using http, but not using https
I'm using Arduino IDE 1.6.9, ESP8266 cores 2.3.0, an ESP8266-12E

code is:
#include <Arduino.h>

#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>

#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>
#include <WiFiClientSecure.h>

#define USE_SERIAL Serial

ESP8266WiFiMulti WiFiMulti; //use this when using ESP8266WiFiMulti.h

const char* ssid = "...my ssid..";
const char* pass = "..my router password";
const char* host = "www.aquaswift.ca";
const int httpsPort = 443;
const char* fingerprint = "fe a4 1f 46 64 35 19 6a d7 5a 08 a2 9d 20 62 24 6b e9 fd ef";

void setup() {

//setup serial port
USE_SERIAL.begin(115200);
USE_SERIAL.setDebugOutput(true);

USE_SERIAL.println();
USE_SERIAL.println();
USE_SERIAL.println();

for(uint8_t t = 4; t > 0; t--) {
    USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);
    USE_SERIAL.flush();
    delay(1000);
}

//connect to wifi
WiFiMulti.addAP(ssid, pass); //use this when using ESP8266WiFiMulti.h

// wait for WiFi connection
Serial.println();    
Serial.print("Waiting for wifi");    
while (WiFiMulti.run() != WL_CONNECTED) { //use this when using ESP8266WiFiMulti.h
  Serial.print(".");
  delay(500);    
}
Serial.println();
Serial.println("WiFi connected");
Serial.println();
Serial.print("WiFi connected.  IP address:");
Serial.println(WiFi.localIP()); 

//establish a connection to remote web server
// Use WiFiClientSecure class to create TLS connection
WiFiClientSecure client;
Serial.print("connecting to ");
Serial.println(host);
if (!client.connect(host, httpsPort)) {
Serial.println("connection failed");
return;
}

if (client.verify(fingerprint, host)) {
  Serial.println("certificate matches");
} else {
  Serial.println("certificate doesn't match");
}

  if((WiFiMulti.run() == WL_CONNECTED)) { 

      //t_httpUpdate_return ret = ESPhttpUpdate.update("http://server/file.bin");
      //t_httpUpdate_return  ret = ESPhttpUpdate.update("https://server/file.bin");

      Serial.println("About to do OTA firmware update");
      delay(100);
      
      t_httpUpdate_return ret = ESPhttpUpdate.update("https://aquaswift.ca/fw/blink.bin","","fe a4 1f 46 64 35 19 6a d7 5a 08 a2 9d 20 62 24 6b e9 fd ef");

      switch(ret) {
          case HTTP_UPDATE_FAILED:
              USE_SERIAL.printf("HTTP_UPDATE_FAILD Error (%d): %s", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
              break;

          case HTTP_UPDATE_NO_UPDATES:
              USE_SERIAL.println("HTTP_UPDATE_NO_UPDATES");
              break;

          case HTTP_UPDATE_OK:
              USE_SERIAL.println("HTTP_UPDATE_OK");
              break;
      }
      Serial.println("Finished attempt to do OTA firmware update");
  }

Serial.println("Doing rest of setup");
pinMode(2, OUTPUT);

}

void loop() {
digitalWrite(2, HIGH); // turn the LED on (HIGH is the voltage level)
delay(200); // wait for a second
digitalWrite(2, LOW); // turn the LED off by making the voltage LOW
delay(200); // wait for a second
}

=================================================
output on serial port after first run after download is:

[SETUP] WAIT 4...
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 16
cnt

connected with 2GHz, channel 6
dhcp client start...
[SETUP] WAIT 3...
ip:192.168.1.147,mask:255.255.255.0,gw:192.168.1.1
[SETUP] WAIT 2...
[SETUP] WAIT 1...

Waiting for wifi
WiFi connected

WiFi connected. IP address:192.168.1.147
connecting to www.aquaswift.ca
please start sntp first !
certificate matches
About to do OTA firmware update
please start sntp first !
Fatal exception 29(StoreProhibitedCause):
epc1=0x4000e1b2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000

Exception (29):
epc1=0x4000e1b2 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont
sp: 3fff0bc0 end: 3fff11b0 offset: 01a0

stack>>>
3fff0d60: 00000040 00000082 3fffaf2c 402252c9
3fff0d70: 3fff96e4 3fff91dc 00000000 00000041
3fff0d80: 00000040 0000003f 00000000 00000041
3fff0d90: 3fffbc5c 00000000 3fff8fbc 3fff96cc
3fff0da0: 3fffbd58 3fff8fd4 3fff91dc 3fff91dc
3fff0db0: 00000040 3fff91dc 3fffaf2c 3fff91dc
3fff0dc0: 00000040 3fff91dc 3fffaf2c 40225dfe
3fff0dd0: 3fff926c 0000003f 0be8633a 00000020
3fff0de0: 3fff4b14 3fff91dc 3fff94c4 00000020
3fff0df0: 3fff4b14 3fff91dc 00000010 402260e4
3fff0e00: 3fff613c 3fff94ac 3fff94c4 00000001
3fff0e10: 00000001 3fff94c4 3fff6fc1 40224ebc
3fff0e20: 00000100 3fff923c 3fff6fbf 00000000
3fff0e30: 00000100 3fff923c 3fff6fbf 402270e5
3fff0e40: 3fff0e70 00000000 000000d0 00000030
3fff0e50: 549ddb7a cd0b3f65 39fd87c3 00000004
3fff0e60: 00000004 3fff406c 3fff6fb9 402231f0
3fff0e70: 5b600203 6baea338 179e3d83 a83f3c9f
3fff0e80: f177addf 168a51ae d3e02927 84c336dd
3fff0e90: d6205a6d 9f1001f6 0461cecf db7af600
3fff0ea0: 00000004 3fff6fb9 3fff406c 402235f1
3fff0eb0: e8942017 874aed4c 49a9eeb3 3fff60fc
3fff0ec0: 00000000 00000004 00000004 40203877
3fff0ed0: 3fff6fbd 3fff6fb9 3fff8aa4 00000e00
3fff0ee0: 00000e98 3fff7e22 0000002e 00000004
3fff0ef0: 3fff406c 3fff6fb9 00000004 00000004
3fff0f00: 00000004 3fff6fb9 3fff406c 40222fe8
3fff0f10: 00000000 3fff6fb9 3fff406c 40223390
3fff0f20: 0000000c 3fff2424 0000000d 401004d8
3fff0f30: 3fff0f80 0000000e 00000010 00000000
3fff0f40: 3fff221c 3fff2424 3fff406c 01000000
3fff0f50: 3fff0f80 3fff61dc 3fff406c 40223140
3fff0f60: 40203658 00004ba0 3fff0190 00001387
3fff0f70: 00007dbb 3fff61dc 3fff673c 40203d19
3fff0f80: 000001bb 3fff6684 3fff61dc 402030d6
3fff0f90: 252bb46b 00000000 3fff0fd0 00000000
3fff0fa0: 000001bb 3fff61dc 3fff2424 4020406d
3fff0fb0: 3ffe93b8 252bb46b 3ffe93b8 252bb46b
3fff0fc0: 3fff1178 00000000 3fff10a0 40204880
3fff0fd0: 00000000 00000000 3fff4b04 402065fb
3fff0fe0: 00000000 00000000 3fff10a0 40204d60
3fff0ff0: 3fff4b10 00000000 3fff4af8 402067a5
3fff1000: 3ffe9210 00000000 00000000 40206f54
3fff1010: 3ffe9198 0000093e 3fff10a0 4020472f
3fff1020: 3fff105c 00000000 3fff105c 3fff00ac
3fff1030: 3fff1178 3ffeffe0 3fff10a0 40204e0e
3fff1040: 3fff1178 3ffeffe0 3fff10a0 402053ed
3fff1050: 00000000 00000000 00000000 3ffe9210
3fff1060: 00000000 00000000 000008c3 4010020c
3fff1070: 00000000 3ffeffe0 3fff111c 4010068c
3fff1080: 4021f2fe 3fff00cc 3fff1178 3fff116c
3fff1090: 3fff1184 3ffeffe0 3fff1178 402055e5
3fff10a0: 3fff652c 3fff61dc 3fff2424 0000000f
3fff10b0: 0000000c 000001bb 00011f40 3fff243c
3fff10c0: 0000000f 0000000d 3fff64bc 0000000f
3fff10d0: 00000005 3fff49fc 000000ef 000000e7
3fff10e0: 3fff64ec 0000001f 00000013 3fff6514
3fff10f0: 0000000f 00000000 3fff4af8 00000001
3fff1100: 00000000 ffffffff 3fff1100 00000000
3fff1110: 00000000 00000000 00000000 00000000
3fff1120: 00000000 00000000 3fff116c 4020667e
3fff1130: 3ffe8f70 00000064 00000064 3fff0188
3fff1140: 3ffeff84 3ffeffe0 3fff00cc 4020244f
3fff1150: 3ffe90e8 00000000 000003e8 feefeffe
3fff1160: 00000000 3fff21f4 3fff23d4 3fff6474
3fff1170: 0000003f 0000003b 3fff2264 0000000f
3fff1180: 00000000 3fff23ec 0000002f 00000021
3fff1190: 3fffdad0 00000000 3fff0180 40207150
3fff11a0: feefeffe feefeffe 3fff0190 40100718
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(1,7)

ets Jan 8 2013,rst cause:4, boot mode:(1,7)

wdt reset

=====if I power cycle then I get the following:
[SETUP] WAIT 4...
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
[SETUP] WAIT 3...
state: 3 -> 5 (10)
add 0
aid 16
cnt

connected with 2GHz, channel 6
dhcp client start...
[SETUP] WAIT 2...
ip:192.168.1.147,mask:255.255.255.0,gw:192.168.1.1
[SETUP] WAIT 1...

Waiting for wifi
WiFi connected

WiFi connected. IP address:192.168.1.147
connecting to www.aquaswift.ca
please start sntp first !
certificate matches
About to do OTA firmware update
please start sntp first !
Fatal exception 29(StoreProhibitedCause):
epc1=0x4000e1b2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000

Exception (29):
epc1=0x4000e1b2 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont
sp: 3fff0bc0 end: 3fff11b0 offset: 01a0

stack>>>
3fff0d60: 00000040 00000082 3fffaf4c 402252c9
3fff0d70: 3fff9664 3fff915c 00000000 00000041
3fff0d80: 00000040 0000003f 00000000 00000041
3fff0d90: 3fffbc04 3fff1f98 3fffaf64 3fff964c
3fff0da0: 3fffbd00 3fff40ac 3fff915c 3fff915c
3fff0db0: 00000040 3fff915c 3fffaf4c 3fff915c
3fff0dc0: 00000040 3fff915c 3fffaf4c 40225dfe
3fff0dd0: 3fff91ec 0000003f 8ae2a550 00000020
3fff0de0: 3fff245c 3fff915c 3fff9444 00000020
3fff0df0: 3fff245c 3fff915c 00000010 402260e4
3fff0e00: 3fff2404 3fff942c 3fff9444 00000001
3fff0e10: 00000001 3fff9444 3fff706c 40224ebc
3fff0e20: 00000100 3fff91bc 3fff6fbf 00000000
3fff0e30: 00000100 3fff91bc 3fff6fbf 402270e5
3fff0e40: 3fff0e70 00000000 000000d0 00000030
3fff0e50: 13cd9434 c7190000 3fff66cc 00000004
3fff0e60: 00000004 3fff3ff4 3fff6fb9 402231f0
3fff0e70: afbc0203 2314a19f 6e1fc76b 3ab5d242
3fff0e80: 5f70fb79 67032e76 f535803e a2065c98
3fff0e90: dcaa7085 9fa219f6 0b8a3c0c 943481cf
3fff0ea0: 00000004 3fff6fb9 3fff3ff4 402235f1
3fff0eb0: 00000000 600011f0 3fff66cc 3fff61a4
3fff0ec0: 00000000 00000004 00000004 40203877
3fff0ed0: 3fff6fbd 3fff6fb9 3fff8aa4 00000e00
3fff0ee0: 00000e98 3fff7e22 0000002e 00000004
3fff0ef0: 3fff3ff4 3fff6fb9 00000004 00000004
3fff0f00: 00000004 3fff6fb9 3fff3ff4 40222fe8
3fff0f10: 00000000 3fff6fb9 3fff3ff4 40223390
3fff0f20: 0000000c 3fff64f4 0000000d 401004d8
3fff0f30: 3fff0f80 0000000e 00000010 00000000
3fff0f40: 3fff221c 3fff64f4 3fff3ff4 01000000
3fff0f50: 3fff0f80 3fff6154 3fff3ff4 40223140
3fff0f60: 40203658 00002510 3fff0190 00001387
3fff0f70: 000016e9 3fff6154 3fff6174 40203d19
3fff0f80: 000001bb 3fff66cc 3fff6154 402030d6
3fff0f90: 252bb46b 00000000 3fff0fd0 00000000
3fff0fa0: 000001bb 3fff6154 3fff64f4 4020406d
3fff0fb0: 3ffe93b8 252bb46b 3ffe93b8 252bb46b
3fff0fc0: 3fff1178 00000000 3fff10a0 40204880
3fff0fd0: 00000000 00000000 3fff4b04 402065fb
3fff0fe0: 00000000 00000000 3fff10a0 40204d60
3fff0ff0: 3fff4b10 00000000 3fff4af8 402067a5
3fff1000: 3ffe9210 00000000 00000000 40206f54
3fff1010: 3ffe9198 000008c3 3fff10a0 4020472f
3fff1020: 3fff105c 00000000 3fff105c 3fff00ac
3fff1030: 3fff1178 3ffeffe0 3fff10a0 40204e0e
3fff1040: 3fff1178 3ffeffe0 3fff10a0 402053ed
3fff1050: 00000000 00000000 00000000 3ffe9210
3fff1060: 00000000 00000000 000008ce 4010020c
3fff1070: 00000000 3ffeffe0 3fff111c 4010068c
3fff1080: 4021f2fe 3fff00cc 3fff1178 3fff116c
3fff1090: 3fff1184 3ffeffe0 3fff1178 402055e5
3fff10a0: 3fff61d4 3fff6154 3fff64f4 0000000f
3fff10b0: 0000000c 000001bb 00011f40 3fff650c
3fff10c0: 0000000f 0000000d 3fff6524 0000000f
3fff10d0: 00000005 3fff49fc 000000ef 000000e7
3fff10e0: 3fff6114 0000001f 00000013 3fff613c
3fff10f0: 0000000f 00000000 3fff4af8 00000001
3fff1100: 00000000 ffffffff 3fff1100 00000000
3fff1110: 00000000 00000000 00000000 00000000
3fff1120: 00000000 00000000 3fff116c 4020667e
3fff1130: 3ffe8f70 00000064 00000064 3fff0188
3fff1140: 3ffeff84 3ffeffe0 3fff00cc 4020244f
3fff1150: 3ffe90e8 00000000 000003e8 feefeffe
3fff1160: 00000000 3fff21f4 3fff23d4 3fff64ac
3fff1170: 0000003f 0000003b 3fff2264 0000000f
3fff1180: 00000000 3fff6474 0000002f 00000021
3fff1190: 3fffdad0 00000000 3fff0180 40207150
3fff11a0: feefeffe feefeffe 3fff0190 40100718
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v09f0c112
~ld
ÿ

[SETUP] WAIT 4...
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 16
cnt

connected with 2GHz, channel 6
dhcp client start...
[SETUP] WAIT 3...
ip:192.168.1.147,mask:255.255.255.0,gw:192.168.1.1
[SETUP] WAIT 2...
[SETUP] WAIT 1...

Waiting for wifi
WiFi connected

WiFi connected. IP address:192.168.1.147
connecting to www.aquaswift.ca
please start sntp first !
certificate matches
About to do OTA firmware update
please start sntp first !
Fatal exception 29(StoreProhibitedCause):
epc1=0x4000e1b2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000

Exception (29):
epc1=0x4000e1b2 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont
sp: 3fff0bc0 end: 3fff11b0 offset: 01a0

stack>>>
3fff0d60: 00000040 00000082 3fffaf34 402252c9
3fff0d70: 3fff9664 3fff915c 00000000 00000041
3fff0d80: 00000040 0000003f 00000000 00000041
3fff0d90: 3fffbbec 3fff1f98 3fffaf4c 3fff964c
3fff0da0: 3fffbce8 3fff3ff4 3fff915c 3fff915c
3fff0db0: 00000040 3fff915c 3fffaf34 3fff915c
3fff0dc0: 00000040 3fff915c 3fffaf34 40225dfe
3fff0dd0: 3fff91ec 0000003f fe0f0e90 00000020
3fff0de0: 3fff6784 3fff915c 3fff9444 00000020
3fff0df0: 3fff6784 3fff915c 00000010 402260e4
3fff0e00: 3fff6124 3fff942c 3fff9444 00000001
3fff0e10: 00000001 3fff9444 3fff6ff4 40224ebc
3fff0e20: 00000100 3fff91bc 3fff6fbf 00000000
3fff0e30: 00000100 3fff91bc 3fff6fbf 402270e5
3fff0e40: 3fff0e70 00000000 000000d0 00000030
3fff0e50: 0eec9eb1 c7190000 3fff6684 00000004
3fff0e60: 00000004 3fff406c 3fff6fb9 402231f0
3fff0e70: 464d0203 6b895dbb 1f1c157f d477362e
3fff0e80: b62fab0b 2c9a415b 6c1be454 70a7fd75
3fff0e90: 53289207 b50792a7 d4111440 9eb1f814
3fff0ea0: 00000004 3fff6fb9 3fff406c 402235f1
3fff0eb0: 00000000 600011f0 3fff6684 3fff60fc
3fff0ec0: 00000000 00000004 00000004 40203877
3fff0ed0: 3fff6fbd 3fff6fb9 3fff8aa4 00000e00
3fff0ee0: 00000e98 3fff7e22 0000002e 00000004
3fff0ef0: 3fff406c 3fff6fb9 00000004 00000004
3fff0f00: 00000004 3fff6fb9 3fff406c 40222fe8
3fff0f10: 00000000 3fff6fb9 3fff406c 40223390
3fff0f20: 0000000c 3fff2424 0000000d 401004d8
3fff0f30: 3fff0f80 0000000e 00000010 00000000
3fff0f40: 3fff221c 3fff2424 3fff406c 01000000
3fff0f50: 3fff0f80 3fff61dc 3fff406c 40223140
3fff0f60: 40203658 00004ba0 3fff0190 00001387
3fff0f70: 0000175b 3fff61dc 3fff673c 40203d19
3fff0f80: 000001bb 3fff6684 3fff61dc 402030d6
3fff0f90: 252bb46b 00000000 3fff0fd0 00000000
3fff0fa0: 000001bb 3fff61dc 3fff2424 4020406d
3fff0fb0: 3ffe93b8 252bb46b 3ffe93b8 252bb46b
3fff0fc0: 3fff1178 00000000 3fff10a0 40204880
3fff0fd0: 00000000 00000000 3fff4b04 402065fb
3fff0fe0: 00000000 00000000 3fff10a0 40204d60
3fff0ff0: 3fff4b10 00000000 3fff4af8 402067a5
3fff1000: 3ffe9210 00000000 00000000 40206f54
3fff1010: 3ffe9198 0000093e 3fff10a0 4020472f
3fff1020: 3fff105c 00000000 3fff105c 3fff00ac
3fff1030: 3fff1178 3ffeffe0 3fff10a0 40204e0e
3fff1040: 3fff1178 3ffeffe0 3fff10a0 402053ed
3fff1050: 00000000 00000000 00000000 3ffe9210
3fff1060: 00000000 00000000 000008c3 4010020c
3fff1070: 00000000 3ffeffe0 3fff111c 4010068c
3fff1080: 4021f2fe 3fff00cc 3fff1178 3fff116c
3fff1090: 3fff1184 3ffeffe0 3fff1178 402055e5
3fff10a0: 3fff652c 3fff61dc 3fff2424 0000000f
3fff10b0: 0000000c 000001bb 00011f40 3fff243c
3fff10c0: 0000000f 0000000d 3fff64bc 0000000f
3fff10d0: 00000005 3fff49fc 000000ef 000000e7
3fff10e0: 3fff64ec 0000001f 00000013 3fff6514
3fff10f0: 0000000f 00000000 3fff4af8 00000001
3fff1100: 00000000 ffffffff 3fff1100 00000000
3fff1110: 00000000 00000000 00000000 00000000
3fff1120: 00000000 00000000 3fff116c 4020667e
3fff1130: 3ffe8f70 00000064 00000064 3fff0188
3fff1140: 3ffeff84 3ffeffe0 3fff00cc 4020244f
3fff1150: 3ffe90e8 00000000 000003e8 feefeffe
3fff1160: 00000000 3fff21f4 3fff23d4 3fff6474
3fff1170: 0000003f 0000003b 3fff2264 0000000f
3fff1180: 00000000 3fff23ec 0000002f 00000021
3fff1190: 3fffdad0 00000000 3fff0180 40207150
3fff11a0: feefeffe feefeffe 3fff0190 40100718
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v09f0c112
~ld
þ

[SETUP] WAIT 4...
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 16
cnt

connected with 2GHz, channel 6
dhcp client start...

======running flash config example gives the following output:
Flash real id: 001640E0
Flash real size: 4194304

Flash ide size: 4194304
Flash ide speed: 40000000
Flash ide mode: DIO
Flash Chip configuration ok.

=============
I've tried it with 2 different ESP8266-12E chips - both give same results
I've tried running off fully charged 6V battery thru a 1amp 3.3v regulator
and running off bench supply set to deliver 1amp at 5v thru 1amp 3.3v regulator
Same problem every time. But works fine if I use http instead of https. almost seems like there's a bug in ESP8266httpUpdate, as it works with http, but not https. Also I suspect the following is the key message in the data above:

Fatal exception 29(StoreProhibitedCause):
epc1=0x4000e1b2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000

Anybody know what the fix is?

cirdiam commented May 6, 2017

I can get OTA updates working using http, but not using https
I'm using Arduino IDE 1.6.9, ESP8266 cores 2.3.0, an ESP8266-12E

code is:
#include <Arduino.h>

#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>

#include <ESP8266HTTPClient.h>
#include <ESP8266httpUpdate.h>
#include <WiFiClientSecure.h>

#define USE_SERIAL Serial

ESP8266WiFiMulti WiFiMulti; //use this when using ESP8266WiFiMulti.h

const char* ssid = "...my ssid..";
const char* pass = "..my router password";
const char* host = "www.aquaswift.ca";
const int httpsPort = 443;
const char* fingerprint = "fe a4 1f 46 64 35 19 6a d7 5a 08 a2 9d 20 62 24 6b e9 fd ef";

void setup() {

//setup serial port
USE_SERIAL.begin(115200);
USE_SERIAL.setDebugOutput(true);

USE_SERIAL.println();
USE_SERIAL.println();
USE_SERIAL.println();

for(uint8_t t = 4; t > 0; t--) {
    USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);
    USE_SERIAL.flush();
    delay(1000);
}

//connect to wifi
WiFiMulti.addAP(ssid, pass); //use this when using ESP8266WiFiMulti.h

// wait for WiFi connection
Serial.println();    
Serial.print("Waiting for wifi");    
while (WiFiMulti.run() != WL_CONNECTED) { //use this when using ESP8266WiFiMulti.h
  Serial.print(".");
  delay(500);    
}
Serial.println();
Serial.println("WiFi connected");
Serial.println();
Serial.print("WiFi connected.  IP address:");
Serial.println(WiFi.localIP()); 

//establish a connection to remote web server
// Use WiFiClientSecure class to create TLS connection
WiFiClientSecure client;
Serial.print("connecting to ");
Serial.println(host);
if (!client.connect(host, httpsPort)) {
Serial.println("connection failed");
return;
}

if (client.verify(fingerprint, host)) {
  Serial.println("certificate matches");
} else {
  Serial.println("certificate doesn't match");
}

  if((WiFiMulti.run() == WL_CONNECTED)) { 

      //t_httpUpdate_return ret = ESPhttpUpdate.update("http://server/file.bin");
      //t_httpUpdate_return  ret = ESPhttpUpdate.update("https://server/file.bin");

      Serial.println("About to do OTA firmware update");
      delay(100);
      
      t_httpUpdate_return ret = ESPhttpUpdate.update("https://aquaswift.ca/fw/blink.bin","","fe a4 1f 46 64 35 19 6a d7 5a 08 a2 9d 20 62 24 6b e9 fd ef");

      switch(ret) {
          case HTTP_UPDATE_FAILED:
              USE_SERIAL.printf("HTTP_UPDATE_FAILD Error (%d): %s", ESPhttpUpdate.getLastError(), ESPhttpUpdate.getLastErrorString().c_str());
              break;

          case HTTP_UPDATE_NO_UPDATES:
              USE_SERIAL.println("HTTP_UPDATE_NO_UPDATES");
              break;

          case HTTP_UPDATE_OK:
              USE_SERIAL.println("HTTP_UPDATE_OK");
              break;
      }
      Serial.println("Finished attempt to do OTA firmware update");
  }

Serial.println("Doing rest of setup");
pinMode(2, OUTPUT);

}

void loop() {
digitalWrite(2, HIGH); // turn the LED on (HIGH is the voltage level)
delay(200); // wait for a second
digitalWrite(2, LOW); // turn the LED off by making the voltage LOW
delay(200); // wait for a second
}

=================================================
output on serial port after first run after download is:

[SETUP] WAIT 4...
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 16
cnt

connected with 2GHz, channel 6
dhcp client start...
[SETUP] WAIT 3...
ip:192.168.1.147,mask:255.255.255.0,gw:192.168.1.1
[SETUP] WAIT 2...
[SETUP] WAIT 1...

Waiting for wifi
WiFi connected

WiFi connected. IP address:192.168.1.147
connecting to www.aquaswift.ca
please start sntp first !
certificate matches
About to do OTA firmware update
please start sntp first !
Fatal exception 29(StoreProhibitedCause):
epc1=0x4000e1b2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000

Exception (29):
epc1=0x4000e1b2 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont
sp: 3fff0bc0 end: 3fff11b0 offset: 01a0

stack>>>
3fff0d60: 00000040 00000082 3fffaf2c 402252c9
3fff0d70: 3fff96e4 3fff91dc 00000000 00000041
3fff0d80: 00000040 0000003f 00000000 00000041
3fff0d90: 3fffbc5c 00000000 3fff8fbc 3fff96cc
3fff0da0: 3fffbd58 3fff8fd4 3fff91dc 3fff91dc
3fff0db0: 00000040 3fff91dc 3fffaf2c 3fff91dc
3fff0dc0: 00000040 3fff91dc 3fffaf2c 40225dfe
3fff0dd0: 3fff926c 0000003f 0be8633a 00000020
3fff0de0: 3fff4b14 3fff91dc 3fff94c4 00000020
3fff0df0: 3fff4b14 3fff91dc 00000010 402260e4
3fff0e00: 3fff613c 3fff94ac 3fff94c4 00000001
3fff0e10: 00000001 3fff94c4 3fff6fc1 40224ebc
3fff0e20: 00000100 3fff923c 3fff6fbf 00000000
3fff0e30: 00000100 3fff923c 3fff6fbf 402270e5
3fff0e40: 3fff0e70 00000000 000000d0 00000030
3fff0e50: 549ddb7a cd0b3f65 39fd87c3 00000004
3fff0e60: 00000004 3fff406c 3fff6fb9 402231f0
3fff0e70: 5b600203 6baea338 179e3d83 a83f3c9f
3fff0e80: f177addf 168a51ae d3e02927 84c336dd
3fff0e90: d6205a6d 9f1001f6 0461cecf db7af600
3fff0ea0: 00000004 3fff6fb9 3fff406c 402235f1
3fff0eb0: e8942017 874aed4c 49a9eeb3 3fff60fc
3fff0ec0: 00000000 00000004 00000004 40203877
3fff0ed0: 3fff6fbd 3fff6fb9 3fff8aa4 00000e00
3fff0ee0: 00000e98 3fff7e22 0000002e 00000004
3fff0ef0: 3fff406c 3fff6fb9 00000004 00000004
3fff0f00: 00000004 3fff6fb9 3fff406c 40222fe8
3fff0f10: 00000000 3fff6fb9 3fff406c 40223390
3fff0f20: 0000000c 3fff2424 0000000d 401004d8
3fff0f30: 3fff0f80 0000000e 00000010 00000000
3fff0f40: 3fff221c 3fff2424 3fff406c 01000000
3fff0f50: 3fff0f80 3fff61dc 3fff406c 40223140
3fff0f60: 40203658 00004ba0 3fff0190 00001387
3fff0f70: 00007dbb 3fff61dc 3fff673c 40203d19
3fff0f80: 000001bb 3fff6684 3fff61dc 402030d6
3fff0f90: 252bb46b 00000000 3fff0fd0 00000000
3fff0fa0: 000001bb 3fff61dc 3fff2424 4020406d
3fff0fb0: 3ffe93b8 252bb46b 3ffe93b8 252bb46b
3fff0fc0: 3fff1178 00000000 3fff10a0 40204880
3fff0fd0: 00000000 00000000 3fff4b04 402065fb
3fff0fe0: 00000000 00000000 3fff10a0 40204d60
3fff0ff0: 3fff4b10 00000000 3fff4af8 402067a5
3fff1000: 3ffe9210 00000000 00000000 40206f54
3fff1010: 3ffe9198 0000093e 3fff10a0 4020472f
3fff1020: 3fff105c 00000000 3fff105c 3fff00ac
3fff1030: 3fff1178 3ffeffe0 3fff10a0 40204e0e
3fff1040: 3fff1178 3ffeffe0 3fff10a0 402053ed
3fff1050: 00000000 00000000 00000000 3ffe9210
3fff1060: 00000000 00000000 000008c3 4010020c
3fff1070: 00000000 3ffeffe0 3fff111c 4010068c
3fff1080: 4021f2fe 3fff00cc 3fff1178 3fff116c
3fff1090: 3fff1184 3ffeffe0 3fff1178 402055e5
3fff10a0: 3fff652c 3fff61dc 3fff2424 0000000f
3fff10b0: 0000000c 000001bb 00011f40 3fff243c
3fff10c0: 0000000f 0000000d 3fff64bc 0000000f
3fff10d0: 00000005 3fff49fc 000000ef 000000e7
3fff10e0: 3fff64ec 0000001f 00000013 3fff6514
3fff10f0: 0000000f 00000000 3fff4af8 00000001
3fff1100: 00000000 ffffffff 3fff1100 00000000
3fff1110: 00000000 00000000 00000000 00000000
3fff1120: 00000000 00000000 3fff116c 4020667e
3fff1130: 3ffe8f70 00000064 00000064 3fff0188
3fff1140: 3ffeff84 3ffeffe0 3fff00cc 4020244f
3fff1150: 3ffe90e8 00000000 000003e8 feefeffe
3fff1160: 00000000 3fff21f4 3fff23d4 3fff6474
3fff1170: 0000003f 0000003b 3fff2264 0000000f
3fff1180: 00000000 3fff23ec 0000002f 00000021
3fff1190: 3fffdad0 00000000 3fff0180 40207150
3fff11a0: feefeffe feefeffe 3fff0190 40100718
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(1,7)

ets Jan 8 2013,rst cause:4, boot mode:(1,7)

wdt reset

=====if I power cycle then I get the following:
[SETUP] WAIT 4...
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
[SETUP] WAIT 3...
state: 3 -> 5 (10)
add 0
aid 16
cnt

connected with 2GHz, channel 6
dhcp client start...
[SETUP] WAIT 2...
ip:192.168.1.147,mask:255.255.255.0,gw:192.168.1.1
[SETUP] WAIT 1...

Waiting for wifi
WiFi connected

WiFi connected. IP address:192.168.1.147
connecting to www.aquaswift.ca
please start sntp first !
certificate matches
About to do OTA firmware update
please start sntp first !
Fatal exception 29(StoreProhibitedCause):
epc1=0x4000e1b2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000

Exception (29):
epc1=0x4000e1b2 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont
sp: 3fff0bc0 end: 3fff11b0 offset: 01a0

stack>>>
3fff0d60: 00000040 00000082 3fffaf4c 402252c9
3fff0d70: 3fff9664 3fff915c 00000000 00000041
3fff0d80: 00000040 0000003f 00000000 00000041
3fff0d90: 3fffbc04 3fff1f98 3fffaf64 3fff964c
3fff0da0: 3fffbd00 3fff40ac 3fff915c 3fff915c
3fff0db0: 00000040 3fff915c 3fffaf4c 3fff915c
3fff0dc0: 00000040 3fff915c 3fffaf4c 40225dfe
3fff0dd0: 3fff91ec 0000003f 8ae2a550 00000020
3fff0de0: 3fff245c 3fff915c 3fff9444 00000020
3fff0df0: 3fff245c 3fff915c 00000010 402260e4
3fff0e00: 3fff2404 3fff942c 3fff9444 00000001
3fff0e10: 00000001 3fff9444 3fff706c 40224ebc
3fff0e20: 00000100 3fff91bc 3fff6fbf 00000000
3fff0e30: 00000100 3fff91bc 3fff6fbf 402270e5
3fff0e40: 3fff0e70 00000000 000000d0 00000030
3fff0e50: 13cd9434 c7190000 3fff66cc 00000004
3fff0e60: 00000004 3fff3ff4 3fff6fb9 402231f0
3fff0e70: afbc0203 2314a19f 6e1fc76b 3ab5d242
3fff0e80: 5f70fb79 67032e76 f535803e a2065c98
3fff0e90: dcaa7085 9fa219f6 0b8a3c0c 943481cf
3fff0ea0: 00000004 3fff6fb9 3fff3ff4 402235f1
3fff0eb0: 00000000 600011f0 3fff66cc 3fff61a4
3fff0ec0: 00000000 00000004 00000004 40203877
3fff0ed0: 3fff6fbd 3fff6fb9 3fff8aa4 00000e00
3fff0ee0: 00000e98 3fff7e22 0000002e 00000004
3fff0ef0: 3fff3ff4 3fff6fb9 00000004 00000004
3fff0f00: 00000004 3fff6fb9 3fff3ff4 40222fe8
3fff0f10: 00000000 3fff6fb9 3fff3ff4 40223390
3fff0f20: 0000000c 3fff64f4 0000000d 401004d8
3fff0f30: 3fff0f80 0000000e 00000010 00000000
3fff0f40: 3fff221c 3fff64f4 3fff3ff4 01000000
3fff0f50: 3fff0f80 3fff6154 3fff3ff4 40223140
3fff0f60: 40203658 00002510 3fff0190 00001387
3fff0f70: 000016e9 3fff6154 3fff6174 40203d19
3fff0f80: 000001bb 3fff66cc 3fff6154 402030d6
3fff0f90: 252bb46b 00000000 3fff0fd0 00000000
3fff0fa0: 000001bb 3fff6154 3fff64f4 4020406d
3fff0fb0: 3ffe93b8 252bb46b 3ffe93b8 252bb46b
3fff0fc0: 3fff1178 00000000 3fff10a0 40204880
3fff0fd0: 00000000 00000000 3fff4b04 402065fb
3fff0fe0: 00000000 00000000 3fff10a0 40204d60
3fff0ff0: 3fff4b10 00000000 3fff4af8 402067a5
3fff1000: 3ffe9210 00000000 00000000 40206f54
3fff1010: 3ffe9198 000008c3 3fff10a0 4020472f
3fff1020: 3fff105c 00000000 3fff105c 3fff00ac
3fff1030: 3fff1178 3ffeffe0 3fff10a0 40204e0e
3fff1040: 3fff1178 3ffeffe0 3fff10a0 402053ed
3fff1050: 00000000 00000000 00000000 3ffe9210
3fff1060: 00000000 00000000 000008ce 4010020c
3fff1070: 00000000 3ffeffe0 3fff111c 4010068c
3fff1080: 4021f2fe 3fff00cc 3fff1178 3fff116c
3fff1090: 3fff1184 3ffeffe0 3fff1178 402055e5
3fff10a0: 3fff61d4 3fff6154 3fff64f4 0000000f
3fff10b0: 0000000c 000001bb 00011f40 3fff650c
3fff10c0: 0000000f 0000000d 3fff6524 0000000f
3fff10d0: 00000005 3fff49fc 000000ef 000000e7
3fff10e0: 3fff6114 0000001f 00000013 3fff613c
3fff10f0: 0000000f 00000000 3fff4af8 00000001
3fff1100: 00000000 ffffffff 3fff1100 00000000
3fff1110: 00000000 00000000 00000000 00000000
3fff1120: 00000000 00000000 3fff116c 4020667e
3fff1130: 3ffe8f70 00000064 00000064 3fff0188
3fff1140: 3ffeff84 3ffeffe0 3fff00cc 4020244f
3fff1150: 3ffe90e8 00000000 000003e8 feefeffe
3fff1160: 00000000 3fff21f4 3fff23d4 3fff64ac
3fff1170: 0000003f 0000003b 3fff2264 0000000f
3fff1180: 00000000 3fff6474 0000002f 00000021
3fff1190: 3fffdad0 00000000 3fff0180 40207150
3fff11a0: feefeffe feefeffe 3fff0190 40100718
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v09f0c112
~ld
ÿ

[SETUP] WAIT 4...
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 16
cnt

connected with 2GHz, channel 6
dhcp client start...
[SETUP] WAIT 3...
ip:192.168.1.147,mask:255.255.255.0,gw:192.168.1.1
[SETUP] WAIT 2...
[SETUP] WAIT 1...

Waiting for wifi
WiFi connected

WiFi connected. IP address:192.168.1.147
connecting to www.aquaswift.ca
please start sntp first !
certificate matches
About to do OTA firmware update
please start sntp first !
Fatal exception 29(StoreProhibitedCause):
epc1=0x4000e1b2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000

Exception (29):
epc1=0x4000e1b2 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont
sp: 3fff0bc0 end: 3fff11b0 offset: 01a0

stack>>>
3fff0d60: 00000040 00000082 3fffaf34 402252c9
3fff0d70: 3fff9664 3fff915c 00000000 00000041
3fff0d80: 00000040 0000003f 00000000 00000041
3fff0d90: 3fffbbec 3fff1f98 3fffaf4c 3fff964c
3fff0da0: 3fffbce8 3fff3ff4 3fff915c 3fff915c
3fff0db0: 00000040 3fff915c 3fffaf34 3fff915c
3fff0dc0: 00000040 3fff915c 3fffaf34 40225dfe
3fff0dd0: 3fff91ec 0000003f fe0f0e90 00000020
3fff0de0: 3fff6784 3fff915c 3fff9444 00000020
3fff0df0: 3fff6784 3fff915c 00000010 402260e4
3fff0e00: 3fff6124 3fff942c 3fff9444 00000001
3fff0e10: 00000001 3fff9444 3fff6ff4 40224ebc
3fff0e20: 00000100 3fff91bc 3fff6fbf 00000000
3fff0e30: 00000100 3fff91bc 3fff6fbf 402270e5
3fff0e40: 3fff0e70 00000000 000000d0 00000030
3fff0e50: 0eec9eb1 c7190000 3fff6684 00000004
3fff0e60: 00000004 3fff406c 3fff6fb9 402231f0
3fff0e70: 464d0203 6b895dbb 1f1c157f d477362e
3fff0e80: b62fab0b 2c9a415b 6c1be454 70a7fd75
3fff0e90: 53289207 b50792a7 d4111440 9eb1f814
3fff0ea0: 00000004 3fff6fb9 3fff406c 402235f1
3fff0eb0: 00000000 600011f0 3fff6684 3fff60fc
3fff0ec0: 00000000 00000004 00000004 40203877
3fff0ed0: 3fff6fbd 3fff6fb9 3fff8aa4 00000e00
3fff0ee0: 00000e98 3fff7e22 0000002e 00000004
3fff0ef0: 3fff406c 3fff6fb9 00000004 00000004
3fff0f00: 00000004 3fff6fb9 3fff406c 40222fe8
3fff0f10: 00000000 3fff6fb9 3fff406c 40223390
3fff0f20: 0000000c 3fff2424 0000000d 401004d8
3fff0f30: 3fff0f80 0000000e 00000010 00000000
3fff0f40: 3fff221c 3fff2424 3fff406c 01000000
3fff0f50: 3fff0f80 3fff61dc 3fff406c 40223140
3fff0f60: 40203658 00004ba0 3fff0190 00001387
3fff0f70: 0000175b 3fff61dc 3fff673c 40203d19
3fff0f80: 000001bb 3fff6684 3fff61dc 402030d6
3fff0f90: 252bb46b 00000000 3fff0fd0 00000000
3fff0fa0: 000001bb 3fff61dc 3fff2424 4020406d
3fff0fb0: 3ffe93b8 252bb46b 3ffe93b8 252bb46b
3fff0fc0: 3fff1178 00000000 3fff10a0 40204880
3fff0fd0: 00000000 00000000 3fff4b04 402065fb
3fff0fe0: 00000000 00000000 3fff10a0 40204d60
3fff0ff0: 3fff4b10 00000000 3fff4af8 402067a5
3fff1000: 3ffe9210 00000000 00000000 40206f54
3fff1010: 3ffe9198 0000093e 3fff10a0 4020472f
3fff1020: 3fff105c 00000000 3fff105c 3fff00ac
3fff1030: 3fff1178 3ffeffe0 3fff10a0 40204e0e
3fff1040: 3fff1178 3ffeffe0 3fff10a0 402053ed
3fff1050: 00000000 00000000 00000000 3ffe9210
3fff1060: 00000000 00000000 000008c3 4010020c
3fff1070: 00000000 3ffeffe0 3fff111c 4010068c
3fff1080: 4021f2fe 3fff00cc 3fff1178 3fff116c
3fff1090: 3fff1184 3ffeffe0 3fff1178 402055e5
3fff10a0: 3fff652c 3fff61dc 3fff2424 0000000f
3fff10b0: 0000000c 000001bb 00011f40 3fff243c
3fff10c0: 0000000f 0000000d 3fff64bc 0000000f
3fff10d0: 00000005 3fff49fc 000000ef 000000e7
3fff10e0: 3fff64ec 0000001f 00000013 3fff6514
3fff10f0: 0000000f 00000000 3fff4af8 00000001
3fff1100: 00000000 ffffffff 3fff1100 00000000
3fff1110: 00000000 00000000 00000000 00000000
3fff1120: 00000000 00000000 3fff116c 4020667e
3fff1130: 3ffe8f70 00000064 00000064 3fff0188
3fff1140: 3ffeff84 3ffeffe0 3fff00cc 4020244f
3fff1150: 3ffe90e8 00000000 000003e8 feefeffe
3fff1160: 00000000 3fff21f4 3fff23d4 3fff6474
3fff1170: 0000003f 0000003b 3fff2264 0000000f
3fff1180: 00000000 3fff23ec 0000002f 00000021
3fff1190: 3fffdad0 00000000 3fff0180 40207150
3fff11a0: feefeffe feefeffe 3fff0190 40100718
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v09f0c112
~ld
þ

[SETUP] WAIT 4...
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 16
cnt

connected with 2GHz, channel 6
dhcp client start...

======running flash config example gives the following output:
Flash real id: 001640E0
Flash real size: 4194304

Flash ide size: 4194304
Flash ide speed: 40000000
Flash ide mode: DIO
Flash Chip configuration ok.

=============
I've tried it with 2 different ESP8266-12E chips - both give same results
I've tried running off fully charged 6V battery thru a 1amp 3.3v regulator
and running off bench supply set to deliver 1amp at 5v thru 1amp 3.3v regulator
Same problem every time. But works fine if I use http instead of https. almost seems like there's a bug in ESP8266httpUpdate, as it works with http, but not https. Also I suspect the following is the key message in the data above:

Fatal exception 29(StoreProhibitedCause):
epc1=0x4000e1b2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000

Anybody know what the fix is?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment