Photon Hangs after few seconds using I2C and LSM9DS0

I’ve been working on getting my Photon to read acceleration and gyro data from an Addafruit LSM9DS0. Its wired up to D0 and D1 per this link. I’ve used the library through Build, but then have done most my work in particle dev.

With this configuration the Photon will startup and start logging through the serial monitor for a few seconds, then the cyan light quits “breathing” and stays solid. No more serial output occurs and the Photon appears offline in particle dev, build and the dashboard.

I followed this thread which suggests only the accelerometer will work. Changed the ino code to use lsm.readAccel() and lsm.readGyro() rather than the do-it-all In this configuration if I comment out the gyro call, the Photon will keep running and logging. If I add gyro back in, it hangs again.

I continued looking at the Adafruit_LSM9DS0.cpp code and noticed its begin logic:

bool Adafruit_LSM9DS0::begin()
  if (_i2c) {
  } else {
    // Sofware SPI
    pinMode(_clk, OUTPUT);
    pinMode(_mosi, OUTPUT);
    pinMode(_csxm, OUTPUT);

The _i2c is set to false by default. I found the constructor that sets it to true which takes a sensor id. Per the Adafruit docs this is 0x40 (unless you’ve soldered the jumpers).

Under this configuration (using hardware SPI) I can gather both gyro and accel data without crashing for minutes instead of seconds.

Any help on how to make use of I2C and the LSM9DS0 board?

I found This thread: I2C LCD freezes Photon. I haven’t patched my Photon yet.

What firmware version are you flashing? 0.4.7? Try 0.4.6

@Carsten4207 I’m using 0.4.7 (per the instructions at this post).
I set it to 0.4.6 on the page and it has been running for 10 minutes or so with no lockup yet. However when I check the version using the above method I still see 0.4.7. This raises several questions:
Is the firmware updated separately from flashing code?
Do I need to use the cli to change the version?
Can the firmware version be set with particle-dev?
Does the approache compile against 0.4.6 even though the system reports 0.4.7?

The particular problem that causes the I2C lockup is in user firmware, so compiling against 0.4.6 works without needing to downgrade the system firmware.

@mdma How do I select 0.4.6 when using particle-dev?

You can’t there’s no version selection in Dev.