我试图从 IMU BNO055 中获得一些读数,下面是 ADA Fruit 的实现。
https://cdn-learn.adafruit.com/downloads/pdf/adafruit-bno055-absolute-orientation-sensor.pdf
好像我无法通过校准步骤。
BNO055 手册可以在下面找到: https ://cdn-shop.adafruit.com/datasheets/BST_BNO055_DS000_12.pdf
我没有使用库,而是直接使用 I2C 进行通信并从设备寄存器读取和写入。
我正在做的配置如下:
// The opening of the device and so on, works, so the line below is not a problem.
if (ioctl(data_exchange->file_imu_sensor, I2C_SLAVE, data_exchange->imu_addr) < 0) {
printf("Impossible to communicate with the IMU in the i2c. Make sure that the address you have is correct!\n");
exit(1);
}
// Here is where I start with the configuration. First I reset the device.
//SYS_TRIGGER Register. ADD 3F
//CLK_SEL (0 internal oscillator) REST_INT(reset interrumptions)RST_SYS(1 to reset) x x x x Self_TEST(1 to make a self test.)
// 00xxxx0
buf[0] = 0x3F;
buf[1] = 0x20; //00100000
write_buf(data_exchange,buf,3);
printf("IMU WAS COMMANDED TO RESET");
sleep(1); //It needs some time to reset. With one sec should be sufficient.
// Here I start with the real configuration.
// G range 2G xxxxxx00
// BW 7.81Hz xxx000xx
// Op mod normal 000xxxxx
//So I will write a 0 to the register ACC_condfi
buf[0] = 0x0D;
buf[1] = 0x00;
write_buf(data_exchange,buf,3);
// Now unit selection.UNIT_SEL Page 30.
//Accelaration m/s2 xxxxxxx0b
// Magnetic field in micro Teslas (always)
// Angular rate defrees ps xxxxxx0xb
// Euler angles Degress> xxxxxxxb
// Quaternion in Quaernion units always.
//Temperatyre deg xxx0xxxxb
// NPI The data output format can be selected by writing to the UNIT_SEL register, this allows user to switch between the orientation definition described by Windows and Android operating systems
// Windows> 0xxxxxxxb
// Android> 1xxxxxxxb. Page 30.
// Bits 5 and 6 are reserved. So it does not matter. So we write a 0.
buf[0] = 0x03;
buf[1] = 0x00;
write_buf(data_exchange,buf,3);
//We now need to set the operation mode:
//Register OPR_MODE Page 21.
//Fusion mode NDOF. xxxx1100b
buf[0] = 0x1C;
buf[1] = 0x0C; //00001100
write_buf(data_exchange,buf,3);
// GYR_Config_0
buf[0] = 0x0B;
buf[1] = 0x00; //00001100
write_buf(data_exchange,buf,3);
// PWR_MODE. Normal mode is xxxxxx00b
buf[0] = 0x3E;
buf[1] = 0x00; //00000000
write_buf(data_exchange,buf,3);
现在,我应该等待执行芯片的内部校准。但它似乎还没有完成。
我通过检查寄存器 0x35 来检查它,如果校准完成,它应该 >0。
char buf[10];
int status=0;
read_buf(dataset_pointer,0x35,3,buf);
status=buf[0];
if(status>0){
//Here is where I perform all the reading and so on.
}
我在配置中遗漏了什么吗?我在网上查了一下,我找到了一些建议(也根据 IMU 手册)关于用设备在空中制作一个 8 符号,我这样做了,但无论如何校准都没有完成。
我认为这不是电源问题(我在 Bosh 论坛中找到了一些关于此的参考资料),因为我将 VIN 连接到 5.0V,将 3VO 连接到 3.3V,将 GND 连接到 GND。
对此的任何评论都会有很大帮助。我是否配置设备错误?我错过了任何注册表吗?
谢谢!