Another unhandled exception

I found a BME680 example that uses different libraries than the one I used yesterday the raised the unhandled exception error.
The code worked. I was getting sensor data in the serial monitot.

Then I added the 1306 OLED. It compiled and uploaded just fine, and then kerplooey:

Rebooting…
�␄r�␅���SB��UR��TS�@bץƧ�BME680 async test
Guru Meditation Error: Core 1 panic’ed (StoreProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x4000c46c PS : 0x00060f30 A0 : 0x800d1b8c A1 : 0x3ffb1f60
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x00000400 A5 : 0x00000000
A6 : 0x00000001 A7 : 0x00000040 A8 : 0x00000001 A9 : 0x3ffb1ef0
A10 : 0x00000000 A11 : 0x000000fe A12 : 0x00000001 A13 : 0x3ffc017c
A14 : 0x00000004 A15 : 0x00000002 SAR : 0x0000001c EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0x0000003f

Backtrace: 0x4000c46c:0x3ffb1f60 0x400d1b89:0x3ffb1f70 0x400d0f84:0x3ffb1f90 0x400d4f39:0x3ffb1fb0 0x40088a59:0x3ffb1fd0

Das Code:

#include <Arduino.h>
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_BME680.h"
#include <Adafruit_GFX.h> //Libraries for the OLED and BMP280
#include <Adafruit_SSD1306.h>

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_SSD1306 display(128, 64, &Wire, 8); //Declaring the display name (display)
Adafruit_BME680 bme; // I2C
//Adafruit_BME680 bme(BME_CS); // hardware SPI
//Adafruit_BME680 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK);

void setup()
{
  Serial.begin(9600);
  bme.begin();
  while (!Serial)
    ;
  Serial.println(F("BME680 async test"));

  if (!bme.begin())
  {
    Serial.println(F("Could not find a valid BME680 sensor, check wiring!"));
    while (1)
      ;
  }

  // Set up oversampling and filter initialization
  bme.setTemperatureOversampling(BME680_OS_8X);
  bme.setHumidityOversampling(BME680_OS_2X);
  bme.setPressureOversampling(BME680_OS_4X);
  bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
  bme.setGasHeater(320, 150); // 320*C for 150 ms
}

void loop()
{
  display.clearDisplay();
  // Tell BME680 to begin measurement.
  unsigned long endTime = bme.beginReading();
  if (endTime == 0)
  {
    Serial.println(F("Failed to begin reading :("));
    return;
  }
  Serial.print(F("Reading started at "));
  Serial.print(millis());
  Serial.print(F(" and will finish at "));
  Serial.println(endTime);

  Serial.println(F("You can do other work during BME680 measurement."));
  delay(50); // This represents parallel work.
  // There's no need to delay() until millis() >= endTime: bme.endReading()
  // takes care of that. It's okay for parallel work to take longer than
  // BME680's measurement time.

  // Obtain measurement results from BME680. Note that this operation isn't
  // instantaneous even if milli() >= endTime due to I2C/SPI latency.
  if (!bme.endReading())
  {
    Serial.println(F("Failed to complete reading :("));
    return;
  }
  Serial.print(F("Reading completed at "));
  Serial.println(millis());

  Serial.print(F("Temperature = "));
  Serial.print(bme.temperature);
  Serial.println(F(" *C"));

  Serial.print(F("Pressure = "));
  Serial.print(bme.pressure / 100.0);
  Serial.println(F(" hPa"));

  Serial.print(F("Humidity = "));
  Serial.print(bme.humidity);
  Serial.println(F(" %"));

  Serial.print(F("Gas = "));
  Serial.print(bme.gas_resistance / 1000.0);
  Serial.println(F(" KOhms"));

  Serial.print(F("Approx. Altitude = "));
  Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
  Serial.println(F(" m"));

  Serial.println();

  display.setCursor(0, 0); //Oled display, just playing with text size and cursor to get the display you want
  display.setTextColor(WHITE);
  display.setTextSize(1);
  display.print("Temp");

  display.setCursor(0, 18);
  display.print(bme.temperature, 1);
  display.setCursor(50, 17);
  display.setTextSize(1);
  display.print("C");

  display.setTextSize(1);
  display.setCursor(65, 0);
  display.print("Pres");
  display.setCursor(65, 10);
  display.print(bme.pressure, 0);
  display.setCursor(110, 10);
  display.print("hPa");

  display.setCursor(65, 25);
  display.print("Hum");
  display.setCursor(90, 25);
  display.print(bme.humidity, 0);
  display.setCursor(110, 25);
  display.print("m");

  display.display();
  delay(2000);
}

I added these two libraries and the display lines.

Trying to use the WeMos:

; PlatformIO Project Configuration File

;

;   Build options: build flags, source filter

;   Upload options: custom upload port, speed and extra flags

;   Library options: dependencies, extra library storages

;   Advanced options: extra scripting

;

; Please visit documentation for the other options and examples

; https://docs.platformio.org/page/projectconf.html

[env:wemos_d1_mini32]

platform = espressif32

board = wemos_d1_mini32

framework = arduino

Anything here look familiar? I mean, in relation to your devices etc?

https://www.google.com/search?q=Guru+Meditation+Error%3A+Core+1+panic’ed+(StoreProhibited).&client=tablet-android-samsung-nf-rev1&sourceid=chrome-mobile&ie=UTF-8

Cheers,
Norm.

1 Like

Looks like something is reading from an uninitialised pointer? Address zero is usually NULL.

Cheers,
Norm.

1 Like

I removed all the OLED text and put it back in stepwise.

Now it’s time to turn this into a BLE peripheral device, transmit those variable values.

2 Likes