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: icm42670: supports icm42670-P and icm42670-S #71374

Conversation

afontaine-invn
Copy link
Collaborator

@afontaine-invn afontaine-invn commented Apr 11, 2024

dts: supports icm42670-P/-S
samples: sensor: tdk_apex: TDK APEX generic sample
samples: sensor: 6DOF motion DRDY generic sample
module: HAL TDK module

Adds official TDK Invensense Inc. driver in TDK HAL module for icm42670-P/-S sensor.
Adds SPI and I2C interface support.
Adds APEX features, such as Pedometer, Tilt detection, Wake on Motion
and Significant Motion Detector.
Add generic samples supporting this driver.
Integration module test successful with https://github.com/tdk-invn-oss/zephyr.hal_tdk
Validated with custom setup: nrf52dk_nrf52832 + icm42670-P/-S EVB board
Build ok by running:
west twister -T samples\sensor\tdk_apex-T samples\sensor\6dof_motion_drdy -p nrf52dk/nrf52832

Signed-off-by: Aurelie Fontaine aurelie.fontaine@tdk.com

@zephyrbot zephyrbot added area: Devicetree Binding PR modifies or adds a Device Tree binding area: Samples Samples area: Sensors Sensors labels Apr 11, 2024
Copy link

Hello @afontaine-invn, 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. 😊

Copy link
Member

@gmarull gmarull left a comment

Choose a reason for hiding this comment

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

please, check Zephyr contribution guidelines. There seem to be PDFs and binary files in this PR.

Copy link
Collaborator

@teburd teburd left a comment

Choose a reason for hiding this comment

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

