Whatever is written to the register 0x41 ACC_RANGE I always get 1G readings around 4100 LSB so 8G range (default).
The register was set either by API configuration like:
config.cfg.acc.range = BMI2_ACC_RANGE_2G;
or directly by code:
const uint8_t byte0x03 = 0x03; // 16G range
bmi2_set_regs(0x41, &byte0x03, 1, &bmi2);
- no difference. The register is read by:
bmi2_get_regs(0x41, reg_data, 1, &bmi2);
Serial.print("Read 0x41 ACC_RANGE HEX (0x00 = 2g) = "); Serial.print(reg_data, HEX);
after accelerometer readings and it corresponds to what I write, like 0x00, 0x03, so no way 0x41 ACC_RANGE is reset to default somewhere in code. But raw readings for accelerometer data for 1G never change. Tried two BMI270 boards - no difference.
Any ideas how can it be possible?
Solved! Go to Solution.
The example on GitHub works well. I think you can refer to the example program to check whether each step is successful, and then check whether the acceleration data is normal.
I use Arduino IDE, API you pointed out does not work there as I understand, so I used BMI270_COINES_SPI_Accel_Gyro
It didn't compile at first so I had to make many changes to get it working, had to adopt to I2C bus and ESP32 controller. But as I understand, COINES is essentially the same code as the library in your link, just adopted for Arduino, right? It is what I use to communicate with BMI270.
Oops! I just tried my previous code described above and it really shows correct acceleration, so it is after my later implementation of it into a more complicated code when problem starts. Great, now I have a starting point. Thanks very much for a clue.