Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error for Core2 + Env Pro? #29

Open
2 tasks done
kingaza opened this issue Nov 24, 2024 · 4 comments
Open
2 tasks done

Error for Core2 + Env Pro? #29

kingaza opened this issue Nov 24, 2024 · 4 comments

Comments

@kingaza
Copy link

kingaza commented Nov 24, 2024

Describe the bug

I try the example ENV_PRO, by modifying for Core2.
But BME68X error of code 2 happpens.

To reproduce

Uploading ENV_PRO.ino…

Expected behavior

The official Core2 exmaple works, but the unit work fails.

Screenshots

Uploading error.png…

Environment

  • OS:
  • IDE &IDE Version:
  • Repository Version:

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • My report contains all necessary details
@kingaza
Copy link
Author

kingaza commented Nov 24, 2024

Rebooting...
ets Jul 29 2019 12:21:46

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:0x3fff0030,len:1344
load:0x40078000,len:13964
load:0x40080400,len:3600
entry 0x400805f0
M5Core2 initializing...axp: vbus limit off
axp: gpio1 init
axp: gpio2 init
axp: rtc battery charging enabled
axp: esp32 power voltage was set to 3.35v
axp: lcd backlight voltage was set to 2.80v
axp: lcd logic and sdcard voltage preset to 3.3v
axp: vibrator voltage preset to 2v
touch: FT6336 ready (fw id 0x10 rel 1, lib 0x300E)
OK
BME68X error code : -2
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.

Core 1 register dump:
PC : 0x400880a4 PS : 0x00060a30 A0 : 0x800f7ba4 A1 : 0x3ffb1d90
A2 : 0x3ffb1da0 A3 : 0x00000988 A4 : 0x0000002e A5 : 0x3ffb1da0
A6 : 0x00000000 A7 : 0x00000002 A8 : 0x00000000 A9 : 0x3ffb1e80
A10 : 0x3ffb1f1c A11 : 0x00000000 A12 : 0x00000002 A13 : 0x0000ff00
A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x0000001e EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000988 LBEG : 0x400880a4 LEND : 0x400880c0 LCOUNT : 0x00000001

Backtrace: 0x400880a1:0x3ffb1d90 0x400f7ba1:0x3ffb1da0 0x400f7893:0x3ffb1e00 0x400d8ed5:0x3ffb1e30 0x400d24c6:0x3ffb1f50 0x400ddac6:0x3ffb2290

ELF file SHA256: 83434aaf8fc97b8a

@kingaza
Copy link
Author

kingaza commented Nov 24, 2024

/**

#include <M5Core2.h>
#include <bsec2.h>

/**

  • @brief : This function checks the BSEC status, prints the respective error
  • code. Halts in case of error
  • @param[in] bsec : Bsec2 class object
    */
    void checkBsecStatus(Bsec2 bsec);

/**

  • @brief : This function is called by the BSEC library when a new output is
  • available
  • @param[in] input : BME68X sensor data before processing
  • @param[in] outputs : Processed BSEC BSEC output data
  • @param[in] bsec : Instance of BSEC2 calling the callback
    */
    void newDataCallback(const bme68xData data, const bsecOutputs outputs,
    Bsec2 bsec);

/* Create an object of the class Bsec2 */
Bsec2 envSensor;

/* Entry point for the example */
void setup(void) {
M5.begin();

/* Desired subscription list of BSEC2 outputs */
bsecSensor sensorList[] = {
    BSEC_OUTPUT_IAQ,          BSEC_OUTPUT_RAW_TEMPERATURE,
    BSEC_OUTPUT_RAW_PRESSURE, BSEC_OUTPUT_RAW_HUMIDITY,
    BSEC_OUTPUT_RAW_GAS,      BSEC_OUTPUT_STABILIZATION_STATUS,
    BSEC_OUTPUT_RUN_IN_STATUS};

/* Initialize the communication interfaces */
Serial.begin(115200);
Wire.begin(21, 22);

/* Valid for boards with USB-COM. Wait until the port is open */
while (!Serial) delay(10);

/* Initialize the library and interfaces */
if (!envSensor.begin(BME68X_I2C_ADDR_HIGH, Wire)) {
    checkBsecStatus(envSensor);
}

/* Subsribe to the desired BSEC2 outputs */
if (!envSensor.updateSubscription(sensorList, ARRAY_LEN(sensorList),
                                  BSEC_SAMPLE_RATE_LP)) {
    checkBsecStatus(envSensor);
}

/* Whenever new data is available call the newDataCallback function */
envSensor.attachCallback(newDataCallback);

Serial.println("BSEC library version " + String(envSensor.version.major) +
               "." + String(envSensor.version.minor) + "." +
               String(envSensor.version.major_bugfix) + "." +
               String(envSensor.version.minor_bugfix));

}

/* Function that is looped forever /
void loop(void) {
/
Call the run function often so that the library can
* check if it is time to read new data from the sensor
* and process it.
*/
if (!envSensor.run()) {
checkBsecStatus(envSensor);
}
}

void newDataCallback(const bme68xData data, const bsecOutputs outputs,
Bsec2 bsec) {
if (!outputs.nOutputs) {
return;
}

Serial.println(
    "BSEC outputs:\n\ttimestamp = " +
    String((int)(outputs.output[0].time_stamp / INT64_C(1000000))));
for (uint8_t i = 0; i < outputs.nOutputs; i++) {
    const bsecData output = outputs.output[i];
    switch (output.sensor_id) {
        case BSEC_OUTPUT_IAQ:
            Serial.println("\tiaq = " + String(output.signal));
            Serial.println("\tiaq accuracy = " +
                           String((int)output.accuracy));
            break;
        case BSEC_OUTPUT_RAW_TEMPERATURE:
            Serial.println("\ttemperature = " + String(output.signal));
            break;
        case BSEC_OUTPUT_RAW_PRESSURE:
            Serial.println("\tpressure = " + String(output.signal));
            break;
        case BSEC_OUTPUT_RAW_HUMIDITY:
            Serial.println("\thumidity = " + String(output.signal));
            break;
        case BSEC_OUTPUT_RAW_GAS:
            Serial.println("\tgas resistance = " + String(output.signal));
            break;
        case BSEC_OUTPUT_STABILIZATION_STATUS:
            Serial.println("\tstabilization status = " +
                           String(output.signal));
            break;
        case BSEC_OUTPUT_RUN_IN_STATUS:
            Serial.println("\trun in status = " + String(output.signal));
            break;
        default:
            break;
    }
}

}

void checkBsecStatus(Bsec2 bsec) {
if (bsec.status < BSEC_OK) {
Serial.println("BSEC error code : " + String(bsec.status));

} else if (bsec.status > BSEC_OK) {
    Serial.println("BSEC warning code : " + String(bsec.status));
}

if (bsec.sensor.status < BME68X_OK) {
    Serial.println("BME68X error code : " + String(bsec.sensor.status));
} else if (bsec.sensor.status > BME68X_OK) {
    Serial.println("BME68X warning code : " + String(bsec.sensor.status));
}

}

@kingaza kingaza closed this as completed Nov 24, 2024
@kingaza kingaza reopened this Nov 24, 2024
@kingaza
Copy link
Author

kingaza commented Nov 24, 2024

wrong pin number for Core2 Wire:

#define SDA_PIN 32
#define SCL_PIN 33

Wire.begin(SDA_PIN, SCL_PIN);

@kingaza kingaza closed this as completed Nov 24, 2024
@kingaza
Copy link
Author

kingaza commented Nov 24, 2024

wrong pin number for Core2 Wire:

#define SDA_PIN 32
#define SCL_PIN 33

Wire.begin(SDA_PIN, SCL_PIN);

@kingaza kingaza reopened this Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant