Wi-Fi Connectivity: Guru Meditation Error: Core 1 panic'ed (LoadProhibited)

Hi, all! I'm trying to connect an ESP32 board to a WPA2 Wi-Fi network so that I can continually send temperature and humidity data to an InitialState Server using a DHT22 Sensor. It compiles and uploads without error. However, I get a "Guru Meditation Error" in the Serial Monitor, shown here, that continuously repeats itself as the ESP32 reboots:

rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10124
load:0x40080400,len:5856
entry 0x400806a8
ESP32 Device
Initializing...

WiFi

Connecting to eduroam
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x400d836b PS : 0x00060330 A0 : 0x800d9122 A1 : 0x3ffb1f20
A2 : 0x3ffc19ec A3 : 0x3ffbdcd4 A4 : 0x0000000d A5 : 0x3ffb8488
A6 : 0x00000021 A7 : 0x57002140 A8 : 0x00000000 A9 : 0x3ffb1f10
A10 : 0x00000000 A11 : 0x00000001 A12 : 0x00000000 A13 : 0x0000000d
A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x00000008 EXCCAUSE: 0x0000001c
EXCVADDR: 0x0000003c LBEG : 0x4000c349 LEND : 0x4000c36b LCOUNT : 0xffffffff

ELF file SHA256: 0000000000000000

Backtrace: 0x400d836b:0x3ffb1f20 0x400d911f:0x3ffb1f40 0x400d0c2c:0x3ffb1f70 0x400d616e:0x3ffb1fb0 0x400898a6:0x3ffb1fd0

Rebooting...
ets Jun 8 2016 00:22:57

The code I'm using is as follows:

#include <WiFi.h>
#include <HTTPClient.h>
#include "esp_wpa2.h"
#include "DHT.h"

#define DHTPIN 4     // Digital pin connected to the DHT sensor
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);

//-------- User Settings -----------
const char* ssid = "eduroam";
#define EAP_ID "ID"
#define EAP_USERNAME "USERNAME"
#define EAP_PASSWORD "PASSWORD"
const char* accesskey = "insert access key here";
const char* accesskey2 = "same";
const char* bucketkey = "insert bucket key here";
const char* bucketkey2 = "same";
const char* signalname = "temperature";
const char* signalname2 = "humidity";
//----------------------------------

HTTPClient ask;
int counter = 0;  
static bool hasWifi = false;

//////////////
// Network //
////////////

static void InitWifi()
{
Serial.println();
    Serial.print("Connecting to ");
    Serial.println(ssid);
    
    // WPA2 enterprise magic starts here
    WiFi.disconnect(true);  
    //wifi_auth_mode_t(WIFI_AUTH_WPA2_ENTERPRISE);
    esp_wpa2_config_t config = WPA2_CONFIG_INIT_DEFAULT();
    esp_wifi_sta_wpa2_ent_set_identity((uint8_t *)EAP_ID, strlen(EAP_ID));
    esp_wifi_sta_wpa2_ent_set_username((uint8_t *)EAP_USERNAME, strlen(EAP_USERNAME));
    esp_wifi_sta_wpa2_ent_set_password((uint8_t *)EAP_PASSWORD, strlen(EAP_PASSWORD));
    esp_wifi_sta_wpa2_ent_enable(&config);
    // WPA2 enterprise magic ends here

    WiFi.begin(ssid);

    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
    }
    hasWifi = true;
    Serial.println("");
    Serial.println("WiFi connected");
    Serial.println("IP address: ");
    Serial.println(WiFi.localIP());
  }
  hasWifi = true;
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

void setup()
{
  Serial.begin(115200);
  Serial.println("ESP32 Device");
  Serial.println("Initializing...");
  
  dht.begin();

  // Initialize the WiFi module
  Serial.println(" > WiFi");
  hasWifi = false;
  InitWifi();
  if (!hasWifi)
  {
    return;
  }
}

//////////////
//Send Data//
////////////

void loop(){
  if (WiFi.status() == WL_CONNECTED) { //if we are connected
    counter = 0; //reset counter
    Serial.println("Wifi is still connected with IP: "); 
    Serial.println(WiFi.localIP());   //inform user about his IP address
  }else if (WiFi.status() != WL_CONNECTED) { //if we lost connection, retry
    WiFi.begin(ssid);      
  }
  while (WiFi.status() != WL_CONNECTED) { //during lost connection, print dots
    delay(500);
    Serial.print(".");
    counter++;
    if(counter>=60){ //30 seconds timeout - reset board
    ESP.restart();
    }
  }

  // Reading temperature or humidity
  float t = dht.readTemperature(true);
  // Create a URL for the request
  String url2 = "https://groker.init.st/api/events?accessKey=";
  url2 += accesskey;
  url2 += "&bucketKey=";
  url2 += bucketkey;
  url2 += "&";
  url2 += signalname;
  url2 += "=";
  url2 += t;

  Serial.print("*** requesting URL");
 
  // ask.begin;
  ask.begin(url2); //Specify the URL
  
  //Check for the returning code
  int httpCode = ask.GET();       

  Serial.print(httpCode);

  float h = dht.readHumidity(true); 
  String url = "https://groker.init.st/api/events?accessKey=";
  url += accesskey2;
  url += "&bucketKey=";
  url += bucketkey2;
  url += "&";
  url += signalname2;
  url += "=";
  url += h;

  Serial.print("*** requesting URL");
 
  // ask.begin;
  ask.begin(url); //Specify the URL
  
  //Check for the returning code
  int httpCode2 = ask.GET();       

  Serial.print(httpCode2);
  if (httpCode2 > 0) { 
      String payload2 = ask.getString();
  } else {
      Serial.println("Error on HTTP request");
  }
  ask.end(); //End 
  Serial.println("*** End ");
  delay(10000);    // delay
}

Are there any glaring errors in my code? Does anyone know how to fix this?
Thanks so much for your help, in advance. I'm new to all of this stuff.

Edit your post and insert code tags!

The shown output most probably isn't from the provided code. Post the complete output from exactly the code you posted!

Sorry about that! I didn't know how to use the code tags, but I fixed it. The output from the Serial Monitor is updated as well.

But it's still not the output from that code. The code doesn't compile. I have no problem if you change your WiFi params before posting the code but the code should compile and create the output that you show as the output.

Are you using a different program to compile it, like Xcode or Visual Studio or something? When I click "Verify" in Arduino IDE, it compiles, says "Done Compiling," and the only output I see is this:

Sketch uses 941186 bytes (71%) of program storage space. Maximum is 1310720 bytes.
Global variables use 39272 bytes (11%) of dynamic memory, leaving 288408 bytes for local variables. Maximum is 327680 bytes.

Maybe it doesn't compile on your end because of the personal data I left out? Again, sorry if I'm being a total noob. I just couldn't find any relevant help with this specific Guru Meditation Error online.

No, I simply use the Arduino IDE.

I don't even have to compile the program to see the error. But if I do, I get:

sketch_may27a:34:20: error: 'password' was not declared in this scope

You may change any personal information (as passwords) but simply removing the line introduces an error that doesn't let the sketch compile.

And again: the program seems to be changed in some other details. In the output you have:

but looking at the code I would expect

Connecting...

Such details may be important to understand what your device is doing and where it stops.

Sorry, I realized I had made a mistake in my post above by forgetting to copy over a specific block of code. The new edit should finally be representative of my code, minus the personal information I have left out (username, password, ID).

That means your WPA2 Enterprise code does not work. I have no experience with WPA2 Enterprise on ESPs so it may be not really stable code in the main library. Do you actually have WPA2 Enterprise (not the same as WPA2!) on your WiFi network? Have you tried the code on a standard WiFi network?

Oh, it is a WPA2-Enterprise network. The code works exactly as it should on a standard wi-fi network (tested with my phone's hotspot). The lab I work in only has WPA2-Enterprise network connectivity options: My university's network and the usual Eduroam that all universities have.

For any reason that part doesn't seem to work. I would remove the rest of the code and make a minimal sketch that shows the problem and ask the same question on an ESP forum.

I hope you kept your ESP Arduino core up-to-date...

Thanks for your help, pylon. I just uploaded the question to an ESP forum.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.