-
Notifications
You must be signed in to change notification settings - Fork 106
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 support for AD7091R-2, AD7091R-4 and AD7091R-8 #595
base: main
Are you sure you want to change the base?
Conversation
3241f77
to
3e595a5
Compare
Add ad7091r.py driver Add test script, example code Update index.rst, init.py, supported_parts.md files Add xml emu context file Update hardware_map.yml file for test emulation Signed-off-by: SGudla <[email protected]>
3e595a5
to
c22d8ea
Compare
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.
Please add more testing to the component channels. Here is an example https://github.com/analogdevicesinc/pyadi-iio/blob/main/test/test_ad3552r.py
Doc: https://analogdevicesinc.github.io/pyadi-iio/dev/test_attr.html#test.attr_tests.attribute_single_value
Please fix CI issues as well
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.
Hi @SaikiranGudla,
Looks good overall. This is a bit similar to some old drafts I had for ad7091r8 (https://github.com/machschmitt/pyadi-iio/tree/staging/ad7091r8), but this seems to be leveraging more of pyadi abstraction so probably better to improve this PR's branch.
I'm getting my rpi setup to test this with ad7091r8 and may come back with more comments soon.
Meanwhile, some questions: do you have an eval board to test ad7091r8? Are you still working on ad7091r8 pyadi support?
If you don't have an eval, I'll help test updates to ad7091r8 pyadi support as you update this PR.
If you have switched to other projects, then let me know so I can implement the remaining changes to get this merged.
def to_volts(self, index, val): | ||
"""Converts raw value to SI""" | ||
_scale = self.channel[index].scale |
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 the drivers are correct, this should return a value in milli volts (mV).
I would suggest to update the comment and function name to mitigate confusion.
def offset(self): | ||
"""AD7091r channel offset value""" | ||
return self._get_iio_attr_str(self.name, "offset", False) | ||
|
||
@offset.setter | ||
def offset(self, value): | ||
self._set_iio_attr(self.name, "offset", False, str(Decimal(value).real)) |
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.
These ADCs have single-ended unipolar channels that don't really need an _offset
attribute and the drivers do not expose any offset. The pyadi support should probably not provide any offset either.
@scale.setter | ||
def scale(self, value): | ||
self._set_iio_attr(self.name, "scale", False, str(Decimal(value).real)) |
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.
For AD7091R-2/-4/-8, the _scale
is a read-only attribute so it is better to remove the scale setter.
@@ -0,0 +1 @@ | |||
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE context [<!ELEMENT context (device | context-attribute)*><!ELEMENT context-attribute EMPTY><!ELEMENT device (channel | attribute | debug-attribute | buffer-attribute)*><!ELEMENT channel (scan-element?, attribute*)><!ELEMENT attribute EMPTY><!ELEMENT scan-element EMPTY><!ELEMENT debug-attribute EMPTY><!ELEMENT buffer-attribute EMPTY><!ATTLIST context name CDATA #REQUIRED description CDATA #IMPLIED><!ATTLIST context-attribute name CDATA #REQUIRED value CDATA #REQUIRED><!ATTLIST device id CDATA #REQUIRED name CDATA #IMPLIED><!ATTLIST channel id CDATA #REQUIRED type (input|output) #REQUIRED name CDATA #IMPLIED><!ATTLIST scan-element index CDATA #REQUIRED format CDATA #REQUIRED scale CDATA #IMPLIED><!ATTLIST attribute name CDATA #REQUIRED filename CDATA #IMPLIED value CDATA #IMPLIED><!ATTLIST debug-attribute name CDATA #REQUIRED value CDATA #IMPLIED><!ATTLIST buffer-attribute name CDATA #REQUIRED value CDATA #IMPLIED>]><context name="serial" description="no-OS 0.1" ><context-attribute name="hw_carrier" value="SDP_K1" /><context-attribute name="hw_mezzanine" value="EVAL-AD7091R-8ARDZ" /><context-attribute name="hw_name" value="EVAL-AD7091R-8ARDZ" /><context-attribute name="uri" value="serial:/dev/ttyS0,230400,8n1n" /><context-attribute name="serial,port" value="/dev/ttyS0" /><context-attribute name="serial,description" value="ttyS0" /><device id="iio:device0" name="ad7091r-8" ><channel id="voltage0" name="Chn0" type="input" ><scan-element index="0" format="be:u12/16>>0" /><attribute name="raw" filename="in_voltage0_raw" value="0" /><attribute name="scale" filename="in_voltage0_scale" value=" 0.6105006337" /><attribute name="offset" filename="in_voltage0_offset" value="0" /><attribute name="thresh_falling_value" filename="in_voltage0_thresh_falling_value" value="0" /></channel><attribute name="thresh_rising_value" filename="in_voltage0_thresh_rising_value" value="4095" /><attribute name="thresh_either_hysteresis" filename="in_voltage0_thresh_either_hysteresis" value="511" /><channel id="voltage1" name="Chn1" type="input" ><scan-element index="1" format="be:u12/16>>0" /><attribute name="raw" filename="in_voltage1_raw" value="0" /><attribute name="scale" filename="in_voltage1_scale" value=" 0.6105006337" /><attribute name="offset" filename="in_voltage1_offset" value="0" /><attribute name="thresh_falling_value" filename="in_voltage1_thresh_falling_value" value="0" /></channel><attribute name="thresh_rising_value" filename="in_voltage1_thresh_rising_value" value="4095" /><attribute name="thresh_either_hysteresis" filename="in_voltage1_thresh_either_hysteresis" value="511" /><channel id="voltage2" name="Chn2" type="input" ><scan-element index="2" format="be:u12/16>>0" /><attribute name="raw" filename="in_voltage2_raw" value="0" /><attribute name="scale" filename="in_voltage2_scale" value=" 0.6105006337" /><attribute name="offset" filename="in_voltage2_offset" value="0" /><attribute name="thresh_falling_value" filename="in_voltage2_thresh_falling_value" value="0" /></channel><attribute name="thresh_rising_value" filename="in_voltage2_thresh_rising_value" value="4095" /><attribute name="thresh_either_hysteresis" filename="in_voltage2_thresh_either_hysteresis" value="511" /><channel id="voltage3" name="Chn3" type="input" ><scan-element index="3" format="be:u12/16>>0" /><attribute name="raw" filename="in_voltage3_raw" value="0" /><attribute name="scale" filename="in_voltage3_scale" value=" 0.6105006337" /><attribute name="offset" filename="in_voltage3_offset" value="0" /><attribute name="thresh_falling_value" filename="in_voltage3_thresh_falling_value" value="0" /></channel><attribute name="thresh_rising_value" filename="in_voltage3_thresh_rising_value" value="4095" /><attribute name="thresh_either_hysteresis" filename="in_voltage3_thresh_either_hysteresis" value="511" /><channel id="voltage4" name="Chn4" type="input" ><scan-element index="4" format="be:u12/16>>0" /><attribute name="raw" filename="in_voltage4_raw" value="0" /><attribute name="scale" filename="in_voltage4_scale" value=" 0.6105006337" /><attribute name="offset" filename="in_voltage4_offset" value="0" /><attribute name="thresh_falling_value" filename="in_voltage4_thresh_falling_value" value="0" /></channel><attribute name="thresh_rising_value" filename="in_voltage4_thresh_rising_value" value="4095" /><attribute name="thresh_either_hysteresis" filename="in_voltage4_thresh_either_hysteresis" value="511" /><channel id="voltage5" name="Chn5" type="input" ><scan-element index="5" format="be:u12/16>>0" /><attribute name="raw" filename="in_voltage5_raw" value="0" /><attribute name="scale" filename="in_voltage5_scale" value=" 0.6105006337" /><attribute name="offset" filename="in_voltage5_offset" value="0" /><attribute name="thresh_falling_value" filename="in_voltage5_thresh_falling_value" value="0" /></channel><attribute name="thresh_rising_value" filename="in_voltage5_thresh_rising_value" value="4095" /><attribute name="thresh_either_hysteresis" filename="in_voltage5_thresh_either_hysteresis" value="511" /><channel id="voltage6" name="Chn6" type="input" ><scan-element index="6" format="be:u12/16>>0" /><attribute name="raw" filename="in_voltage6_raw" value="0" /><attribute name="scale" filename="in_voltage6_scale" value=" 0.6105006337" /><attribute name="offset" filename="in_voltage6_offset" value="0" /><attribute name="thresh_falling_value" filename="in_voltage6_thresh_falling_value" value="0" /></channel><attribute name="thresh_rising_value" filename="in_voltage6_thresh_rising_value" value="4095" /><attribute name="thresh_either_hysteresis" filename="in_voltage6_thresh_either_hysteresis" value="511" /><channel id="voltage7" name="Chn7" type="input" ><scan-element index="7" format="be:u12/16>>0" /><attribute name="raw" filename="in_voltage7_raw" value="0" /><attribute name="scale" filename="in_voltage7_scale" value=" 0.6105006337" /><attribute name="offset" filename="in_voltage7_offset" value="0" /><attribute name="thresh_falling_value" filename="in_voltage7_thresh_falling_value" value="0" /></channel><attribute name="thresh_rising_value" filename="in_voltage7_thresh_rising_value" value="4095" /><attribute name="thresh_either_hysteresis" filename="in_voltage7_thresh_either_hysteresis" value="511" /><debug-attribute name="direct_reg_access" value="0" /></device><device id="trigger0" name="ad7091r_iio_trigger" ></device></context> |
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.
Where did you get this xml from?
Neither Linux nor No-OS ad7091r8 drivers provide _offset
attributes.
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.
This is the device xml retrieved from AD7091R-8 connected on a raspberrypi:
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE context [<!ELEMENT context (device | context-attribute)*><!ELEMENT context-attribute EMPTY><!ELEMENT device (channel | attribute | debug-attribute | buffer-attribute)*><!ELEMENT channel (scan-element?, attribute*)><!ELEMENT attribute EMPTY><!ELEMENT scan-element EMPTY><!ELEMENT debug-attribute EMPTY><!ELEMENT buffer-attribute EMPTY><!ATTLIST context name CDATA #REQUIRED description CDATA #IMPLIED><!ATTLIST context-attribute name CDATA #REQUIRED value CDATA #REQUIRED><!ATTLIST device id CDATA #REQUIRED name CDATA #IMPLIED><!ATTLIST channel id CDATA #REQUIRED type (input|output) #REQUIRED name CDATA #IMPLIED><!ATTLIST scan-element index CDATA #REQUIRED format CDATA #REQUIRED scale CDATA #IMPLIED><!ATTLIST attribute name CDATA #REQUIRED filename CDATA #IMPLIED value CDATA #IMPLIED><!ATTLIST debug-attribute name CDATA #REQUIRED value CDATA #IMPLIED><!ATTLIST buffer-attribute name CDATA #REQUIRED value CDATA #IMPLIED>]><context name="network" description="192.168.1.3 Linux raspberrypi 6.8.0-rc4-v8+ #4 SMP PREEMPT Thu Feb 15 10:45:25 -03 2024 aarch64" ><context-attribute name="local,kernel" value="6.8.0-rc4-v8+" /><context-attribute name="uri" value="ip:192.168.1.3" /><context-attribute name="ip,ip-addr" value="192.168.1.3" /><device id="iio:device0" name="ad7091r-8" ><channel id="voltage1" type="input" ><attribute name="raw" filename="in_voltage1_raw" value="2603" /><attribute name="scale" filename="in_voltage_scale" value="0.610351562" /></channel><channel id="voltage5" type="input" ><attribute name="raw" filename="in_voltage5_raw" value="0" /><attribute name="scale" filename="in_voltage_scale" value="0.610351562" /></channel><channel id="voltage2" type="input" ><attribute name="raw" filename="in_voltage2_raw" value="533" /><attribute name="scale" filename="in_voltage_scale" value="0.610351562" /></channel><channel id="voltage6" type="input" ><attribute name="raw" filename="in_voltage6_raw" value="1076" /><attribute name="scale" filename="in_voltage_scale" value="0.610351562" /></channel><channel id="voltage3" type="input" ><attribute name="raw" filename="in_voltage3_raw" value="1922" /><attribute name="scale" filename="in_voltage_scale" value="0.610351562" /></channel><channel id="voltage7" type="input" ><attribute name="raw" filename="in_voltage7_raw" value="1747" /><attribute name="scale" filename="in_voltage_scale" value="0.610351562" /></channel><channel id="voltage0" type="input" ><attribute name="raw" filename="in_voltage0_raw" value="2229" /><attribute name="scale" filename="in_voltage_scale" value="0.610351562" /></channel><channel id="voltage4" type="input" ><attribute name="raw" filename="in_voltage4_raw" value="2376" /><attribute name="scale" filename="in_voltage_scale" value="0.610351562" /></channel><attribute name="waiting_for_supplier" value="0" /></device></context>
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.
This is from the tinyiiod fw I've created. I'll update this with the one that you've motioned here.
# Set up AD7091r8 | ||
ad7091r8_dev = ad7091rx(uri="serial:COM46,230400,8n1", device_name="ad7091r-8") |
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.
Could use argparse
to make the example initialization more flexible and add parameters for specifying the URL and which ADC (r-2/r-4/r-8) is available.
@pytest.mark.parametrize("classname", [(classname)]) | ||
@pytest.mark.parametrize("channel", [0]) | ||
def test_ad7091rx_rx_data(test_dma_rx, iio_uri, classname, channel): | ||
test_dma_rx(iio_uri, classname, channel) |
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.
I'm not sure this is the appropriate way to test current ad7091r-2/-4/-8 support.
I've heard that raspberry pies can optimize repeated SPI transfers so that their data go through the DMA path. Though, the Linux driver doesn't currently support buffered readings.
No-OS ad7091r8 driver does support buffered readings, but I'm not aware of any HDL project that enables transfers going through DMA. So, I think this test will not succeed in practice, unless test_dma_rx()
can fall back to non-DMA transfers?
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.
python -m pytest -vs -k ad7091rx --emu
throws Exception: Buffer all zeros
. Maybe better to not assume the device is buffer capable in tests. Maybe check for buffer support prior to test_dma_rx()
? Or maybe catch the exception?
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.
Tested this ad7091r-2/-4/-8 support with AD7091R-8 connected to a raspberrypi.
Basic functionality (raw data read) works!
Other features (threshold/events, buffer) are either not fully supported by the drivers or by libiio so I would drop those for now.
ad7091r8_dev.rx_enabled_channels = [chn] | ||
ad7091r8_dev.rx_buffer_size = 100 | ||
|
||
data = ad7091r8_dev.rx() |
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.
When running the example with AD7091R-8 on a rpi, this line throws OSError: [Errno 22] Invalid argument
after some null check in _create_buffer()
, probably due to Linux not supporting buffered reads for ad7091r-2/-4/-8 devices. Would be nice to check if the device is buffer capable then run the capture or print a message depending on buffer support.
print(f"Raw value read from channel0 is {raw}") | ||
|
||
# Set threshold falling and rising values for channel 0 | ||
ad7091r8_dev.channel[0].thresh_rising_value = 0x10F |
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.
When running the example with AD7091R-8 on a rpi, this line throws KeyError: 'thresh_rising_value'
.
The thresholds are supported as IIO events but it looks like libiio doesn't support IIO events currently. I would drop the attempt to support events/thresholds and maybe leave a comment mentioning they can be implemented when libiio gets to support them.
I do get raw data if I only run the first part of the example.
@@ -0,0 +1 @@ | |||
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE context [<!ELEMENT context (device | context-attribute)*><!ELEMENT context-attribute EMPTY><!ELEMENT device (channel | attribute | debug-attribute | buffer-attribute)*><!ELEMENT channel (scan-element?, attribute*)><!ELEMENT attribute EMPTY><!ELEMENT scan-element EMPTY><!ELEMENT debug-attribute EMPTY><!ELEMENT buffer-attribute EMPTY><!ATTLIST context name CDATA #REQUIRED description CDATA #IMPLIED><!ATTLIST context-attribute name CDATA #REQUIRED value CDATA #REQUIRED><!ATTLIST device id CDATA #REQUIRED name CDATA #IMPLIED><!ATTLIST channel id CDATA #REQUIRED type (input|output) #REQUIRED name CDATA #IMPLIED><!ATTLIST scan-element index CDATA #REQUIRED format CDATA #REQUIRED scale CDATA #IMPLIED><!ATTLIST attribute name CDATA #REQUIRED filename CDATA #IMPLIED value CDATA #IMPLIED><!ATTLIST debug-attribute name CDATA #REQUIRED value CDATA #IMPLIED><!ATTLIST buffer-attribute name CDATA #REQUIRED value CDATA #IMPLIED>]><context name="serial" description="no-OS 0.1" ><context-attribute name="hw_carrier" value="SDP_K1" /><context-attribute name="hw_mezzanine" value="EVAL-AD7091R-8ARDZ" /><context-attribute name="hw_name" value="EVAL-AD7091R-8ARDZ" /><context-attribute name="uri" value="serial:/dev/ttyS0,230400,8n1n" /><context-attribute name="serial,port" value="/dev/ttyS0" /><context-attribute name="serial,description" value="ttyS0" /><device id="iio:device0" name="ad7091r-8" ><channel id="voltage0" name="Chn0" type="input" ><scan-element index="0" format="be:u12/16>>0" /><attribute name="raw" filename="in_voltage0_raw" value="0" /><attribute name="scale" filename="in_voltage0_scale" value=" 0.6105006337" /><attribute name="offset" filename="in_voltage0_offset" value="0" /><attribute name="thresh_falling_value" filename="in_voltage0_thresh_falling_value" value="0" /></channel><attribute name="thresh_rising_value" filename="in_voltage0_thresh_rising_value" value="4095" /><attribute name="thresh_either_hysteresis" filename="in_voltage0_thresh_either_hysteresis" value="511" /><channel id="voltage1" name="Chn1" type="input" ><scan-element index="1" format="be:u12/16>>0" /><attribute name="raw" filename="in_voltage1_raw" value="0" /><attribute name="scale" filename="in_voltage1_scale" value=" 0.6105006337" /><attribute name="offset" filename="in_voltage1_offset" value="0" /><attribute name="thresh_falling_value" filename="in_voltage1_thresh_falling_value" value="0" /></channel><attribute name="thresh_rising_value" filename="in_voltage1_thresh_rising_value" value="4095" /><attribute name="thresh_either_hysteresis" filename="in_voltage1_thresh_either_hysteresis" value="511" /><channel id="voltage2" name="Chn2" type="input" ><scan-element index="2" format="be:u12/16>>0" /><attribute name="raw" filename="in_voltage2_raw" value="0" /><attribute name="scale" filename="in_voltage2_scale" value=" 0.6105006337" /><attribute name="offset" filename="in_voltage2_offset" value="0" /><attribute name="thresh_falling_value" filename="in_voltage2_thresh_falling_value" value="0" /></channel><attribute name="thresh_rising_value" filename="in_voltage2_thresh_rising_value" value="4095" /><attribute name="thresh_either_hysteresis" filename="in_voltage2_thresh_either_hysteresis" value="511" /><channel id="voltage3" name="Chn3" type="input" ><scan-element index="3" format="be:u12/16>>0" /><attribute name="raw" filename="in_voltage3_raw" value="0" /><attribute name="scale" filename="in_voltage3_scale" value=" 0.6105006337" /><attribute name="offset" filename="in_voltage3_offset" value="0" /><attribute name="thresh_falling_value" filename="in_voltage3_thresh_falling_value" value="0" /></channel><attribute name="thresh_rising_value" filename="in_voltage3_thresh_rising_value" value="4095" /><attribute name="thresh_either_hysteresis" filename="in_voltage3_thresh_either_hysteresis" value="511" /><channel id="voltage4" name="Chn4" type="input" ><scan-element index="4" format="be:u12/16>>0" /><attribute name="raw" filename="in_voltage4_raw" value="0" /><attribute name="scale" filename="in_voltage4_scale" value=" 0.6105006337" /><attribute name="offset" filename="in_voltage4_offset" value="0" /><attribute name="thresh_falling_value" filename="in_voltage4_thresh_falling_value" value="0" /></channel><attribute name="thresh_rising_value" filename="in_voltage4_thresh_rising_value" value="4095" /><attribute name="thresh_either_hysteresis" filename="in_voltage4_thresh_either_hysteresis" value="511" /><channel id="voltage5" name="Chn5" type="input" ><scan-element index="5" format="be:u12/16>>0" /><attribute name="raw" filename="in_voltage5_raw" value="0" /><attribute name="scale" filename="in_voltage5_scale" value=" 0.6105006337" /><attribute name="offset" filename="in_voltage5_offset" value="0" /><attribute name="thresh_falling_value" filename="in_voltage5_thresh_falling_value" value="0" /></channel><attribute name="thresh_rising_value" filename="in_voltage5_thresh_rising_value" value="4095" /><attribute name="thresh_either_hysteresis" filename="in_voltage5_thresh_either_hysteresis" value="511" /><channel id="voltage6" name="Chn6" type="input" ><scan-element index="6" format="be:u12/16>>0" /><attribute name="raw" filename="in_voltage6_raw" value="0" /><attribute name="scale" filename="in_voltage6_scale" value=" 0.6105006337" /><attribute name="offset" filename="in_voltage6_offset" value="0" /><attribute name="thresh_falling_value" filename="in_voltage6_thresh_falling_value" value="0" /></channel><attribute name="thresh_rising_value" filename="in_voltage6_thresh_rising_value" value="4095" /><attribute name="thresh_either_hysteresis" filename="in_voltage6_thresh_either_hysteresis" value="511" /><channel id="voltage7" name="Chn7" type="input" ><scan-element index="7" format="be:u12/16>>0" /><attribute name="raw" filename="in_voltage7_raw" value="0" /><attribute name="scale" filename="in_voltage7_scale" value=" 0.6105006337" /><attribute name="offset" filename="in_voltage7_offset" value="0" /><attribute name="thresh_falling_value" filename="in_voltage7_thresh_falling_value" value="0" /></channel><attribute name="thresh_rising_value" filename="in_voltage7_thresh_rising_value" value="4095" /><attribute name="thresh_either_hysteresis" filename="in_voltage7_thresh_either_hysteresis" value="511" /><debug-attribute name="direct_reg_access" value="0" /></device><device id="trigger0" name="ad7091r_iio_trigger" ></device></context> |
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.
This is the device xml retrieved from AD7091R-8 connected on a raspberrypi:
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE context [<!ELEMENT context (device | context-attribute)*><!ELEMENT context-attribute EMPTY><!ELEMENT device (channel | attribute | debug-attribute | buffer-attribute)*><!ELEMENT channel (scan-element?, attribute*)><!ELEMENT attribute EMPTY><!ELEMENT scan-element EMPTY><!ELEMENT debug-attribute EMPTY><!ELEMENT buffer-attribute EMPTY><!ATTLIST context name CDATA #REQUIRED description CDATA #IMPLIED><!ATTLIST context-attribute name CDATA #REQUIRED value CDATA #REQUIRED><!ATTLIST device id CDATA #REQUIRED name CDATA #IMPLIED><!ATTLIST channel id CDATA #REQUIRED type (input|output) #REQUIRED name CDATA #IMPLIED><!ATTLIST scan-element index CDATA #REQUIRED format CDATA #REQUIRED scale CDATA #IMPLIED><!ATTLIST attribute name CDATA #REQUIRED filename CDATA #IMPLIED value CDATA #IMPLIED><!ATTLIST debug-attribute name CDATA #REQUIRED value CDATA #IMPLIED><!ATTLIST buffer-attribute name CDATA #REQUIRED value CDATA #IMPLIED>]><context name="network" description="192.168.1.3 Linux raspberrypi 6.8.0-rc4-v8+ #4 SMP PREEMPT Thu Feb 15 10:45:25 -03 2024 aarch64" ><context-attribute name="local,kernel" value="6.8.0-rc4-v8+" /><context-attribute name="uri" value="ip:192.168.1.3" /><context-attribute name="ip,ip-addr" value="192.168.1.3" /><device id="iio:device0" name="ad7091r-8" ><channel id="voltage1" type="input" ><attribute name="raw" filename="in_voltage1_raw" value="2603" /><attribute name="scale" filename="in_voltage_scale" value="0.610351562" /></channel><channel id="voltage5" type="input" ><attribute name="raw" filename="in_voltage5_raw" value="0" /><attribute name="scale" filename="in_voltage_scale" value="0.610351562" /></channel><channel id="voltage2" type="input" ><attribute name="raw" filename="in_voltage2_raw" value="533" /><attribute name="scale" filename="in_voltage_scale" value="0.610351562" /></channel><channel id="voltage6" type="input" ><attribute name="raw" filename="in_voltage6_raw" value="1076" /><attribute name="scale" filename="in_voltage_scale" value="0.610351562" /></channel><channel id="voltage3" type="input" ><attribute name="raw" filename="in_voltage3_raw" value="1922" /><attribute name="scale" filename="in_voltage_scale" value="0.610351562" /></channel><channel id="voltage7" type="input" ><attribute name="raw" filename="in_voltage7_raw" value="1747" /><attribute name="scale" filename="in_voltage_scale" value="0.610351562" /></channel><channel id="voltage0" type="input" ><attribute name="raw" filename="in_voltage0_raw" value="2229" /><attribute name="scale" filename="in_voltage_scale" value="0.610351562" /></channel><channel id="voltage4" type="input" ><attribute name="raw" filename="in_voltage4_raw" value="2376" /><attribute name="scale" filename="in_voltage_scale" value="0.610351562" /></channel><attribute name="waiting_for_supplier" value="0" /></device></context>
@pytest.mark.parametrize("classname", [(classname)]) | ||
@pytest.mark.parametrize("channel", [0]) | ||
def test_ad7091rx_rx_data(test_dma_rx, iio_uri, classname, channel): | ||
test_dma_rx(iio_uri, classname, channel) |
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.
python -m pytest -vs -k ad7091rx --emu
throws Exception: Buffer all zeros
. Maybe better to not assume the device is buffer capable in tests. Maybe check for buffer support prior to test_dma_rx()
? Or maybe catch the exception?
Add ad7091r.py driver
Add test script, example code
Update index.rst, init.py, supported_parts.md files Add xml emu context file
Update hardware_map.yml file for test emulation
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
How has this been tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
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: