IMU-BNO055 problem to set offsets and radius for calibration after PoR

I experience some trouble trying to reuse the calibration profile with the BNO055. I’m using the evaluation board from adafruit with an Arduino Uno. I’m able to read the offsets and radius registers, then to save into the EEPROM of the ATmega328P and to load it afterwards. Nevertheless, it doesn’t always work when I try to restore these values into the registers after reboot.

I wrote a very simple code for expressing my problem, I initialise the sensor, then a just read the offsets registers (from 0x55 to 0x6A) once, then I restore the offset with 2 arrays (not in the same time, two differents to see the difference) I just defined in the setup function and then I read again the offsets registers to check if they have been correctly updated. These two arrays are:

byte Array1[NUMBER_OF_OFFSET_REGISTERS]={236,255,187,255,221,255,0,0,0,0,0,0,255,255,254,255,254,255,232,3,224,1};
byte Array2[NUMBER_OF_OFFSET_REGISTERS]={194,204,161,204,224,255,0,0,0,0,0,0,101,102,229,229,254,255,232,3,224,1};

My problem is that it works perfectly with the first Array, but with the second one the values are not correctly stored in the registers! How could it happen since the format is exactly the same? Are there some restrictions about the values allowed to be written in these registers?

I spent days being stuck on that problem, if someone can provide me an explanation I would be very grateful. I attached the code if someone wants to check.

Thank you in advance,

bosh_test_setoffset.ino (5.66 KB)

Why do you want to set the offsets twice? I do that once at startup and move on.

The automatic calibration continues to run in the background anyway, and little information is available about how it works (which is: not very well).

The entire setup is pretty unsatisfactory, so I gave up on that sensor. The Pololu AltIMU series vastly outperforms the BNO005, with decent calibration and AHRS software.