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

Bug report: Nicla is disconnecting/crashing after ~30 min of I2C com #21

Closed
lsi8 opened this issue Dec 7, 2021 · 3 comments
Closed
Labels
conclusion: duplicate Has already been submitted type: imperfection Perceived defect in any part of project

Comments

@lsi8
Copy link

lsi8 commented Dec 7, 2021

@giulcioffi
@facchinm
I wanted to post this as an issue under arduino-libraries/Arduino_BHY2Host, as it pertains to your example code referenced by marqdevx in his tutorial, but it seems you've disabled it? I've tested the example located here (Arduino_Pro_Tutorials/examples/Nicla Sense ME as a MKR Shield) and it suffers from the same bug.

@marqdevx
I am trying to get your basic tutorial working for the Nicla and Portenta H7 connected over ESLOV. The bug in your example is that it only works for a little over half an hour before crashing.

I modified your code for debugging purposes:
Arduino_BHY2Host/examples/Accelerometer/Accelerometer_copy.ino:

#include "Arduino.h"
#include "Arduino_BHY2Host.h"
#include <LandoRGBLedPortenta.h>

SensorXYZ accel(SENSOR_ID_ACC);
LandoRGBLedPortenta portentaLeds;

const int MAX_DUPLICATE_READINGS = 10;
String colorToToggle = "white";
int duplicateReadings = 0;

static unsigned long printTime = 0;
static unsigned long startTime = 0;
static String timeToCrash = "";
static String lastAccelReading = "";

void setup()
{
  Serial.begin(115200);
  while(!Serial);
  Serial.println("Serial started!");
  portentaLeds.setColor("red");
  BHY2Host.begin(false, NICLA_VIA_ESLOV);
  Serial.println("BHY2HostSuccess!");
  portentaLeds.setColor("green");
  accel.begin();
  Serial.println("Leaving setup!");
  portentaLeds.setColor("blue");
  
  printTime = millis();
  startTime = printTime;
}

void loop()
{
  BHY2Host.update();

  if (millis() - printTime >= 1000) {
    printTime = millis();
    String accelReading = accel.toString();
    if(accelReading == lastAccelReading) {
      duplicateReadings++;
      if(duplicateReadings == MAX_DUPLICATE_READINGS) {
        timeToCrash = " " + String(printTime - startTime) + " ms";
        colorToToggle = "red";
      }
    }
    else {
      duplicateReadings = 0;
    }
    Serial.println(String("Acceleration values: ") + String(accelReading) + String(timeToCrash));
    portentaLeds.toggleColor(colorToToggle);
    lastAccelReading = accelReading;
  }
}

Arduino_BHY2/examples/App/App_copy.ino:

#include "Nicla_System.h"
#include "Arduino.h"
#include "Arduino_BHY2.h"

void colorCycle(int loops) {
  for(int i = 0; i < loops; i++) {
    nicla::leds.setColor(red);
    delay(1000);
    nicla::leds.setColor(green);
    delay(1000);
    nicla::leds.setColor(blue);
    delay(1000);
  }
  nicla::leds.setColor(off);
}

void setup(){
  BHY2.begin(NICLA_I2C, NICLA_VIA_ESLOV);
  nicla::leds.begin();
  colorCycle(5);
}

void loop(){
  // Update and then sleep
  nicla::leds.setColor(blue);
  BHY2.update(500);
  nicla::leds.setColor(off);
}

After 1,881,243–2,398,485 ms, the Nicla stops updating…

  • The blue led on Nicla stops flashing indicating that the BHY2.update(500); line in the loop probably caused an exception.

Pasted Graphic

If I reset just the Portenta and relaunch the serial printer, the Portenta halts at the accel.begin(); line in the setup...

Pasted Graphic 1

@per1234
Copy link
Contributor

per1234 commented Dec 7, 2021

it seems you've disabled it?

The reason that was done is arduino-libraries/Arduino_BHY2Host is a mirror of https://github.com/arduino/nicla-sense-me-fw/tree/main/Arduino_BHY2Host. The library is developed exclusively in that repository, so all issues must be tracked there also.

A note should be added to the library readmes to make this mirroring status clear.

@per1234 per1234 added the type: imperfection Perceived defect in any part of project label Dec 7, 2021
@lsi8
Copy link
Author

lsi8 commented Dec 7, 2021

@per1234
Oh I was unaware. It seems, however, that my issue might get more attention here, as the only open issue (of 2 total) at arduino-libraries/Arduino_BHY2Host has been left open w/o response since May 28th 😂

Speaking of that linked issue, do you think that I could be having a similar increase in current draw over time leading to some kind of automatic damage-preventative shutdown?

@per1234
Copy link
Contributor

per1234 commented Dec 7, 2021

Moved to arduino/nicla-sense-me-fw#42. Thanks @lsi8!

@per1234 per1234 closed this as completed Dec 7, 2021
@per1234 per1234 added the conclusion: duplicate Has already been submitted label Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: duplicate Has already been submitted type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants