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

Add IIO support for AD4170 #2363

Closed
wants to merge 2 commits into from
Closed

Add IIO support for AD4170 #2363

wants to merge 2 commits into from

Conversation

machschmitt
Copy link
Contributor

Pull Request Description

The reported issue is the following: "The AD4170 drivers don't do a sign extension when reading the ADC registers, as the ADC is 24 bits, but the int variable is 32-bit, it fills the 4th bit with zeroes even if bit 23 is 1."
While that could be fixed in the base driver by checking the bipolar field of AFE register in ad4170_get_ch_data(), I believe it's better to support the bipolar/unipodar data configuration through IIO so truly raw data access is preserved through the base driver channel read function.

Add support for basic IIO support that will output _raw data that is properly signed according to the bipolar/unipolar AFE configuration.

PR Type

  • Bug fix (change that fixes an issue)
  • New feature (change that adds new functionality)
  • Breaking change (has dependencies in other repos or will cause CI to fail)

PR Checklist

  • I have followed the Coding style guidelines
  • I have performed a self-review of the changes
  • I have commented my code, at least hard-to-understand parts
  • I have build all projects affected by the changes in this PR
  • I have tested in hardware affected projects, at the relevant boards
  • I have signed off all commits from this PR
  • I have updated the documentation (wiki pages, ReadMe etc), if applies

The list of AD4170 registers will also be useful for follow up patches
implementing debugfs IIO support AD4170. Declare AD4170 register list in
AD4170 header file so it can be reused by IIO support routines.

Signed-off-by: Marcelo Schmitt <[email protected]>
Add basic IIO support for voltage read and register access for debug
purposes.

Signed-off-by: Marcelo Schmitt <[email protected]>
@machschmitt
Copy link
Contributor Author

The fix for the data sign extension was implemented in the precision-converters-firmware repo (https://github.com/analogdevicesinc/precision-converters-firmware).
PR: analogdevicesinc/precision-converters-firmware#105

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

Successfully merging this pull request may close these issues.

1 participant