Skip to content

Trying to work with a BNO085 IMU via I2C using Adafruit unified sensor library #1324

Answered by mukyokyo
JakesWorkshop asked this question in Q&A
Discussion options

You must be logged in to vote

I'm able to connect BNO085 to Pico's i2c and operate it using ceva's drivers.

I had a little trouble treating the i2c reception, but solved the problem by reading the 4-byte header containing the data size and then reading all the data at that size.

int IIC_Receive(uint8_t addr, uint8_t *dat, int buflen) {
  int result = 0;
  TSHTPHeader *h = (TSHTPHeader *)(void *)dat;
  int l = i2c_read_blocking(i2c0, addr, dat, 4, false);
    l = h->Length & ~0x8000;
  if (l > 0 && l <= buflen) {
    l = i2c_read_blocking(i2c0, addr, dat, l, false);
    if (l > 0) {
      l = h->Length & ~0x8000;
      if (l > 0) result = l;
    }
  }
  return result;
}

The data update cycle depends on the i2c bus spee…

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
6 replies
@jamescarruthers
Comment options

@mukyokyo
Comment options

@LazaroFilm
Comment options

@jamescarruthers
Comment options

@jamescarruthers
Comment options

Answer selected by JakesWorkshop
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants