I try to use a BMI055 Acclerometer and the output is driving me crazy.
I have set it to 2G sensitivity at 1000Hz, that means I have an output between 0 and 4096 (12bit).
The output is said to be two complemented, so I expect 2048 to be 0G
The sensor is set up to be as flat as possible using gauges.
Now I am asking it in a loop for it's FIFO data (1 frame bypass fifo) which returns me 6 bytes .
According to datasheet: LSB X MSB X LSB Y MSB Y LSB Z MSB Z
LSB X needs to be right shifted 4 times and ORd with MSB X which is left shifted 4 times.
So I receive a 12 bit numer.
Just analyzing the X values shows that MSB X is jumping between 0 and 255 !
Code:
temp[0]=(result[1]<<4) | ((result[0])>>4);
This shows LSB MSB 12BIT-unsigned
Data X: 1 0 0
Data X: 85 255 4085
Data X: 201 255 4092
Data X: 201 255 4092
Data X: 221 255 4093
Data X: 157 0 9
Data X: 49 0 3
Data X: 181 255 4091
Data X: 229 255 4094
Data X: 17 0 1
Data X: 161 255 4090
Data X: 117 255 4087
Data X: 221 255 4093
Data X: 5 0 0
Data X: 209 255 4093
It should return me 2048 as X is at 0G.
4096 would be 2G force.
0 would be -2G force.
When putting X on -1G and +1G the values seem to be correct (1000 and 3000).
Just the center 0G is at 0/4000 depending on minor vibrations instead of the expected 2046-2049
It is 4 in the morning, I guess I oversee something very critical. Enlightment please
if (x >= 2048) x = x - 4096
. \$\endgroup\$