BNO055 via i2C
MetaWear RPro
MetaWear Android SDK: 2.3.0
MetaWear Firmware: 1.1.0
OnePlus Two running Android v5.1.1
I am trying to connect to an Adafruit BNO055 breakout board (https://www.adafruit.com/product/2472) through the i2c interface. I am also able to compare the readings from an Arduino using the Adafruit library (https://github.com/adafruit/Adafruit_BNO055).
I am accessing the i2cModule via a routeData chain and using the timerModule to poll. Here is a sample of pulling the first 7 bytes from the BNO board from the Arduino and the MetaWear API:
Arduino readLen(buffer, 0x00, 7): A0, FB, 32, 0F, 11, 03, 15
Android readData(40, 0x00, 7, 69): a0, fb, 32, 0f, 11, 03, 15
Following the examples, the Arduino queries the 0x00 register to ensure that 0xA0 is returned. Both are able to query this address just fine.
According to the Adafruit_BNO055.h, I should be able to query 6 bytes from 0x1A to receive the Euler data registers. However this does not returning anything on the MetaWear:
Arduino readLen(buffer, 0x1A, 6): 80, 16, F9, FF, DE, FF
Android readData(40, 0x1A, 6, 69): 00, 00, 00, 00, 00, 00
I have stripped down the Arduino sketch to simply reading those registers (so removing the bno.begin call, bno.enable) and I'm receiving the data just fine. I am not sure how else to proceed
MetaWear Android SDK: 2.3.0
MetaWear Firmware: 1.1.0
OnePlus Two running Android v5.1.1
I am trying to connect to an Adafruit BNO055 breakout board (https://www.adafruit.com/product/2472) through the i2c interface. I am also able to compare the readings from an Arduino using the Adafruit library (https://github.com/adafruit/Adafruit_BNO055).
I am accessing the i2cModule via a routeData chain and using the timerModule to poll. Here is a sample of pulling the first 7 bytes from the BNO board from the Arduino and the MetaWear API:
Arduino readLen(buffer, 0x00, 7): A0, FB, 32, 0F, 11, 03, 15
Android readData(40, 0x00, 7, 69): a0, fb, 32, 0f, 11, 03, 15
Following the examples, the Arduino queries the 0x00 register to ensure that 0xA0 is returned. Both are able to query this address just fine.
According to the Adafruit_BNO055.h, I should be able to query 6 bytes from 0x1A to receive the Euler data registers. However this does not returning anything on the MetaWear:
Arduino readLen(buffer, 0x1A, 6): 80, 16, F9, FF, DE, FF
Android readData(40, 0x1A, 6, 69): 00, 00, 00, 00, 00, 00
I have stripped down the Arduino sketch to simply reading those registers (so removing the bno.begin call, bno.enable) and I'm receiving the data just fine. I am not sure how else to proceed
This discussion has been closed.
Comments
Is there an address restriction enforced on the MetaWear i2c interface? For example to only address at 3 bits? I do not receive any values for addresses above 0x07.
Are there any other restrictions enforced through the MetaWear i2c interface?
Thank you for your reply. I have the BNO055 board wired to the i2c interface:
BNO055 <-> RPro
VIN <-> 11
GND <-> 4
SDA <-> 5
SCL <-> 6
I am connecting to address 0x28 (40) which is the same address when connecting via the Arduino. The first 7 registers match between communication from the Arduino and the RPro so I can only assume that the RPro is connecting to the BNO055.
Thank you for your reply and verifying communications with an oscilloscope.
As part of the Arduino translation to i2cModule, I implemented the delays using Thread.sleep(ms). All delays in the Arduino code are in ms. However there are some writes that do not have a delay so I have since added delays between every i2cModule.write command.
I have tried delays of 10, 30, 50, and 800 and I still receive nulls. The only write command that has a larger delay of 2000ms is the BNO reset command: i2cModule.writeData(40, 0x3F, Array(0x20.toByte)) And I have tried delays of 500, 1000, 2000, 5000 and 10000.
I have separate prototype boards for the Arduino and the RPro so I have been moving the BNO055 board between the two. I will try wiring the Arduino and RPro i2c lines (and ground) to a breadboard and then initialise the BNO from the Arduino and then try reading from the RPro.
Here is my initialisation code with the Arduino code as comments:
// BNO055_OPR_MODE_ADDR = 0X3D
// OPERATION_MODE_CONFIG = 0X00
// void Adafruit_BNO055::setMode(adafruit_bno055_opmode_t mode)
// {
// _mode = mode;
// write8(BNO055_OPR_MODE_ADDR, _mode);
// delay(30);
// }
// setMode(OPERATION_MODE_CONFIG);
i2cModule.writeData(40, 0x3D, Array(0.toByte))
Thread.sleep(delay)
// /* Reset */
// BNO055_SYS_TRIGGER_ADDR = 0X3F
// write8(BNO055_SYS_TRIGGER_ADDR, 0x20);
// while (read8(BNO055_CHIP_ID_ADDR) != BNO055_ID)
// {
// delay(10);
// }
// delay(50)
i2cModule.writeData(40, 0x3F, Array(0x20.toByte))
Thread.sleep(5000)
// /* Set to normal power mode */
// BNO055_PWR_MODE_ADDR = 0X3E
// POWER_MODE_NORMAL = 0X00
// write8(BNO055_PWR_MODE_ADDR, POWER_MODE_NORMAL);
// delay(10);
//
i2cModule.writeData(40, 0x3E, Array(0.toByte))
Thread.sleep(delay)
// BNO055_PAGE_ID_ADDR = 0X07
// write8(BNO055_PAGE_ID_ADDR, 0);
i2cModule.writeData(40, 0x07, Array(0.toByte))
Thread.sleep(delay)
// BNO055_SYS_TRIGGER_ADDR = 0X3F
// write8(BNO055_SYS_TRIGGER_ADDR, 0x0);
// delay(10);
i2cModule.writeData(40, 0x3F, Array(0.toByte))
Thread.sleep(delay)
// setMode(mode);
// delay(20);
i2cModule.writeData(40, 0x3D, Array(0.toByte))
Thread.sleep(delay)
// delay(20);
i2cModule.writeData(40, 0x3D, Array(0.toByte))
Thread.sleep(delay)
The logs are full of Euler data! I assumed that the default mode was 0x00 from this comment on line 71 of the begin() method:
/* Switch to config mode (just in case since this is the default) */
https://github.com/adafruit/Adafruit_BNO055/blob/master/Adafruit_BNO055.cpp#L71
The sample Arduino code simply called .begin() without passing a default mode. I never thought to look at the header definition.
Thank you again Matt!