Skip to content

Conversation

@felixreims
Copy link

@felixreims felixreims commented Dec 21, 2025

This PR implements the following features to the BMI323 driver:

  • Set -3dB cut-off frequency (bandwidth) for accelerometer and gyroscope respectively
  • Set number of samples to be averaged (avg_num) for accelerometer and gyroscope respectively
  • Set offset and gain for accelerometer and gyroscope respectively on each axis (x,y,z)
  • Perform self-calibration of offset and gain for gyroscope

In more detail:

  • Add option reading and writing bandwidth configuration (-3dB cut-off frequency) for accelerometer and gyroscope to ODR/2 or ODR/4. Create private sensor attribute SENSOR_ATTR_BANDWIDTH.
  • Add option for reading and writing avg_num configuration (number of samples to be averaged) for accelerometer and gyroscope. Create private sensor attribute SENSOR_ATTR_AVERAGE_NUM.
  • Add header file for extended sensor API of BMI323 (SENSOR_ATTR_BANDWIDTH and SENSOR_ATTR_AVERAGE_NUM).
  • Add options for setting offset and gain for accelerometer and gyroscope through SENSOR_ATTR_OFFSET and SENSOR_ATTR_GAIN respectively.Offset and gain are set on each axis individually. Note that the user must disable accel and gyro before updating their respective offset and gain.
  • Add option for performing self-calibration (SC) in accordance with section 5.13 in the datasheet. SENSOR_ATTR_CALIB_TARGET is used. Polling is used instead of interrupt to detect SC completion.
    Datasheet says SC takes around 430 ms, however when testing it took as little as 275 ms to complete. Current code sleeps for 250 ms, then polls for 250 ms. Configuration of motion detection threshold during SC (gyr_mot_det) is not yet implemented.
  • Update BMI323 menuconfig help to include new features: -3dB cut-off frequency, number of samples to be averaged, offset, gain and self-calibration.

@github-actions
Copy link

Hello @felixreims, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

- Add option reading and writing bandwidth configuration
- Add option for reading and writing avg_num configuration
- Add header for extended sensor api attributes
- Add options for setting offset and gain for accel and gyr
- Add option for performing self-calibration (SC).
- Update BMI323 menuconfig help to include new features.

Signed-off-by: Felix Reims <[email protected]>
@felixreims felixreims force-pushed the bosch_bmi323_calibration branch from b8a80d4 to 89ab1b5 Compare January 1, 2026 10:51
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 1, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants