Hi,
actually I want to read data from BMI270 of accelerometer with Arduino Nano.
First of all I tried reading data by using this .ino file from github and the corresponding libraries.
Unfortunately there is an error occurring while compiling which I am not getting solved.
bmi2.h:1341:2: error: #endif without #if
#endif /* BMI2_H_ */
So I decided to try using just wire.h library.
The I2C device is getting recocnised, when asking for ID I receive 0x24 which is correct too.
I followed the instructions for normal power mode on page 23 of datasheet.
I read the register values and they are written correct but the accelerometer values are still zero.
This is the code I use for reading the LSB of the arduino:
#include <Wire.h> //I2C Arduino Library
#define address 0x69 //I2C 7bit address
int response;
void setup(){
//Initialize Serial and I2C communications
Serial.begin(9600);
Wire.begin();
delay(100);
Wire.setClock(400000UL);
// setting IMU270 in normal mode
Wire.beginTransmission(address);
Wire.write(0x7D); //PWR_Control Register
Wire.write(0x0E); // enable acquistion of acc,gyro and temp
Wire.endTransmission();
Wire.beginTransmission(address);
Wire.write(0x40); // Acc config
Wire.write(0xA8); //
Wire.endTransmission();
Wire.beginTransmission(address);
Wire.write(0x42); // Gyro config
Wire.write(0xA9);
Wire.endTransmission();
Wire.beginTransmission(address); //
Wire.write(0x7C); // PWR config
Wire.write(0x02);
Wire.endTransmission();
}
void loop()
{
Wire.beginTransmission(address);
Wire.write(0x0C); // reading LSB of Acc
Wire.requestFrom(address,1);
if(Wire.available()<=1)
{
response = Wire.read();
}
Wire.endTransmission();
Serial.println(response);
delay(500);
}
Thanks in advance!