Guru Meditation Error: Core 0 panic'ed (IntegerDivideByZero). Exception was unhandled

Hi, I am doing a final year project which is a weather station Web with DHT22 sensor for temperature and humidity and pressure with BMP180 sensor all on the Huzzah ESP32 I need help because when a client connects to the server the monitor shows this error and the ESP32 restarts:

Guru Meditation Error: Core 1 panic'ed (IntegerDivideByZero). Exception was unhandled.
Core 1 register dump:
PC : 0x40147ec1 PS : 0x00060830 A0 : 0x800d1430 A1 : 0x3ffcf740
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x00000002 A5 : 0x0000ff00
A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x00000000 A9 : 0x3ffcf720
A10 : 0x00ffffff A11 : 0x000000f8 A12 : 0x3ffc18b0 A13 : 0x0000ff00
A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x00000005 EXCCAUSE: 0x00000006
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000

ELF file SHA256: 0000000000000000

Backtrace: 0x40147ec1:0x3ffcf740 0x400d142d:0x3ffcf760 0x400d0c7a:0x3ffcf780 0x400d0d03:0x3ffcf7b0 0x40147d4d:0x3ffcf7d0 0x400d6858:0x3ffcf7f0 0x400d6ae1:0x3ffcf880 0x400d56fa:0x3ffcf8d0 0x400d423a:0x3ffcf910 0x400d4c41:0x3ffcf950 0x400d0a4f:0x3ffcf990 0x400d6f29:0x3ffcf9d0 0x400d4e05:0x3ffcfa20 0x400d4ec9:0x3ffcfa60 0x400d5119:0x3ffcfab0 0x400d7fa5:0x3ffcfad0 0x400d8021:0x3ffcfb10 0x400d85fe:0x3ffcfb30 0x4008a02e:0x3ffcfb60

Rebooting...

This is my Arduino codes:

#include <Wire.h>
#include <Adafruit_BMP085.h>
#include "WiFi.h"
#include "ESPAsyncWebServer.h"
#include <Adafruit_Sensor.h>
#include <DHT.h>

Adafruit_BMP085 bmp;

const char* ssid = "iPhone de Mouya";
const char* password = "1234567890";

#define DHTPIN 27     
#define DHTTYPE    DHT22

DHT dht(DHTPIN, DHTTYPE);

AsyncWebServer server(80);

String readDHTTemperature() {
  float t = dht.readTemperature();
  if (isnan(t)) {    
    Serial.println("Failed to read from DHT sensor!");
    return "--";
  }
  else {
    Serial.println(t);
    return String(t);
  }
}

String readDHTHumidity() {
  float h = dht.readHumidity();
  if (isnan(h)) {
    Serial.println("Failed to read from DHT sensor!");
    return "--";
  }
  else {
    Serial.println(h);
    return String(h);
  }
}

String readBMPPressure() {
  float p = bmp.readPressure();
  if (isnan(p)) {    
    Serial.println("Failed to read from BMP180 sensor!");
    return "--";
  }
  else {
    Serial.println(p);
    return String(p);
  }
}

const char index_html[] PROGMEM = R"rawliteral(
<!DOCTYPE HTML><html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
  <style>
    html {
     font-family: Arial;
     display: inline-block;
     margin: 0px auto;
     text-align: center;
    }
    h2 { font-size: 3.0rem; }
    p { font-size: 3.0rem; }
    .units { font-size: 1.2rem; }
    .dht-labels{
      font-size: 1.5rem;
      vertical-align:middle;
      padding-bottom: 15px;
    }
  </style>
</head>
<body>
  <h2>Raspidomo</h2>
  <p>
    <i class="fas fa-thermometer-half" style="color:#059e8a;"></i> 
    <span class="dht-labels">Temperature</span> 
    <span id="temperature">%TEMPERATURE%</span>
    <sup class="units">&deg;C</sup>
  </p>
  <p>
    <i class="fas fa-tint" style="color:#00add6;"></i> 
    <span class="dht-labels">Humidite</span>
    <span id="humidity">%HUMIDITY%</span>
    <sup class="units">&percnt;</sup>
  </p>
  <p>
    <i class="fas fa-parking"></i> 
    <span class="dht-labels">Pression</span> 
    <span id="pressure">%PRESSURE%</span>
    <sup class="units">Pa</sup>
  </p>
</body>
<script>
setInterval(function ( ) {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      document.getElementById("temperature").innerHTML = this.responseText;
    }
  };
  xhttp.open("GET", "/temperature", true);
  xhttp.send();
}, 10000 ) ;

setInterval(function ( ) {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      document.getElementById("humidity").innerHTML = this.responseText;
    }
  };
  xhttp.open("GET", "/humidity", true);
  xhttp.send();
}, 10000 ) ;


</script>
</html>)rawliteral";

// Replaces placeholder with DHT values
String processor(const String& var){
  //Serial.println(var);
  if(var == "TEMPERATURE"){
    return readDHTTemperature();
  }
  else if(var == "HUMIDITY"){
    return readDHTHumidity();
  }
    else if(var == "PRESSURE"){
    return readBMPPressure();
  }
  return String();
}

void setup(){
  // Serial port for debugging purposes
  Serial.begin(115200);

  dht.begin();
  bmp.begin();
  
  // Connect to Wi-Fi
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi..");
  }

  // Print ESP32 Local IP Address
  Serial.println(WiFi.localIP());

  // Route for root / web page
  server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send_P(200, "text/html", index_html, processor);
  });
  server.on("/temperature", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send_P(200, "text/plain", readDHTTemperature().c_str());
  });
  server.on("/humidity", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send_P(200, "text/plain", readDHTHumidity().c_str());
  });
  server.on("/pressure", HTTP_GET, [](AsyncWebServerRequest *request){
    request->send_P(200, "text/plain", readBMPPressure().c_str());
  });
 

  // Start server
  server.begin();
}
 
