-
Notifications
You must be signed in to change notification settings - Fork 104
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
ad7606 tweaks and updates #590
Open
commodo
wants to merge
7
commits into
analogdevicesinc:main
Choose a base branch
from
commodo:ad7606-tweaks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tfcollins
reviewed
Aug 22, 2024
adi/ad7606.py
Outdated
|
||
return ret | ||
return None |
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 replacing with returns you can omit last line. Python always returns None if there is no explicit return statement
tfcollins
reviewed
Aug 22, 2024
adi/ad7606.py
Outdated
# We can't detect SW mode, so we use a try block | ||
try: | ||
return self._get_iio_attr_str(self.name, "scale_available", False) | ||
except: |
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.
Need an exception type
With the upstream Linux version, the oversampling, oversampling_ratio attributes are available at device level. _get_iio_attr() is used for accessing channel attributes. Signed-off-by: Alexandru Ardelean <[email protected]>
There seems to be a confusion between scale and range. In the case of AD7606, the range (specified in the datasheet) determines the scale of the device (or the channel in some cases). Signed-off-by: Alexandru Ardelean <[email protected]>
Signed-off-by: Alexandru Ardelean <[email protected]>
The AD7606C-16 and AD7606C-18 support per-channel 'scale_availble' in SW mode. That is because each channel can be configured individually, to be bipolar-differential, bipolar-single-ended or unipolar-single-ended. Depending on the above configuration, the available scales change. So, we need to tweak this per-channel. Since there isn't a way to detect SW mode, we use some 'try' blocks in Python. Signed-off-by: Alexandru Ardelean <[email protected]>
For AD7606C-18 especially, there will be 32-bit samples getting returned from the ADC. Signed-off-by: Alexandru Ardelean <[email protected]>
The soft timestamp channel is a special IIO channel. It's not an RX channel, so it hasn't any of the typically attributes (raw, scale, etc) like the other RX channels. So, just ignore it. Signed-off-by: Alexandru Ardelean <[email protected]>
At least the 'raw' channel attribute returns int. So, 'ad7606.to_volts(0, channel0.raw)' won't work with checking for numpy types. Signed-off-by: Alexandru Ardelean <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This changeset mostly targets support for the AD7606C-18 and AD7606C-16 parts.
The upstream support for these parts is pending here:
https://lore.kernel.org/linux-iio/[email protected]/T/#t
But there were a couple of fixes required for existing parts.
For one thing the oversampling attributes need to be made device-level attributes.
There are no 'range' attributes. These are scale attributes.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
How has this been tested?
Tested with a ZedBoard and an AD7606C-18 FMC board.
The HDL is a simplified version that uses the Zynq PS SPI controller, which kind of like using the AD7606 part directly connected to a simple RPi board; no fancy communication.
Test Configuration:
Documentation
If this is a new feature or example please mention or link any documentation. All new hardware interface classes require documentation.
Checklist: