I am attempting to access the IMU data from the Nano 33 BLE REV2 (ABX00071). I know it uses two IMUs, BMI270 and BMM150, and I am using the example sketch for the corresponding library.
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("Started");
if (!IMU.begin()) {
Serial.println("Failed to initialize IMU!");
while (1);
}
Serial.print("Accelerometer sample rate = ");
Serial.print(IMU.accelerationSampleRate());
Serial.println(" Hz");
Serial.println();
Serial.println("Acceleration in G's");
Serial.println("X\tY\tZ");
}
void loop() {
float x, y, z;
if (IMU.accelerationAvailable()) {
IMU.readAcceleration(x, y, z);
Serial.print(x);
Serial.print('\t');
Serial.print(y);
Serial.print('\t');
Serial.println(z);
}
}
This is the output from the serial monitor:
Started
Accelerometer sample rate = 0.39 Hz
Acceleration in G's
X Y Z
After a few minutes, the only reading seen is 0.00 0.00 0.00
This is the library example for Simple Accellerometer
/*
Arduino BMI270 - Simple Accelerometer
This example reads the acceleration values from the BMI270
sensor and continuously prints them to the Serial Monitor
or Serial Plotter.
The circuit:
- Arduino Nano 33 BLE Sense Rev2
created 10 Jul 2019
by Riccardo Rizzo
This example code is in the public domain.
*/
#include "Arduino_BMI270_BMM150.h"
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println("Started");
if (!IMU.begin()) {
Serial.println("Failed to initialize IMU!");
while (1);
}
Serial.print("Accelerometer sample rate = ");
Serial.print(IMU.accelerationSampleRate());
Serial.println(" Hz");
Serial.println();
Serial.println("Acceleration in G's");
Serial.println("X\tY\tZ");
}
void loop() {
float x, y, z;
if (IMU.accelerationAvailable()) {
IMU.readAcceleration(x, y, z);
Serial.print(x);
Serial.print('\t');
Serial.print(y);
Serial.print('\t');
Serial.println(z);
}
}
Could you please explain what you mean by a bus contention?
I have included the library in the script, I mistakenly did not include that when I copied my code here. The code I am uploading to the board is identical to the code provided. Do you have any other suggestions?
There is no hardware connected to the board, only the USB cable to my computer. How would I troubleshoot an i2c error?
I found two I2C devices, one at 0x10 and one at 0x68. I presume these are the BMI270 and BMM150. From page 7 of the datasheet, it appears that these are the only I2C devices on board, so I think this is a fair judgement.
Is there anything else I could try? Is it possible I have received two dud boards?
0x68 is the BMI270.
0x10 is the BMM150
Don't know what to tell you.
Edit: Browsing through the library, I think the library is attempting to use Wire instead of Wire1. This is from /src/BoschSensorClass.h: BoschSensorClass(TwoWire& wire = Wire);
I do not the think the library is broken. There are no issues reported on github about the wrong bus being used. I have worked on other threads with people using that library on a Nano33 Ble rev2 and they are getting data from the imu.
Hello,
I just got a nano 33 BLE rev.2 board and I have exactly the same problem. It might be interesting to compare the serial numbers or manufacturing dates of our boards. Mine is marked 08-23. The NINA-B306 module is marked 008-0023/20. The BMI270 IMU is marked 5L 3FM and the BMM150 magnetometer is marked 157 T208 09T.
Please ensure that you are using the latest version of the Arduino_BMI270_BMM150 library. You can update or verify this through the Library Manager in the Arduino IDE.
Once updated, I recommend testing the SimpleGyroscope example sketch from the library, which you can find here: SimpleGyroscope Example.
If you still receive only 0.00 values or encounter the "Failed to initialize IMU!" message, it could indicate a hardware or configuration issue. In that case, I encourage you to reach out to Arduino Technical Support via the following form: Arduino Support Contact Form.
Feel free to share any additional details if the issue persists!
Thank you for your answer, Jorge.
I solved my problem : in the board manager of the IDE, the Mbed OS Nano boards was in an old version: 4.0.8. I updated it to 4.2.1 and all is OK. Maybe the 4.0.8 version is OK for rev. 1 but not for rev. 2 of tne Nano 33 BLE.