Does anyone know what I may be doing wrong with this little sketch? I'm trying to communicate from the Portenta H7 through the Portenta Breakout Board to an Adafruit BNO08X 9-DOF IMU. I'm getting, "Failed to find BNO08x chip". I can't find reliable information of what the pins should be named. Document seems to say that SPI0 is not connected and the silkscreened SPI1 is actually connected to the SPI0 pins. Confusing.
#include <Arduino.h>
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_BNO08x.h>
#define BNO08X_RESET PC_15 //GPIO_PIN_1
Adafruit_BNO08x bno08x(BNO08X_RESET); //declare the IMU
sh2_SensorValue_t sensorValue;
long reportIntervalUs = 100000; //20000us; // was 50ms 50000us
void setReports(void) {
Serial.println("Setting desired reports");
if (! bno08x.enableReport(SH2_GAME_ROTATION_VECTOR, reportIntervalUs)) {
Serial.println("Could not enable game vector");
}
}
void setup(void) {
Serial.begin(115200);
while (!Serial) delay(10);
////////////////////////////////////////////////////////////////////////////////////
///////////////////// BHNO085 IMU //////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
MbedSPI SPI_IMU(PC_2, PC_3, PI_1);
if (!bno08x.begin_SPI(PI_0, PC_13, &SPI_IMU, 0L)) { //BNO08x ID 0x4A
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);
}
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;
}
}
Here's the hookup. The BNO08X works in Serial RVC mode, so I know the BNO works. Green LED is on: