I started to write a very small driver for the BMI088. While the gyroscope is working like expected, The accelerometer has a stange “feature”. Writing to it works fine, but reading any register gives the value of the previous read request. To read the xyz values I have to write twice to the register 0x12 to get the proper axis values like this:
spi_transfer(ACC_X_LSB_12 | 0x80); // Start register read
spi_transfer(ACC_X_LSB_12 | 0x80); // Again start register read (why ever!)
ax = spi_transfer(0xFF); ax += spi_transfer(0xFF) << 8;
ay = spi_transfer(0xFF); ay += spi_transfer(0xFF) << 8;
az = spi_transfer(0xFF); az += spi_transfer(0xFF) << 8;
With this workaround the raw values for the IMU are fine. Does anyone know why the reading result is shifted by one operation? Looks like it´s caused by the FIFO, but I don´t write anything to it. Any help is welcome. Doing almost the same with the BMI055 worked without any problems.
Greetings from Germany
Solved! Go to Solution.
For BMI088 accel, the default interface is configged as I2C, you need a dummy read of SPI to switch to SPI bus first.
Also you need a dummy byte during SPI read from the accel part.
You can refer to our BMI088 API on Github from following link:
When selecting SPI for BMI088 accelerometer, does the datasheet indicate that the user has an option between toggling the PS pin and sending a dummy read or do both need to be done? It's not clear.