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

Feat add ad4114 driver #82816

Merged
merged 2 commits into from
Jan 15, 2025
Merged

Conversation

pcurt
Copy link
Contributor

@pcurt pcurt commented Dec 10, 2024

Add a driver to be able to use an SPI external AD4114 ADC.
https://www.analog.com/en/products/ad4114.html#part-details

This is a single supply, multichannel, 31.25 kSPS, 24-Bit, Sigma-Delta ADC.

Also update samples to show how to use it on a stm32f3 discovery board.

@zephyrbot zephyrbot added platform: ADI Analog Devices, Inc. area: ADC Analog-to-Digital Converter (ADC) area: Samples Samples labels Dec 10, 2024
Copy link

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

drivers/adc/adc_ad4114.c Outdated Show resolved Hide resolved
drivers/adc/adc_ad4114.c Outdated Show resolved Hide resolved
drivers/adc/adc_ad4114.c Outdated Show resolved Hide resolved
drivers/adc/adc_ad4114.c Outdated Show resolved Hide resolved
drivers/adc/adc_ad4114.c Outdated Show resolved Hide resolved
@pcurt pcurt force-pushed the feat_add_ad4114_driver branch 3 times, most recently from 490e84b to 8c6edc0 Compare December 11, 2024 08:57
@pcurt pcurt requested a review from ttmut December 11, 2024 08:57
@pcurt pcurt force-pushed the feat_add_ad4114_driver branch from 8c6edc0 to f8248d9 Compare December 12, 2024 13:51
Copy link
Member

@MaureenHelm MaureenHelm left a comment

Choose a reason for hiding this comment

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

Please add the board to samples/drivers/adc/adc_sequence/sample.yaml to build in CI

drivers/adc/adc_ad4114.c Show resolved Hide resolved
drivers/adc/adc_ad4114.c Show resolved Hide resolved
drivers/adc/adc_ad4114.c Outdated Show resolved Hide resolved
@pcurt pcurt force-pushed the feat_add_ad4114_driver branch 3 times, most recently from 1fed4b5 to b46b87c Compare December 17, 2024 14:01
@pcurt pcurt requested a review from MaureenHelm December 17, 2024 16:15
drivers/adc/adc_ad4114.c Outdated Show resolved Hide resolved
dts/bindings/adc/adi,ad4114-adc.yaml Outdated Show resolved Hide resolved
The AD4114 is a low power, low noise, 24-bit, sigma-delta ADC.
This driver allows to use it with the Zephyr ADC API. It uses
the continuous acquisition ADC feature.

This ADC allows many configutations, but this driver uses it as the
most generic way :
- each can channel can be enable or disable using the device
tree configuration
- configure two setups (one for unipolar inputs, one for bipolar inputs)
- use an external clock

Signed-off-by: Pierrick Curt <[email protected]>
Copy link
Collaborator

@bjarki-andreasen bjarki-andreasen left a comment

Choose a reason for hiding this comment

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

Nice work!

@pcurt
Copy link
Contributor Author

pcurt commented Dec 23, 2024

Please add the board to samples/drivers/adc/adc_sequence/sample.yaml to build in CI
@MaureenHelm can you please review your request changes ?

@pcurt
Copy link
Contributor Author

pcurt commented Jan 8, 2025

Please add the board to samples/drivers/adc/adc_sequence/sample.yaml to build in CI
@MaureenHelm can you please review your request changes ?

@MaureenHelm can you please review ?

Copy link
Member

@MaureenHelm MaureenHelm left a comment

Choose a reason for hiding this comment

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

Couple of nits, but otherwise LGTM

This examples shows how to use the AD4114 ADC on a
stm32f3_disco board.
As the AD4114 is a 24bits ADC resolution we need to be able
to pass 32bits buffer to get the samples.
CONFIG_SEQUENCE_RESOLUTION is set to 12 instead of 24, and the
gain zephyr,vref-mv is adapted to avoid overflows using the
exisiting adc_raw_to_millivolts function.

Signed-off-by: Pierrick Curt <[email protected]>
@kartben kartben merged commit 051a2b6 into zephyrproject-rtos:main Jan 15, 2025
24 checks passed
Copy link

Hi @pcurt!
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
area: ADC Analog-to-Digital Converter (ADC) area: Samples Samples platform: ADI Analog Devices, Inc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants