-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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: sensors: bmi270: Add CRT feature support #63015
base: main
Are you sure you want to change the base?
Conversation
Hello @peter-axe, and thank you very much for your first pull request to the Zephyr project! A project maintainer just triggered our CI pipeline to run it against your PR and ensure it's compliant and doesn't cause any issues. You might want to take this opportunity to review the project's Contributor Expectations and make any updates to your pull request if necessary. 😊 |
b395c53
to
239edf0
Compare
Thanks for 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. |
36915e6
to
c927cf5
Compare
Hi @carlescufi, However, something broke the pipeline/git action, and seems unrelated with my changes:
|
c927cf5
to
2d5c60d
Compare
drivers/sensor/bmi270/Kconfig
Outdated
@@ -62,4 +62,10 @@ config BMI270_THREAD_STACK_SIZE | |||
help | |||
Stack size of thread used by the driver to handle interrupts. | |||
|
|||
config BMI270_CRT | |||
bool "CRT feature support for bmi270" | |||
default n |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bools are default n unless specified otherwise, so this line can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @MaureenHelm fixed in: f3c4d22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please amend the commit where it's introduced instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed @MaureenHelm , last commit was removed and the commits where the feature was introduced where ammended instead.
drivers/sensor/bmi270/Kconfig
Outdated
bool "CRT feature support for bmi270" | ||
default n | ||
help | ||
Gyro CRT calibration feature support for bmi270 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please expand the CRT acronym
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @MaureenHelm fixed in: f3c4d22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please amend the commit where it's introduced instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed @MaureenHelm , last commit was removed and the commits where the feature was introduced where ammended instead.
drivers/sensor/bmi270/bmi270_crt.c
Outdated
BMI270_CRT_TRIGGER_STAT_DL_ERR = 0x02, | ||
/*Command is aborted by host or due to motion detection*/ | ||
BMI270_CRT_TRIGGER_STAT_ABORT_ERR = 0x03 | ||
} GTriggerStatus; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please no camel case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @MaureenHelm fixed in: f3c4d22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please amend the commit where it's introduced instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed @MaureenHelm , last commit was removed and the commits where the feature was introduced where ammended instead.
#define BMI270_GYR_GAIN_DIS 0x00 | ||
|
||
/* Helper Macros for setting gyro gain compensation */ | ||
#define SENSOR_VALUE_WITH_GAIN(var_name, gain_value) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These seem to be BMI270 specific helper macros without any prefix to them which might lead to some confusion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, fixed them in latest rebase, thanks!
BMI270_CRT_TRIGGER_STAT_DL_ERR = 0x02, | ||
/*Command is aborted by host or due to motion detection*/ | ||
BMI270_CRT_TRIGGER_STAT_ABORT_ERR = 0x03 | ||
} gtrigger_status; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this typedef really needed or can it be used directly as an enum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The typedef is needed, it's being used in the bmi2_gyr_user_gain_status struct to define the G trigger status data, and as the argument type of the helper method to LOG CRT cmd status.
* Describes the saturation status for the gyroscope gain | ||
* update and G_TRIGGER command status | ||
*/ | ||
struct bmi2_gyr_user_gain_status { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this struct used from an application, I see it in the private driver bmi270.h header as a member but its unclear how this is used outside of the driver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The structure goes into the device data structure in order for the the driver to keep track of CRT test status and results for a specific device. On the application side, one can only access the compensated user-gain data of gyroscope converted into sensor_value type, through the generic zephyr's sensors API call, e..g
sensor_attr_get(dev, SENSOR_CHAN_GYRO_XYZ, SENSOR_ATTR_CALIBRATION, &usr_gain)
}; | ||
|
||
/** @name Structure to store the compensated user-gain data of gyroscope */ | ||
struct bmi2_gyro_user_gain_data { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as above really, its unclear to me how this might be used in an application as its being placed in a public header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
asnwered here #63015 (comment)
f3c4d22
to
af4ac22
Compare
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
Hi @MaureenHelm can you please remove the stale label of this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@avisconti please revisit
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
Please remove the stale label. @avisconti Can you please revisit? |
Issue: #62514
Description
This PR integrates enhancements to the existing bmi270 driver by introducing support for the Component Retrimming (CRT) calibration feature. This is achieved through the incorporation of a new module for the CRT calibration process and ensuring its seamless integration with the existing functionalities of the bmi270 driver.
drivers: sensors: bmi270:Add CRT support to sensor_attr_set:
Allows the bmi270 CRT feature methods to be called through Zephyr's sensor api. Using the sensor_attr_set function, with the following args:
-SENSOR_ATTR_CALIBRATION-run the crt.
-BMI270_SENSOR_ATTR_NVM_PROG-save the CRT results in nvm.
-BMI270_SENSOR_ATTR_GAIN_COMP-enable/disable gain compensation.
drivers: sensors: bmi270:Add CRT support to sensor_attr_get:
Usage
CONFIG_BMI270_CRT=y
This was introduced in a previous PR drivers: sensor: bmi270: Add support for motion, DRDY triggers #55275 in order to download the bmi270 feature blob, that allows using bmi270 features, such as CRT.
e.g.:
For additional info, please consult the specific function doxygen documentation.
e.g. test :
Tests