An initial pass here (and this is large so I'll need time to look at it again) with some high level notable comments but...

I love that this is being submitted as a PR from you, with a TDK email address. I hope this is just the first of many to be frank.

That said there's some issues that will need to be addressed. Blobs are problematic, pdf's are problematic, rewriting the register map but not using the zephyr macros for describing masks and manipulating fields seems like a step backwards. Using the existing trigger API requiring a thread or work queue also feels like a step backwards, but that's not on you.

Is the code under the imu directory here something from a TDK software devkit? If so it might be worth considering looking at how ST packages and uses stmemsc for ST sensor drivers. It does not need to live or be managed then by Zephyr but can be managed entirely but TDK in something like a hal_tdk git repository.

@afontaine-invn afontaine-invn force-pushed the TDK_Invensense_ICM42670_Support_S branch from e45513b to 30399c8 Compare April 11, 2024 15:02
@carlescufi
Copy link
Member

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.

@afontaine-invn
Copy link
Collaborator Author

afontaine-invn commented Apr 15, 2024

Hi @teburd, @carlescufi, thank you very much for your review! You point many subjects to address, Find my answers below:

  • Regarding PDF and blobs I'll remove it for now. We though exposing the AML library (featuring pointing, gesture recognition, ...) but it seems not feasible and compatible with Zephyr rules.

  • Regarding the trigger API requiring a thread or work queue I kept it configurable by KConfig and I kept the option to not configure any trigger. I can put it as default.

  • Regarding the possibility to use a hal_tdk git repository to put the imu driver directory, we look at how st handles it with @gjabouley-invn and we'll like the idea. Could you give us more details on how to put it in place? And if there is any rules or guidelines to manage it over the time?

  • And just as you know I'm not the only one to push with a TDK address lately, @rbuisson-invn also updated ICP drivers with official ones. Find the PR driver: sensor: icp101xx: adds driver and sample #69282

@afontaine-invn afontaine-invn force-pushed the TDK_Invensense_ICM42670_Support_S branch from e3c9a40 to 61896e5 Compare April 15, 2024 15:42
decsny
decsny previously requested changes Apr 15, 2024
Copy link
Member

Choose a reason for hiding this comment

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

any DT binding property with a default value needs justification of the default value in the description https://docs.zephyrproject.org/latest/build/dts/bindings-upstream.html

Copy link
Collaborator Author

@afontaine-invn afontaine-invn Apr 18, 2024

Choose a reason for hiding this comment

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

I updated the DT bindings with default description as required.

@afontaine-invn afontaine-invn force-pushed the TDK_Invensense_ICM42670_Support_S branch from 61896e5 to a65d60c Compare April 18, 2024 15:13

power-mode:
type: string
default: "low noise"
Copy link
Member

Choose a reason for hiding this comment

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

missing justification

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the comment. I added the default value justification for this property also.

@afontaine-invn afontaine-invn force-pushed the TDK_Invensense_ICM42670_Support_S branch from a65d60c to ed01c24 Compare April 22, 2024 09:49
@afontaine-invn
Copy link
Collaborator Author

afontaine-invn commented Apr 22, 2024

I opened an issue to create the tdk_hal repository #71561

@teburd
Copy link
Collaborator

teburd commented Apr 22, 2024

Sensor WG 04/22/2024

Asked the question around pros/cons of using sensor vendor supplied HALs:

Pros:

  • Potentially more vendor involvement, with more drivers being pushed to the tree

Questions Posed (Potential Cons):

  • Unclear how much benefit the HAL provides, e.g. abstracting bus reads/writes is already doable within Zephyr today.
  • Unclear how the maintainer burden increases when using HALs, who maintains this code long term and moves it forward as sensor APIs evolve and change.
  • Unclear how we move this code to the asynchronous sensor_read API which is the future of sensors to better support more use cases

@decsny decsny dismissed their stale review April 22, 2024 16:17

addressed

@afontaine-invn
Copy link
Collaborator Author

Hi @teburd ,
Thanks for the updates on the tdk_hal repository issue.
Are there any blocking points or any changes expected to move forward with the PR?

@teburd
Copy link
Collaborator

teburd commented Apr 25, 2024

Hi @teburd , Thanks for the updates on the tdk_hal repository issue. Are there any blocking points or any changes expected to move forward with the PR?

No blocking issues from me no, I expect the TSC will likely approve hal_tdk barring any major concerns, and then this can go in with the tdk hal code removed. I'd expect some more progress in a week or so as the TSC meets weekly, and our sensor maintainer (Maureen Helm at Analog) is traveling this week

@afontaine-invn afontaine-invn force-pushed the TDK_Invensense_ICM42670_Support_S branch from 6a42d21 to 357036d Compare November 14, 2024 13:29
@sriccardi-invn
Copy link

HI @MaureenHelm,
Any update on the MR ?
The branch is opened since a lot of time with different reviewers. My team consume is time to rebase everytime.
Do you think we could converge?
We have already a lot of sensor drivers ready to be integrated in tdk_hal.
Thanks.
Regards,
Sebastien Riccardi

@tomi-font tomi-font added the dev-review To be discussed in dev-review meeting label Nov 22, 2024
 https://github.com/tdk-invn-oss/zephyr.hal_tdk

Signed-off-by: Aurelie Fontaine <aurelie.fontaine@tdk.com>
MaureenHelm
MaureenHelm previously approved these changes Dec 4, 2024
@MaureenHelm MaureenHelm removed the DNM This PR should not be merged (Do Not Merge) label Dec 4, 2024
Prepare to use official TDK Invensense Inc. driver for icm42670-P/-S
sensor in tdk_hal module. Simplify I2C and SPI transport files.
Driver code moves in hal_tdk module.
Adds APEX features, such as Pedometer, Tilt detection, Wake on Motion
and Significant Motion Detector.

Signed-off-by: Aurelie Fontaine <aurelie.fontaine@tdk.com>
Add the power mode, accel and gyro filtering options,
 and apex features. Add -p and -s compatible.

Signed-off-by: Aurelie Fontaine <aurelie.fontaine@tdk.com>
It reports IMU 6-axis accelerometer and gyroscope data
using DRDY interrupt.

Signed-off-by: Aurelie Fontaine <aurelie.fontaine@tdk.com>
It reports Advanced Pedometer and Event Detection features,
such as Pedometer, Tilt detection, Wake on Motion and
Significant Motion Detector. Device tree options.

Signed-off-by: Aurelie Fontaine <aurelie.fontaine@tdk.com>
Update i2c and spi dtsi test to comply with new compatible icm42670p.

Signed-off-by: Aurelie Fontaine <aurelie.fontaine@tdk.com>
@afontaine-invn afontaine-invn force-pushed the TDK_Invensense_ICM42670_Support_S branch from 357036d to 5a1c846 Compare December 6, 2024 09:51
@zephyrbot zephyrbot added the DNM This PR should not be merged (Do Not Merge) label Dec 6, 2024
@afontaine-invn
Copy link
Collaborator Author

Hello @MaureenHelm , Thanks for the approval, we're happy to achieve this step!
I rebased this PR and resolved the conflict in icm42670.c file. Could you approve again and remove the DNM and dev-review label in order to be able to merge?

@sriccardi-invn
Copy link

HI @MaureenHelm ,
I am affraid by the delay to merge a branch.
Everytime we wait, some change have beed done an another side, we have ro rebase, wait a new validation.
This is infinite.
We have a lot of sensors driver ready to be integrated waiting this first merge.
Do you have or see any remaining issue on your side?
Thanks.
Regards,
Sebastien Riccardi

@teburd teburd removed the DNM This PR should not be merged (Do Not Merge) label Dec 17, 2024
@kartben kartben removed the dev-review To be discussed in dev-review meeting label Dec 18, 2024
@kartben
Copy link
Collaborator

kartben commented Dec 18, 2024

Thank you for your patience @afontaine-invn @sriccardi-invn and team, and sorry this took so long. This will go in with the next merge batch in just a couple hours.

@kartben kartben merged commit e12b23d into zephyrproject-rtos:main Dec 18, 2024
27 of 30 checks passed
Copy link

Hi @afontaine-invn!
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! 🪁

@pdgendt
Copy link
Collaborator

pdgendt commented Dec 18, 2024

Every build now prints:

CMake Warning at /home/pdgendt/zephyrproject/zephyr/CMakeLists.txt:996 (message):
  No SOURCES given to Zephyr library: ..__modules__hal__tdk

  Excluding target from build.

@pdgendt
Copy link
Collaborator

pdgendt commented Dec 18, 2024

Created #83151 to get rid of the warning.

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

Successfully merging this pull request may close these issues.