Skip to content

Exception (29) HTTPS-Request; Reopened with Exception (28) #1708

Closed
@ghost

Description

Basic Infos

Hardware

Hardware: ESP-12
Core Version: 2.1.0

Description

Problem description

The sketch does every second a HTTPS-Request. Randomly an exception (29) occures. After this the sketch stops.

Settings in IDE

Module: Generic ESP8266 Module
Flash Size: 4MB
CPU Frequency: 80Mhz?
Flash Mode: DIO
Flash Frequency: 40Mhz
Upload Using: SERIAL
Reset Method: ck

Sketch

#include <ESP8266WiFi.h>
#include <ESP8266WiFiAP.h>
#include <ESP8266WiFiGeneric.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266WiFiScan.h>
#include <ESP8266WiFiSTA.h>
#include <ESP8266WiFiType.h>
#include <WiFiClient.h>
#include <WiFiClientSecure.h>
#include <WiFiServer.h>
#include <WiFiUdp.h>

IPAddress ip(myIPAddress xx.xx.xx.xx);   

//WiFiClientSecure client;

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

unsigned long ulMessTime;

IPAddress   host(149,154,167,198);
const int httpsPort = 443;

int restart = 0;


void setup() {
  ulMessTime=millis();
  restart = 0;
  Serial.begin(115200);
  Serial.println();
  Serial.print("connecting to ");
  Serial.println(ssid);
  WiFi.config(ip, dns, gateway, subnet);
  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());

  configTime(3 * 3600, 0, "pool.ntp.org", "time.nist.gov");
}

void loop() {

  if ((millis()- ulMessTime) >= 1000)
  {
    ulMessTime=millis();

    // Use WiFiClientSecure class to create TLS connection

    Serial.println(String(millis()-ulMessTime));

    WiFiClientSecure client;
    client.setTimeout(100);
    Serial.print("connecting to ");
    Serial.println(host);
    int connres=client.connect(host, httpsPort);
    Serial.println(connres);

    if (!connres) {
      Serial.println("connection failed");
      return;
    }

    String url;
    if (restart!=0)
    {
      url = "/botMyTelegramBot/getUpdates?offset=0&limit=1";
    }
    else
    {
      url = "/botMyTelegramBot/sendMessage?chat_id=35549815&text=Restart&reply_markup=";
      restart=1;
    }

    Serial.print("requesting URL: ");
    Serial.println(url);

    client.print(String("GET ") + url + " HTTP/1.1\r\n" +
                 "Host: " + host + "\r\n" +
                 "User-Agent: BuildFailureDetectorESP8266\r\n" +
                 "Connection: close\r\n\r\n");

    Serial.println("request sent");
    while (client.connected()) {
      String line = client.readStringUntil('\n');
      Serial.println(line);
      if (line == "\r") {
        Serial.println("headers received");
        break;
      }
    }
//    String line = client.readStringUntil('\n');
    String line = client.readString();
    Serial.println("reply was:");
    Serial.println("==========");
    Serial.println(line);
    Serial.println("==========");
    Serial.println("closing connection");

    Serial.println(String(millis()-ulMessTime));

  }

}

Debug Messages

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

ctx: cont 
sp: 3fff14b0 end: 3fff17f0 offset: 01a0

>>>stack>>>
3fff1650:  3ffe9010 00000035 00000005 00000001  
3fff1660:  4020375a 3fff15a1 3fff062c 00000030  
3fff1670:  00000000 00000005 00000000 000a0017  
3fff1680:  ffffffff 3fffc6fc 00000001 3fff062c  
3fff1690:  00000000 3fff1720 00000005 40203c06  
3fff16a0:  3ffe8db0 3fff1720 3fff247c 40229fe3  
3fff16b0:  3fff16d0 00000000 00000000 3fff1640  
3fff16c0:  00004400 0000002a 00000a69 4022619d  
3fff16d0:  000a0017 3fff16f0 3fff07d0 3fff21dc  
3fff16e0:  0000000a 3fff062c 40203fa4 3fff062c  
3fff16f0:  0000000a 3fff21dc 3fff247c 4022a3c9  
3fff1700:  00000005 00000001 3fff178c 40204060  
3fff1710:  3ffe9d98 3fff21dc 3fff21dc 402038d7  
3fff1720:  0000000a 3fff062c 40203fa4 3fff07d0  
3fff1730:  0000000a 3fff1770 3fff21dc 402039a5  
3fff1740:  3ffe9d98 3ffe8db0 3fff1770 40205903  
3fff1750:  3ffe8d88 3fff0628 3fff178c 40205d02  
3fff1760:  3fff0634 3ffe8db0 3fff1834 40202846  
3fff1770:  3ffe91d0 00000000 00000064 0001b553  
3fff1780:  00000000 3fff238c 3fff21dc 3fff21fc  
3fff1790:  0000000f 00000000 00000000 00000000  
3fff17a0:  00000000 3fff7bfc 0000004f 0000004d  
3fff17b0:  00000001 5b7aa8c0 feefeffe feefeffe  
3fff17c0:  00000000 00000000 00000001 3fff07c4  
3fff17d0:  3fffdad0 00000000 3fff07bc 40203ff0  
3fff17e0:  feefeffe feefeffe 3fff07d0 40100958  
<<<stack<<<

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


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

wdt reset

Decoded stack:
9clee6ce 2

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions