03-27-2022 12:06 PM
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[0], 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.
03-27-2022 02:51 PM
Hi Anatol,
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.
https://github.com/BoschSensortec/BMI270-Sensor-API
03-29-2022 07:22 AM
Hi BSTRobin.
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.
03-29-2022 08:58 AM
Hi Anatol,
Our reference code sensor API was written in C language, which is different from Arduino. However, it could be migrated to different platform, and the Coins interface can be replaced with the interface of Arduino platform.
03-29-2022 11:46 AM
Yes, I did it already. But I'm still puzzled how can readings from acc_range register be not in accordance with the actual LSB/g value.