12-06-2022 03:47 PM - edited 12-06-2022 03:48 PM
Hello, I'm trying to add the ability to perform manual SENS error calibration to a 3rd party BMI270 driver I wrote myself. But when I write the 11-bit FxP data to GYR_GAIN_UPD_1 GYR_GAIN_UPD2 GYR_GAIN_UPD_3, BMI270 seems to lose its response.
The specific driver code can be found here: https://github.com/flightng/atbetaflight/blob/add-gyro-scaler-calibrator/src/main/drivers/accgyro/ac...
Given that tech support probably won't look at my driver code, in this case I'd like to know:
- What is the correct timing/sequence to perform a manual SENS error calibration? In what order should I step through the registers?
- When writing 16-bit data to any single register at address 0x34 - 0x3A, should the high or low bits of the 16-bit data be sent first?
12-11-2022 11:07 AM
Hi DusKing,
You can refer to "Manual SENS Error Compensation" process described in BMI270 data sheet in Section 4.14 to configure registers, or refer to the code implementation of the following code in the sensor API.
int8_t bmi2_set_sensor_config(struct bmi2_sens_config *sens_cfg, uint8_t n_sens, struct bmi2_dev *dev)
{
...
/* Set gyroscope user gain configuration */
case BMI2_GYRO_GAIN_UPDATE:
rslt = set_gyro_user_gain_config(&sens_cfg[loop].cfg.gyro_gain_update, dev);
break;
...
}
12-22-2022 09:19 AM - edited 12-22-2022 09:22 AM
Thank you for your reply. I carefully checked the data sheet and SDK, I think my problem may mainly appear in the read and write timing of these 16-bit registers. Suppose I want to write a 16-bit data to 0x3A by 4-wire SPI interface, the high half bit is H and the low half is L, so which of the following is the correct writing sequence?
- W3A+H+L
- W3A+L+H
Similarly, which should the correct reading sequence for the same 16-bit register?
- R3A+Dummy+H+L
- R3A+Dummy+L+H
Looking forward to your reply
01-31-2023 02:36 AM
Hi DusKing,
According BMI270 SPI part description, you need to configure host SPI timing with '00' or '11' mode.