-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
base: main
Are you sure you want to change the base?
drivers: sensor: icm42670: supports icm42670-P and icm42670-S #71374
Conversation
Hello @afontaine-invn, and thank you very much for your first pull request to the Zephyr project! |
c22caff
to
e45513b
Compare
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, check Zephyr contribution guidelines. There seem to be PDFs and binary files in 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.
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.
.../invn.algo.sw-integration.aml-42670s-gcc-arm-none-eabi-cm4-fpu-1.6.0/include/invn_algo_aml.h
Outdated
Show resolved
Hide resolved
.../invn.algo.sw-integration.aml-42670s-gcc-arm-none-eabi-cm4-fpu-1.6.0/include/invn_algo_aml.h
Outdated
Show resolved
Hide resolved
e45513b
to
30399c8
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. |
Hi @teburd, @carlescufi, thank you very much for your review! You point many subjects to address, Find my answers below:
|
e3c9a40
to
61896e5
Compare
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.
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
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 updated the DT bindings with default description as required.
61896e5
to
a65d60c
Compare
|
||
power-mode: | ||
type: string | ||
default: "low noise" |
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.
missing justification
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 for the comment. I added the default value justification for this property also.
a65d60c
to
ed01c24
Compare
I opened an issue to create the tdk_hal repository #71561 |
Sensor WG 04/22/2024 Asked the question around pros/cons of using sensor vendor supplied HALs: Pros:
Questions Posed (Potential Cons):
|
Hi @teburd , |
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 |
9e9bdcd
to
8a24001
Compare
Hi @nashif , as I understand the tests don't pass because of a missing test in CMakelist in hal_tdk, meaning part of the files are included. zephyrproject-rtos/hal_tdk#1. How can I push this change? |
8a24001
to
a86f279
Compare
Hi @ubieda , as I understand the tdk_hal module I added breaks the test. I would like to fix it zephyrproject-rtos/hal_tdk#1. Could you help reviewing it to unlock the build in this PR? |
9380579
to
a86f279
Compare
7ef6c0f
to
4918388
Compare
Hi @gmarull , the PDF and binary files has been removed, could you have a look at this PR now? Thanks |
enum: | ||
- "low noise" | ||
- "low power" |
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.
no spaces in enums please
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 replaced space by -
accel-filt-bw: | ||
type: int | ||
default: 180 |
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.
units?
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.
Unit is Hz, I added it in the comment.
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.
property still misses proper suffix
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 don't get your point. Which suffix is missing for accel-filt-bw?
The unit is in the comment, and it matches the other properties in the file and the other yaml files. Furthermore, I though the property name needs to be close to the field name in the datasheet (here ACCEL_UI_FILT_BW), it will be easier for the user to find out what is for.
gyro-filt-bw: | ||
type: int | ||
default: 180 | ||
description: | |
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.
units?
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.
Unit is Hz, I added it in the comment.
if (dev == NULL) { | ||
/* No such node, or the node does not have status "okay". */ | ||
printk("\nError: no device found.\n"); | ||
return NULL; | ||
} |
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.
this is impossible, build will fail if macro doesn't resolve
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.
Ok I removed it. I copied this from the bosh,bme280 example, I though it was needed.
samples/sensor/tdk_apex/VERSION
Outdated
VERSION_MAJOR = 1 | ||
VERSION_MINOR = 0 | ||
PATCHLEVEL = 0 | ||
VERSION_TWEAK = 0 | ||
EXTRAVERSION = |
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.
??
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 removed the VERSION files. I though these VERSION files were recommended, but I misunderstood the guidelines.
samples/sensor/tdk_apex/src/main.c
Outdated
if (dev == NULL) { | ||
/* No such node, or the node does not have status "okay". */ | ||
printk("\nError: no device found.\n"); | ||
return NULL; | ||
} |
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
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.
Ok I removed it.
4918388
to
9a7fa88
Compare
Hi @gmarull , I did the changes you requested. Could you update the changes requested status if it's ok for you? |
4f822b8
to
f4b66d5
Compare
Hello @gmarull |
6DOF Motion Dataready: | ||
############################################ |
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.
wrong formatting
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 updated both README for 6dof_motion_drdy and tdk_apex samples.
compatible = "nordic,nrf-uarte"; | ||
status = "okay"; |
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.
why is this needed?
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.
You are right, this is not needed. This is already set in nrf52dk DT, I removed this for both i2c and spi overlay.
samples/sensor/tdk_apex/Kconfig
Outdated
# Enable APEX features support for the IMU device selected | ||
config TDK_APEX | ||
default y |
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.
this is not a defconfig file, please, use prj.conf
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.
Ok, I moved this to the prj.conf file
b8fd338
to
e036f89
Compare
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, variant S support, and apex features. 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>
e036f89
to
7312cfe
Compare
Thanks for your comments @pdgendt , it was pertinent and I'm happy with the new version with more options in device tree. |
https://github.com/tdk-invn-oss/zephyr.hal_tdk With 6dof_motion_drdy and tdk_apex sample, 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>
7312cfe
to
1d35bd3
Compare
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