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: adc: Add support for TI ADS1112 ADCs #56826

Merged
merged 2 commits into from Jun 17, 2023

Conversation

jmontgomery-cruise
Copy link
Contributor

@jmontgomery-cruise jmontgomery-cruise commented Apr 13, 2023

This PR adds a custom driver for the ADS1112 ADCs. Unlike the ADS1113/4/5 family served by the ADS1x1x driver, the ADS1112 does not use an address pointer to access config registers. Instead, there is only one writable register and all i2c writes will set it. The register "map" resembles the ADS1119 device, but still has significant differences.

Notably, the config bitmap is different and includes a distinct data rate table, gain table, and input multiplexing table. Unlike the ADS1119, there isn't a status register, as config bit 7 serves the same purpose on the ADS1112.

The new driver has also been added to the existing ADC test using adc_emul for completeness. A second commit on top adds both this new driver and the existing ADS1119 driver to the adc-shell.c whitelist.

The new driver was tested on real hardware using the adc shell and correct voltages were observed in the configs used. Continuous sampling mode is not supported by this initial implementation.

@zephyrbot zephyrbot added area: ADC Analog-to-Digital Converter (ADC) area: Devicetree Binding PR modifies or adds a Device Tree binding platform: TI SimpleLink Texas Instruments SimpleLink MCU labels Apr 13, 2023
@jmontgomery-cruise jmontgomery-cruise force-pushed the add_ads1112_driver branch 3 times, most recently from 8929f9f to fd99dfb Compare April 25, 2023 18:53
@MaureenHelm
Copy link
Member

@anangl please take a look

@jmontgomery-cruise please address the failed scancode check

@jmontgomery-cruise jmontgomery-cruise force-pushed the add_ads1112_driver branch 6 times, most recently from 41208d8 to e58f901 Compare May 11, 2023 23:10
@cfriedt cfriedt removed the platform: TI SimpleLink Texas Instruments SimpleLink MCU label May 12, 2023
@cfriedt cfriedt removed their request for review May 12, 2023 00:17
@zephyrbot zephyrbot added the platform: TI SimpleLink Texas Instruments SimpleLink MCU label May 12, 2023
@zephyrbot zephyrbot requested a review from cfriedt May 12, 2023 16:45
@jmontgomery-cruise
Copy link
Contributor Author

@anangl Is there any chance this can be reviewed?

MaureenHelm
MaureenHelm previously approved these changes May 26, 2023
drivers/adc/Kconfig.ads1112 Outdated Show resolved Hide resolved
drivers/adc/adc_ads1112.c Outdated Show resolved Hide resolved
drivers/adc/adc_ads1112.c Outdated Show resolved Hide resolved
dts/bindings/adc/ti,ads1112.yaml Outdated Show resolved Hide resolved
drivers/adc/Kconfig.ads1112 Outdated Show resolved Hide resolved
drivers/adc/Kconfig.ads1112 Outdated Show resolved Hide resolved
drivers/adc/Kconfig.ads1112 Outdated Show resolved Hide resolved
This PR adds a custom driver for the ADS1112 ADCs. Unlike ADS1113/4/5
family served by the ADS1x1x driver, the ADS1112 does not use an address
pointer to address config registers. Instead, there is only one writable
register and all i2c writes will set it. The registers resemble the
ADS1119 device, but config bitmap is different, include a distinct data
rate table, gain table, and input multiplexing table. There is also not a
status register to be monitored with the ADS1112, as it uses config bit 7
for the same purpose instead of a separate register.

The driver was tested on hardware using the ADC shell interface. Manual
probing validated the voltages for the MUX_SINGLE configs at datarate 15
in CM_SINGLE. Higher gains were not tested and CM_CONTINUOUS is not
supported in this initial implementation.

The new driver has also been added to the existing ADC test using adc_emul
for completeness.

Origin: original
License: Apache 2.0
Purpose: Adding support for ADS1112 ADCs

Signed-off-by: Jordan Montgomery <jordan.montgomery@getcruise.com>
The adc-shell uses a hardcoded list of defines to check whether it should
throw a compile-time error. The ADS1119 and ADS1112 driver both support
the APIs needed by the shell, so this commit enables support for them in
the hardcoded support list.

Signed-off-by: Jordan Montgomery <jordan.montgomery@getcruise.com>
@nashif nashif merged commit b1e9a81 into zephyrproject-rtos:main Jun 17, 2023
19 checks passed
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hi @jmontgomery-cruise!
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: Devicetree Binding PR modifies or adds a Device Tree binding platform: TI SimpleLink Texas Instruments SimpleLink MCU
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants