Skip to content

Conversation

@Concode0
Copy link
Contributor

Description

Added Fast Offset Compensation (FOC) and Component Re-Trim (CRT) calibration
features to the BMI270 inertial measurement unit driver. These features provide
hardware-level offset and sensitivity calibration for both accelerometer and
gyroscope sensors.

Motivation and Context

BMI270 sensors experience manufacturing tolerance variations that affect
measurement accuracy. The built-in calibration features compensate for:

  • Accelerometer offset: Systematic bias in acceleration readings
  • Gyroscope offset: Drift and bias in angular rate measurements
  • Gyroscope sensitivity: Gain variations due to component tolerances and temperature effects

But espp/bmi270 doesn't support these feature.

Tested and verified against Bosch Sensortec's official BMI270 Sensor API library
implementation.

How has this been tested?

Using my esp32c3 based imu board, change example codes with calibration example.

Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):

[BMI270 Example/I][0.306]: Starting example!
[BMI270 Example/I][0.316]: Found BMI270 at address: 0x68
[Bmi270/I][0.316]: Setting low power mode to disabled
[Bmi270/I][0.326]: Loading BMI270 configuration file (8192 B), this may take some time...
[Bmi270/I][0.546]: Configuration file loaded successfully
[Bmi270/I][0.546]: BMI270 initialized successfully
[BMI270 Example/I][0.546]: Performing Accelerometer FOC...
[Bmi270/I][4.396]: Accel FOC completed. Offsets: X=-10, Y=9, Z=2
[BMI270 Example/I][4.396]: Accelerometer FOC completed successfully
[BMI270 Example/I][4.396]: Performing Gyroscope FOC...
[Bmi270/I][10.806]: Gyro FOC completed. Offsets: X=-2, Y=-1, Z=0
[BMI270 Example/I][10.806]: Gyroscope FOC completed successfully
[BMI270 Example/I][10.806]: Performing CRT...
[Bmi270/I][10.856]: CRT: After setup GYR_CRT_CONF=0x05, bit3(rdy_for_dl)=0
[Bmi270/I][10.876]: CRT: Iter[0] GYR_CRT_CONF=0x05, bit3=0
[Bmi270/I][11.056]: CRT: Iter[9] GYR_CRT_CONF=0x05, bit3=0
[Bmi270/I][11.256]: CRT: Iter[19] GYR_CRT_CONF=0x05, bit3=0
[Bmi270/W][14.856]: CRT: Ready for Download bit didn't toggle - may still continue
[Bmi270/I][14.916]: CRT: Completion detected at iteration 0
[Bmi270/I][14.916]: CRT completed successfully
[BMI270 Example/I][14.916]: CRT completed successfully

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Hardware (schematic, board, system design) change
  • Software change

Checklist:

  • My change requires a change to the documentation.
  • I have added / updated the documentation related to this change via either README or WIKI

Software

  • I have added tests to cover my changes.
  • I have updated the .github/workflows/build.yml file to add my new test to the automated cloud build github action.
  • All new and existing tests passed.
  • My code follows the code style of this project.

@github-actions
Copy link

✅Static analysis result - no issues found! ✅

@Concode0 Concode0 force-pushed the feature/bmi270-foc-crt branch from 7ccbcf2 to f4e0119 Compare January 30, 2026 10:31
@Concode0 Concode0 changed the title Implement FOC and CRT calibration features for bmi270 feat(bmi270): Implement FOC and CRT calibration features for bmi270 Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant