-
Notifications
You must be signed in to change notification settings - Fork 8k
Enables oversampling for the Gecko IADC #95823
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
base: main
Are you sure you want to change the base?
Enables oversampling for the Gecko IADC #95823
Conversation
21fd75c
to
260de3a
Compare
Thanks @Martinhoff-maker!
I'm not sure if this is the best path. Considering the architecture overhead of single pull requests and the contributor guidelines, I consider it would be better for this small, contained and easily testable feature to be pushed to the upstream standalone first, and then your PR to be rebased on that change, avoiding implementing a new feature over the many already present in #94264. This would be better in general since revisions would be faster, stability easier to asset and the availability of the new feature sooner achieved! |
Thanks for the contribution! I have a couple of questions:
|
drivers/adc/iadc_gecko.c
Outdated
initAllConfigs.configs[0].reference = channel_config->reference; | ||
|
||
initAllConfigs.configs[0].digAvg = channel_config->digital_averaging; | ||
init.warmup = iadcWarmupKeepWarm; |
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 do you need to keep the IADC warm ? have you some delays if you do not activate this ? I'm not really in favor to keep the ADC warm by default because it will lead to a higher power consumption. It's about 5 us to warm the ADC before a conversion. On the other hand, there is nothing in the ADC API to give that kind of argument.
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.
Yep. Actually a personal take in here, was not planning on adding this to the PR itself, just slipped under my nose hahaha 😆
What you think of adding this as a DTS option? Or would be better to fully omit this and go for the defaults?
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.
If you really need it, please add it as a DT property like in the silabs_vdac driver. Otherwise, I suggest to go for the default 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.
Not really a must, and honestly I don't think it fits in this PR either, will remove it in favor of default value.
Actually did, just didn't though it to be the closest interpretation as other ADC drivers do, so I just kept with the standard "mean measure" analog of oversampling. Though it is very much appreciated to have the IADC oversampling take on this driver, being able to probe higher resolution is actually very useful in many contexts, I'm just not sure on how to approach this inside the ADC API itself. Wouldn't it be better as a separate DTS option (the higher resolution oversampling) and internally handled by the driver? In this case, I would be happy to take a look and open another PR implementing this as well.
For the foremost argument above, the conditional compiling seems the nicer way to me. @asmellby What are your thoughts? |
Enables the zephyr interpretation of oversampling for the IADC sequence, averaging the samples for up to 16 measurements. Signed-off-by: Paulo Santos <[email protected]>
260de3a
to
d6c610d
Compare
|
@wkhadgar you can also use only the analog oversampling for the moment with |
@wkhadgar I implemented the oversampling in my PR with all the necessary for the xg21 compatibility. |
Enables the zephyr interpretation of oversampling for the IADC sequence, averaging the samples for up to 16 measurements.