void loop(){
  
}

If you could help me it is really urgent for my degree.

find on the internet and install the ESP Exception Decoder. put the debug info into the exception decoder, paste the results here.

Try using an earlier version of the BMP085 library. If using an earlier version of the library works you can get Adafruit to fix the library but it will take about 3 weeks.

Here is what the decoder shows me:

PC: 0x40147ec1: Adafruit_BMP085::computeB5(int) at C:\Users\pc\Documents\Arduino\libraries\Adafruit_BMP085_Library\Adafruit_BMP085.cpp line 91
EXCVADDR: 0x00000000

Decoding stack results
0x40147ec1: Adafruit_BMP085::computeB5(int) at C:\Users\pc\Documents\Arduino\libraries\Adafruit_BMP085_Library\Adafruit_BMP085.cpp line 91
0x400d142d: Adafruit_BMP085::readPressure() at C:\Users\pc\Documents\Arduino\libraries\Adafruit_BMP085_Library\Adafruit_BMP085.cpp line 163
0x400d0c7a: readBMPPressure() at C:\Users\pc\Documents\Arduino\dht22web2/dht22web2.ino line 45
0x400d0d03: processor(String const&) at C:\Users\pc\Documents\Arduino\dht22web2/dht22web2.ino line 147
0x40147d4d: std::_Function_handler ::_M_invoke(std::_Any_data const&, String const&) at c:\users\pc\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-97-gc752ad5-5.2.0\xtensa-esp32-elf\include\c++\5.2.0/functional line 1857
0x400d6858: AsyncAbstractResponse::_fillBufferAndProcessTemplates(unsigned char*, unsigned int) at c:\users\pc\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-97-gc752ad5-5.2.0\xtensa-esp32-elf\include\c++\5.2.0/functional line 2271
0x400d6ae1: AsyncAbstractResponse::_ack(AsyncWebServerRequest*, unsigned int, unsigned int) at C:\Users\pc\Documents\Arduino\libraries\ESPAsyncWebServer\src\WebResponses.cpp line 315
0x400d56fa: AsyncAbstractResponse::_respond(AsyncWebServerRequest*) at C:\Users\pc\Documents\Arduino\libraries\ESPAsyncWebServer\src\WebResponses.cpp line 261
0x400d423a: AsyncWebServerRequest::send(AsyncWebServerResponse*) at C:\Users\pc\Documents\Arduino\libraries\ESPAsyncWebServer\src\WebRequest.cpp line 725
0x400d4c41: AsyncWebServerRequest::send_P(int, String const&, char const*, std::function ) at C:\Users\pc\Documents\Arduino\libraries\ESPAsyncWebServer\src\WebRequest.cpp line 804
0x400d0a4f: std::_Function_handler   >::_M_invoke(const std::_Any_data &,  ) at C:\Users\pc\Documents\Arduino\dht22web2/dht22web2.ino line 171
0x400d6f29: AsyncCallbackWebHandler::handleRequest(AsyncWebServerRequest*) at c:\users\pc\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-97-gc752ad5-5.2.0\xtensa-esp32-elf\include\c++\5.2.0/functional line 2271
0x400d4e05: AsyncWebServerRequest::_parseLine() at C:\Users\pc\Documents\Arduino\libraries\ESPAsyncWebServer\src\WebRequest.cpp line 581
0x400d4ec9: AsyncWebServerRequest::_onData(void*, unsigned int) at C:\Users\pc\Documents\Arduino\libraries\ESPAsyncWebServer\src\WebRequest.cpp line 123
0x400d5119: std::_Function_handler   >::_M_invoke(const std::_Any_data &,  ,  ,  ,  ) at C:\Users\pc\Documents\Arduino\libraries\ESPAsyncWebServer\src\WebRequest.cpp line 76
0x400d7fa5: AsyncClient::_recv(tcp_pcb*, pbuf*, signed char) at c:\users\pc\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-97-gc752ad5-5.2.0\xtensa-esp32-elf\include\c++\5.2.0/functional line 2271
0x400d8021: AsyncClient::_s_recv(void*, tcp_pcb*, pbuf*, signed char) at C:\Users\pc\Documents\Arduino\libraries\AsyncTCP\src\AsyncTCP.cpp line 1210
0x400d85fe: _async_service_task(void*) at C:\Users\pc\Documents\Arduino\libraries\AsyncTCP\src\AsyncTCP.cpp line 162
0x4008a02e: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143

Can you see where the error started from looking at the exception decoder output?

Hint

As I wrote in post number 2.

Go here GitHub - adafruit/Adafruit-BMP085-Library: A powerful but easy to use BMP085/BMP180 Library , open a issue, post your error message, and the decoder results.

This is the exact line that causes the error. The same thing happens (or happened) in the BME280 library. I modified the "computeB5" to:

{
  int32_t X1 = (UT - (int32_t)ac6) * ((int32_t)ac5) >> 15;
  int32_t XD = (X1 + (int32_t)md);
  return X1 + (XD != 0) ? ((int32_t)mc << 11) / XD : 0;
}

And that was the end of that error.

EDIT: ">" changed to "!=".

There are 5 or 6 reports of the bmp085 doing the guru thing. I'd expect if it was shared on the Adafruit github site, adafruit could fix it and send out a new library, no?

Shared that on the github site?

Dunno if you are addressing me, if so I do not have a GitHub account, if you do you can post it.

I I did what you told me but nothing has changed. I'll post on github then.

How can I modify in my project?

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