10-25-2023 12:20 AM
Hello all,
I modified the bmi270 api accel examples to make it work in STM32F205 and successfully read the accel data,
but with problems that:
1) The accelerometer data is out by factor of 4
x=0.02 m/ss
y=2.37 m/ss (anticipate it close to 1G, 9.8m/ss)
z=-0.4 m/ss
2) Changing the range made no difference to the data (double checked Register (0x41) ACC_RANGE and sure the change was wrote the register correctly)
During my self debug, I narrow down the problem is getting BMI2_E_ACC_INVALID_CFG error in set_accel_config()
But I got all BMI2_OK in other settings and BMI2_E_ACC_INVALID_CFG error doest not tell me more details except my ACCEL configuration should have problem.
My code is mostly the accel example from BMI270-Sensor-API
https://github.com/boschsensortec/BMI270-Sensor-API/tree/master/bmi270_examples/accel
with following changes to make it work with stm32
1) redefine bmi2_interface_init() with
https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/BMI270-accel-data-anomily/td-p/15622
Unfortunately, this post does not give out the details how the problem was finally solved
11-10-2023 07:25 AM
Hi Minhwan,
Thanks for responsing!
Yes! I am using the Bosch offical API from github
I think I mistakely typed the output of register 0x40 and 0x41
My 0x40 read is 0xA9
and 0x41 read is 0x00
So, value from these 2 registers should looks OK?
I found more clues about my issue, it seems more related with the config.cfg.acc.odr setting
when I set the config.cfg.acc.odr less than
config.cfg.acc.odr = BMI2_ACC_ODR_6_25HZ;
The output is wrong and out by factor of 4.
But when I set config.cfg.acc.odr bigger than
config.cfg.acc.odr = BMI2_ACC_ODR_6_25HZ;
The output is correct
Do you have ideal what can cause this ?
Thanks!
11-27-2023 08:26 PM - edited 11-27-2023 08:27 PM
Hi Jichen,
Sorry for late response.
Your setting is not correct.
Normal mode (Performance mode is available) range is 12.5 Hz to 1600Hz.
And, 6.25 Hz or lower Hz should be set to low power mode.
You have to put "config.cfg.acc.filter_perf = BMI2_POWER_OPT_MODE;"
You can check the ODR in data sheet. 4.6.4 Accelerometer Data Processing in Normal and Performance Mode and 4.6.5 Accelerometer Data Processing in Low Power Mode.
Please accept solution if my answer is enough for your questions 🙂
Thank you.