realNohoHank
New member
I have a Teensy 4.0 and an Adafruit BNO085 IMU (link here) that I am trying to use together. I'm trying to hook up the BNO085 over I2C. I'm using the Arduino IDE and Teensyduino 1.53. Unfortunately, I'm unable to run any of the sample programs and the only output I get in the serial monitor is "Failed to find BNO08x chip." I've tried running a I2C scanner and it returns the proper address of the BNO085 board (0x4A), so I'm convinced that this is a software issue and not an issue with the Teensy or the BNO085. I've tried to run both of the included sample programs with the Adafruit BNO08x library without any luck with either. I also looked into the library cpp file and found that the Adafruit_Bno08x::_init(int32_t sensor_id) method errors on the following section of code:
Evidently status is not equal to SH2_OK, so the init method returns false. Below is the source code for one of the example scripts I tried, rotation_vector.ino:
If anyone has any insight or suggestions on what could be the issue I would really appreciate your input.
Code:
memset(&prodIds, 0, sizeof(prodIds));
status = sh2_getProdIds(&prodIds);
if (status != SH2_OK) {
return false;
}
Evidently status is not equal to SH2_OK, so the init method returns false. Below is the source code for one of the example scripts I tried, rotation_vector.ino:
Code:
// Basic demo for readings from Adafruit BNO08x
#include <Adafruit_BNO08x.h>
// For SPI mode, we need a CS pin
#define BNO08X_CS 10
#define BNO08X_INT 9
#define BNO08X_RESET 5
Adafruit_BNO08x bno08x(BNO08X_RESET);
sh2_SensorValue_t sensorValue;
void setup(void) {
Serial.begin(115200);
while (!Serial) delay(10); // will pause Zero, Leonardo, etc until serial console opens
Serial.println("Adafruit BNO08x test!");
// Try to initialize!
if (!bno08x.begin_I2C()) {
//if (!bno08x.begin_UART(&Serial1)) { // Requires a device with > 300 byte UART buffer!
//if (!bno08x.begin_SPI(BNO08X_CS, BNO08X_INT)) {
Serial.println("Failed to find BNO08x chip");
while (1) { delay(10); }
}
Serial.println("BNO08x Found!");
for (int n = 0; n < bno08x.prodIds.numEntries; n++) {
Serial.print("Part ");
Serial.print(bno08x.prodIds.entry[n].swPartNumber);
Serial.print(": Version :");
Serial.print(bno08x.prodIds.entry[n].swVersionMajor);
Serial.print(".");
Serial.print(bno08x.prodIds.entry[n].swVersionMinor);
Serial.print(".");
Serial.print(bno08x.prodIds.entry[n].swVersionPatch);
Serial.print(" Build ");
Serial.println(bno08x.prodIds.entry[n].swBuildNumber);
}
setReports();
Serial.println("Reading events");
delay(100);
}
// Here is where you define the sensor outputs you want to receive
void setReports(void) {
Serial.println("Setting desired reports");
if (! bno08x.enableReport(SH2_GAME_ROTATION_VECTOR)) {
Serial.println("Could not enable game vector");
}
}
void loop() {
delay(10);
if (bno08x.wasReset()) {
Serial.print("sensor was reset ");
setReports();
}
if (! bno08x.getSensorEvent(&sensorValue)) {
return;
}
switch (sensorValue.sensorId) {
case SH2_GAME_ROTATION_VECTOR:
Serial.print("Game Rotation Vector - r: ");
Serial.print(sensorValue.un.gameRotationVector.real);
Serial.print(" i: ");
Serial.print(sensorValue.un.gameRotationVector.i);
Serial.print(" j: ");
Serial.print(sensorValue.un.gameRotationVector.j);
Serial.print(" k: ");
Serial.println(sensorValue.un.gameRotationVector.k);
break;
}
}
If anyone has any insight or suggestions on what could be the issue I would really appreciate your input.