Skip to content

Library: Can't initialize two BNO086 on one I2C bus #3

Open
@iLoveAndyBaker

Description

@iLoveAndyBaker

Devices ACK on addresses 0x4A and 0X46, but library won't allow both to init.

RP2040 (As KB2040)

Steps to reproduce

Daisychain two BNO086 via Qwiic connectors, jump address pin on one unit, cut pullups on end unit.

Run example code:


#include "SparkFun_BNO08x_Arduino_Library.h"  // CTRL+Click here to get the library: http://librarymanager/All#SparkFun_BNO08x
BNO08x myIMU;
BNO08x yourIMU;

void setup() {
  Serial.begin(115200);
  delay(5000);
  Serial.println();
  Serial.println("BNO08x Read Example");

  Wire.begin();
  Wire.setClock(100000); //Increase I2C data rate to 400kHz

  if (myIMU.begin(0x4B,Wire,-1,-1) == false) {
    Serial.println("First BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
    //while (1)
      ;
  } else{
    Serial.println("First IMU found!");
  }

  if (yourIMU.begin(0x4A,Wire,-1,-1) == false) {
    Serial.println("Second BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
    while (1)
      ;
  } else{
    Serial.println("Second IMU found!");
  }

Expected behavior

Both chips ACK and program continues with begin == false. BUT...

Actual behavior

Second to be init'd will ack, but begin returns false

Device acknowledged at 75
First IMU found!
Device acknowledged at 74
Second BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...

I changed the library Sparkfun_BNO8x_Arduino_Library.cpp to call out the address that ACK'd

    	return (false); 

// CHANGED THIS SERIAL MESSAGE
    Serial.print(F("Device acknowledged at "));
    Serial.println(_deviceAddress);
    //delay(1000);

    _HAL.open = i2chal_open;

Re-ordering the initialization of the boards doesn't help. The one that goes SECOND fails.

BNO08x Read Example
Device acknowledged at 74
First IMU found!
Device acknowledged at 75
Second BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions