Hi, im using a seeed nrf52840 and adafruit ICM20649, i can get it to work no problem whilst connected to serial, however when i start it with no serial (from battery it doesnt work).
i am using the LED to check where its upto: it flashes at the start during setup and then ticks on and off if i exceed 6deg/sec on the gyro.
if i upload the code via usb and run it it works, if i unplug and replug it stops working
if i upload via usb and then turn on the battery it still works, if i remove the usb it still works.
if i power it with the lipo i get the start up sequence but no gyro detection.
im using i2c and powering via the 3.3pins from the Seeed, i measure 3.3v if im using lipo and/or usb power.
edit:::
i have added code so that it flashes if i2c fails on start up - it fails on all but initial upload. reconnecting or lipo start fails the sensor connection.
#include <Adafruit_ICM20649.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
Adafruit_ICM20649 icm;
float gyroAvY;
int avNum = 10;
void setup(void) {
pinMode(LED_BUILTIN, OUTPUT);
if (!icm.begin_I2C()) { //try and connect using i2c, if this doenst work, flash the LED
for (int i = 0; i < 50; i++) {
digitalToggle(LED_BUILTIN);
delay(50);
}
}
for (int i = 0; i < 10; i++) { //show that start up is taking place
digitalToggle(LED_BUILTIN);
delay(500);
}
icm.setGyroRange(ICM20649_GYRO_RANGE_2000_DPS);
}
void loop() {
// /* Get a new normalized sensor event */
sensors_event_t accel;
sensors_event_t gyro;
sensors_event_t temp;
for (int i = 0; i < avNum; i++) {
icm.getEvent(&accel, &gyro, &temp);
gyroAvY += gyro.gyro.y;
}
gyroAvY = gyroAvY / avNum;
if (gyroAvY > 6) {
digitalToggle(LED_BUILTIN);
}
Serial.print(gyroAvY);
Serial.println();
}
if anyone knows anything id love to hear it as im really scratching my head.
many thanks