Adding functionality to the MKRIMU library

Hi everyone,
I'm trying to add some functionality to the MKRIMU library.
essentially this library lacks all aspects relating to the calibration of the BNO055 sensor (for which the library was written).
the library is very simple, it uses I2C and simple Wire commands to read the sensor registers.
I would like to implement the ability to read the values in the calibration register and be able to read the offset values that are generated after calibration (so that I can load them at each startup).
I leave you all the documentation and the test program that I'm trying to use to read the data.
I can't figure out how to split the values read within the register basically.

#include <Wire.h>
#define BNNO055_ADDRESS                0x28
#define BNNO055_CHIP_ID_REG            0x00
#define BNNO055_ACC_DATA_X_LSB_REG     0x08
#define BNNO055_MAG_DATA_X_LSB_REG     0x0e
#define BNNO055_GYR_DATA_X_LSB_REG     0x14
#define BNNO055_EUL_DATA_X_LSB_REG     0x1a
#define BNNO055_PAGE_ID_REG            0x07
#define BNNO055_TEMP_REG               0x34
#define BNNO055_SYS_STATUS_REG         0x39
#define BNNO055_UNIT_SEL_REG           0x3b
#define BNNO055_OPR_MODE_REG           0x3d
#define BNNO055_SYS_TRIGGER_REG        0x3f
#define BNNO055_AXIS_MAP_CONFIG_REG    0x41
#define BNNO055_AXIS_MAP_SIGN_REG      0x42

//0x28

void setup() {
  // put your setup code here, to run once:
  Wire.begin();
  
  Serial.begin(9600);

  // enter config mode
  Wire.beginTransmission(BNNO055_ADDRESS);
  Wire.write(0x3d);
  Wire.write(0x00);
  delay(100);
  // select page id 0
  Wire.beginTransmission(BNNO055_ADDRESS);
  Wire.write(BNNO055_PAGE_ID_REG);
  Wire.write(0x00);
  delay(100);
  // enable external clock
  Wire.beginTransmission(BNNO055_ADDRESS);
  Wire.write(BNNO055_SYS_TRIGGER_REG);
  Wire.write(0x80);
  delay(100);
  // set acceleration unit to mG's, and fusion data output mode to Android
    Wire.beginTransmission(BNNO055_ADDRESS);
  Wire.write(BNNO055_UNIT_SEL_REG);
  Wire.write(0x81);
  delay(100);
  // set X = X, Y = Y, Z = Z
  Wire.beginTransmission(BNNO055_ADDRESS);
  Wire.write(BNNO055_AXIS_MAP_CONFIG_REG);
  Wire.write(0x24);
  delay(100);

  // invert X and Y axis signs

  Wire.beginTransmission(BNNO055_ADDRESS);
  Wire.write(BNNO055_AXIS_MAP_SIGN_REG);
  Wire.write(0x06);
  delay(100);
  // enter NDOF mode
   Wire.beginTransmission(BNNO055_ADDRESS);
  Wire.write(BNNO055_OPR_MODE_REG);
  Wire.write(0x0c);
delay(100);

}

void loop() {

  readIMU();

  delay(100);

}




void readIMU(){
  Wire.beginTransmission(BNNO055_ADDRESS);
  Wire.write(0x35);
  Wire.endTransmission(false);

  Wire.requestFrom(BNNO055_ADDRESS,8);

 if (Wire.available()) {
 uint16_t data [8];
  for (int i; i< sizeof(data); i++) {
data[i]=Wire.read();
  Serial.print(data[i]);
  }

    Serial.println("");
  }else return;

  
  delay(1);

}

DATASHEET
MKRIMU Lib

calibration log to read:
Uploading: Screenshot 2023-11-02 alle 11.07.23.png…
page 56 of datasheet

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.