Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: sensor: bmi08x: fix temperature interface and trigger setting #82405

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

ttwards
Copy link
Contributor

@ttwards ttwards commented Dec 2, 2024

  1. Temperature Interface
    According to BMI08x datasheet, temperature reading
    requires both MSB and LSB bytes to be read and
    processed correctly.

Temp data processing should follow the formula:
Temp in °C = (temp_msb * 8) + (temp_lsb / 32)

This patch implements the correct reading
sequence and calculation method as specified
in the datasheet.

  1. Trigger Setting
    Previously we set handler and then trigger struct.
    However under some situation, as long as we set
    the handler, we get into ISR immediately and never
    set trigger struct.
    I simply changed the sequence.

Testing:

  • Verified temperature readings match datasheet
  • Tested on stm32f407igh board with BMI08x sensor

Datasheet:
截屏2024-12-01 16 21 40
截屏2024-12-01 16 21 59

@ttwards
Copy link
Contributor Author

ttwards commented Dec 3, 2024

Code Lints and commit lints are fixed, please check again

@XenuIsWatching
Copy link
Member

XenuIsWatching commented Dec 6, 2024

remove the merge commit, you must always rebase, and this should all only be 1 commit

@ttwards ttwards force-pushed the fix-bmi08x-sensor-driver branch from 4ff0197 to 0e2d95d Compare December 9, 2024 03:13
@ttwards
Copy link
Contributor Author

ttwards commented Dec 9, 2024

remove the merge commit, you must always rebase, and this should all only be 1 commit

I've removed, thank you.

@ttwards ttwards force-pushed the fix-bmi08x-sensor-driver branch 2 times, most recently from 16c07a2 to 774add6 Compare December 9, 2024 05:45
Copy link
Member

@XenuIsWatching XenuIsWatching left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix the compliance issues

@ttwards ttwards force-pushed the fix-bmi08x-sensor-driver branch from 774add6 to 1c6d69e Compare December 10, 2024 06:30
XenuIsWatching
XenuIsWatching previously approved these changes Dec 10, 2024
@ttwards
Copy link
Contributor Author

ttwards commented Dec 13, 2024

Hmmmm, can anybody please tell me why there are 4 pending checks still...?

@kartben
Copy link
Collaborator

kartben commented Dec 13, 2024

Hmmmm, can anybody please tell me why there are 4 pending checks still...?

A maintainer needs to kick the CI manually for contributions coming from new contributors. I just did :) thanks!

XenuIsWatching
XenuIsWatching previously approved these changes Dec 13, 2024
XenuIsWatching
XenuIsWatching previously approved these changes Dec 26, 2024
ubieda
ubieda previously approved these changes Dec 31, 2024
@ubieda
Copy link
Member

ubieda commented Dec 31, 2024

Thanks for your contribution!

@XenuIsWatching
Copy link
Member

@MaureenHelm Please review

Copy link
Collaborator

@avisconti avisconti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but just few suggestions to improve the code

drivers/sensor/bosch/bmi08x/bmi08x_accel.c Show resolved Hide resolved
drivers/sensor/bosch/bmi08x/bmi08x_accel.c Show resolved Hide resolved
drivers/sensor/bosch/bmi08x/bmi08x_accel.c Show resolved Hide resolved
drivers/sensor/bosch/bmi08x/bmi08x_accel.c Show resolved Hide resolved
@ttwards ttwards dismissed stale reviews from ubieda and XenuIsWatching via 47d9e45 January 9, 2025 10:20
@ttwards ttwards force-pushed the fix-bmi08x-sensor-driver branch from d66b23f to 47d9e45 Compare January 9, 2025 10:20
avisconti
avisconti previously approved these changes Jan 9, 2025
avisconti
avisconti previously approved these changes Jan 9, 2025
@avisconti
Copy link
Collaborator

Pls fix the CI

@ttwards
Copy link
Contributor Author

ttwards commented Jan 10, 2025

Pls fix the CI

Sorry for that, clang-format in my local workspace doesn't meet the zephyr project requirements very well.

avisconti
avisconti previously approved these changes Jan 10, 2025
1. Temperature Interface
According to BMI08x datasheet, temperature reading
requires both MSB and LSB bytes to be read and
processed correctly.

Temp data processing should follow the formula:
Temp in °C = (temp_msb * 8) + (temp_lsb / 32)

This patch implements the correct reading
sequence and calculation method as specified
in the datasheet.

2. Trigger Setting
Previously we set handler and then trigger struct.
However under some situation, as long as we set
the handler, we get into ISR immediately and never
set trigger struct.
I simply changed the sequence.

Testing:
- Verified temperature readings match datasheet
- Tested on stm32f407igh board with BMI08x sensor

Fixes: zephyrproject-rtos#82375

Signed-off-by: Wenxi Xu <xuwenxi0517@gmail.com>
@ttwards ttwards force-pushed the fix-bmi08x-sensor-driver branch from 6a9c8cb to 13b045b Compare January 10, 2025 09:34
@ttwards ttwards changed the title drivers: sensor: bmi08x: fix temperature data reading and processing drivers: sensor: bmi08x: fix temperature interface and trigger setting Jan 10, 2025
Copy link
Member

@ubieda ubieda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refreshing my +1

@kartben kartben merged commit a490c90 into zephyrproject-rtos:main Jan 15, 2025
26 checks passed
Copy link

Hi @ttwards!
Congratulations on getting your very first Zephyr pull request merged 🎉🥳. This is a fantastic achievement, and we're thrilled to have you as part of our community!

To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge.

Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁

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.

7 participants