ESP8266 WiFiClientSecure Exception 9

0

I have a few problems trying to connect my ESP8266 to my WebServer. I want to connect to a Webserver and then send Information via the REST-API to the Server.

Unfortually my Program Crashes when connecting to the Server.

This is my code:

#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>

#ifndef STASSID
#define STASSID "SSID" //SSID
#define STAPSK  NULL //Password
#endif

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

const char* host = "IP-Adress"; //Load Balancer IP
const uint16_t httpsPort = 443; //Load Balancer Port

// Use web browser to view and copy SHA1 fingerprint of the certificate
const char fingerprint[] PROGMEM = "FI NG ER PR IN T0";

void setup() {
  Serial.begin(115200);
  
  Serial.println("[INFO]\t\tStarting GPS Service");
  Serial.printf("[INFO] LAN:\tConnecting to WiFi '%s'", ssid);
  
  WiFi.mode(WIFI_STA); //Setting WiFi Client Mode
  WiFi.begin(ssid, password); //Connecting to WiFi
  
  while (WiFi.status() != WL_CONNECTED) {
    delay(250);  Serial.print("."); //Waiting for WiFi Connection
  }
  Serial.print("\n");
  
  Serial.printf("[INFO] LAN:\tSuccessfully Connected to WiFi '%s'\n", ssid);
  Serial.print("[INFO] LAN:\tLocal IP-Address '");
  Serial.print(WiFi.localIP());
  Serial.print("'\n");
  
  Serial.printf("[INFO] WAN:\tConnecting to %s:%d\n" ,host, httpsPort);
  
  WiFiClientSecure client; // Use WiFiClientSecure class to create TLS connection

  Serial.printf("[INFO] WAN:\tUsing fingerprint '%s'\n", fingerprint);
  
  client.setFingerprint(fingerprint); //Set Fingerprint for WiFiClientSecure

  if (client.connect(host, httpsPort)) { //Here my Programm is Crashing
    Serial.printf("[INFO] WAN:\tSuccessfully Connected to WAN-IP '%s'\n", host);  
  } else {
    Serial.println("[ERROR] WAN:\tConnection failed!");
    return;
  }
  Serial.println("[INFO] WAN:\tClosing connection");
}

void loop() {
}

The Programm Crashes at this Point if (client.connect(host, httpsPort)) {

This is the Output:

[INFO] Starting GPS Service
[INFO] LAN: Connecting to WiFi 'SSID'.
[INFO] LAN: Successfully Connected to WiFi 'SSID'
[INFO] LAN: Local IP address '192.168.178.*'
[INFO] WAN: Connecting to Server-Adress
[INFO] WAN: Using fingerprint 'FI NG ER PR IN T0'

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Exception (9):
epc1=0x40207874 epc2=0x00000000 epc3=0x00000000 excvaddr=0xfeefeffe depc=0x00000000

>>>stack>>>
...
<<<stack<<<

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

When I decode the Stack i get the Following:

Decoding 12 results
0x40203aab: BearSSL::WiFiClientSecure::_connectSSL(char const*) at C:\Users\Username\Desktop\ArduinoPortable\App\arduino\portable\packages\esp8266\hardware\esp8266\2.7.3\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.cpp line 1093
0x40205878: esp_yield at C:\Users\Username\Desktop\ArduinoPortable\App\arduino\portable\packages\esp8266\hardware\esp8266\2.7.3\cores\esp8266/core_esp8266_main.cpp line 119
0x40205e72: __delay at C:\Users\Username\Desktop\ArduinoPortable\App\arduino\portable\packages\esp8266\hardware\esp8266\2.7.3\cores\esp8266/core_esp8266_wiring.cpp line 54
0x402026c0: WiFiClient::connect(IPAddress, unsigned short) at C:\Users\Username\Desktop\ArduinoPortable\App\arduino\portable\packages\esp8266\hardware\esp8266\2.7.3\libraries\ESP8266WiFi\src/include/ClientContext.h line 144
: (inlined by) WiFiClient::connect(IPAddress, unsigned short) at C:\Users\Username\Desktop\ArduinoPortable\App\arduino\portable\packages\esp8266\hardware\esp8266\2.7.3\libraries\ESP8266WiFi\src/WiFiClient.cpp line 170
0x40203c81: BearSSL::WiFiClientSecure::connect(char const*, unsigned short) at C:\Users\Username\Desktop\ArduinoPortable\App\arduino\portable\packages\esp8266\hardware\esp8266\2.7.3\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.cpp line 229
0x40207e20: precache at ?? line ?
0x40207e20: precache at ?? line ?
0x40250e56: sleep_reset_analog_rtcreg_8266 at ?? line ?
0x40201138: setup at C:\Users\Username\Desktop\Beispiele\WiFi/WiFi.ino line 58
0x40207cc0: precache at ?? line ?
0x40205988: loop_wrapper() at C:\Users\Username\Desktop\ArduinoPortable\App\arduino\portable\packages\esp8266\hardware\esp8266\2.7.3\cores\esp8266/core_esp8266_main.cpp line 194
0x40100bd5: cont_wrapper at C:\Users\Username\Desktop\ArduinoPortable\App\arduino\portable\packages\esp8266\hardware\esp8266\2.7.3\cores\esp8266/cont.S line 81 

Anyone got an Idea how to fix this? Thanks in advance, Patrick

c++
wifi
esp8266
arduino-esp8266
esp8266wifi
asked on Stack Overflow Jan 28, 2021 by Patrick Langkau

1 Answer

0

I was able to fix this Problem, a full reinstalled of the Arduino Portable IDE worked for me.

answered on Stack Overflow Feb 4, 2021 by Patrick Langkau

User contributions licensed under CC BY-SA 3.0