Please bear with me, I'm completely new in this ESP32 world.
I'm trying to make a very simple HTTP request from my ESP32 towards a webserver is running on a Raspberry Pi running Win 10 IOT, I have been banging my head for several hours and days trying to solve my problem below.
In most cases the code succeeds getting a response as expected, but when I call http.end() it crashes, sometimes with Guru Meditation Error: Core 1 panic'ed (InstrFetchProhibited), other times with (LoadProhibited).
If I instead use any other URLs instead of my own webserver, everything works fine.
When I test the URL of my Raspberry PI webserver with a normal internet browser on my PC, everything works fine too.
The http header is set to following:
HTTP/1.1 200 OK
Centent-Length: 148 (the length seems to be correct)
Connection: Close
I have added some Serial.println to see exactly where it crashes, and it is always when calling http.end();
Code and serial monitor logs are added below.
I tried to install and use ESP Exception Decoder, but couldn't get it to decode the stacktrace.
Any help is greatly appreciated.
Code: Select all
#include <WiFi.h>
#include <HTTPClient.h>
const char* ssid = "MySSD";
const char* password = "MyPassword";
void setup(void)
{
Serial.begin(9600);
delay(4000);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Waiting for Wifi");
}
Serial.println("Wifi connected");
delay(1000);
}
void loop()
{
if ((WiFi.status() == WL_CONNECTED)) //Check the current connection status
{
HTTPClient http;;
http.begin("http://192.168.0.105:485/esp32.html");
int httpCode = http.GET();
Serial.print("httpCode: ");
Serial.println(httpCode);
if (httpCode > 0) //Check for the returning code
{
String payload = http.getString();
Serial.print("Payload: ");
Serial.println(payload);
}
else
{
Serial.println("Error on HTTP request");
}
Serial.println("Trace just before http.end()");
http.end(); //Free the resources
Serial.println("Trace just after http.end()");
}
delay(1000);
}
Code: Select all
Waiting for Wifi
18:46:51.684 -> Wifi connected
18:46:53.935 -> httpCode: 200
18:46:53.935 -> Payload: <!doctype html><html lang="en"><head><meta charset="utf-8"><title>Esp32</title></head><body><p>2020-01-20 18:46:53;22.94;5.56;2.3;</p></body></html>
18:46:54.122 -> Trace just before http.end()
18:46:54.169 -> Guru Meditation Error: Core 1 panic'ed (InstrFetchProhibited). Exception was unhandled.
18:46:54.263 -> Core 1 register dump:
18:46:54.263 -> PC : 0xf4000000 PS : 0x00060430 A0 : 0x800d2d72 A1 : 0x3ffb1ea0
18:46:54.357 -> A2 : 0x3ffb1f10 A3 : 0xf4000000 A4 : 0x0000001c A5 : 0x0000ff00
18:46:54.450 -> A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x8015be96 A9 : 0x3ffb1e80
18:46:54.544 -> A10 : 0x3ffba8bc A11 : 0x3f4014a4 A12 : 0x00000002 A13 : 0x0000ff00
18:46:54.638 -> A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x0000000a EXCCAUSE: 0x00000014
18:46:54.732 -> EXCVADDR: 0xf4000000 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xffffffff
18:46:54.825 ->
18:46:54.825 -> Backtrace: 0x74000000:0x3ffb1ea0 0x400d2d6f:0x3ffb1ec0 0x400d2de1:0x3ffb1ee0 0x400d184a:0x3ffb1f00 0x400d5d49:0x3ffb1fb0 0x40088b9d:0x3ffb1fd0
18:46:54.966 ->
18:46:54.966 -> Rebooting...
18:46:55.013 ->
18:47:03.671 -> Rebooting...
18:47:03.718 -> ⸮Mʠ⸮⸮_⸮Ƃ(⸮De⸮⸮⸮`⸮Waiting for Wifi
18:47:09.100 -> Wifi connected
18:47:11.350 -> httpCode: 200
18:47:11.350 -> Payload: <!doctype html><html lang="en"><head><meta charset="utf-8"><title>Esp32</title></head><body><p>2020-01-20 18:47:10;22.94;5.56;2.3;</p></body></html>
18:47:11.537 -> Trace just before http.end()
18:47:11.584 -> Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
18:47:11.631 -> Core 1 register dump:
18:47:11.678 -> PC : 0x4015be90 PS : 0x00060430 A0 : 0x800d2d72 A1 : 0x3ffb1ea0
18:47:11.772 -> A2 : 0x3ffb1f10 A3 : 0x00000000 A4 : 0x0000001c A5 : 0x0000ff00
18:47:11.865 -> A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x800d4b65 A9 : 0x3ffb1e80
18:47:11.959 -> A10 : 0x3ffba750 A11 : 0x3f4014a4 A12 : 0x00000002 A13 : 0x0000ff00
18:47:12.053 -> A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x0000000a EXCCAUSE: 0x0000001c
18:47:12.147 -> EXCVADDR: 0x00000010 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xffffffff
18:47:12.241 ->
18:47:12.241 -> Backtrace: 0x4015be90:0x3ffb1ea0 0x400d2d6f:0x3ffb1ec0 0x400d2de1:0x3ffb1ee0 0x400d184a:0x3ffb1f00 0x400d5d49:0x3ffb1fb0 0x40088b9d:0x3ffb1fd0
18:47:12.381 ->
18:47:12.381 -> Rebooting...
18:47:12.428 ->