Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8ff060e

Browse files
committedJan 28, 2025·
Add support for AD353xr
Add ad353xr.py driver Add example script Update index.rst, init.py, supported_parts.md files Signed-off-by: SGudla <Saikiran.Gudla@analog.com>
1 parent 39a62ea commit 8ff060e

File tree

9 files changed

+446
-0
lines changed

9 files changed

+446
-0
lines changed
 

‎adi/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# SPDX short identifier: ADIBSD
44

55
from adi.ad2s1210 import ad2s1210
6+
from adi.ad353xr import ad353xr
67
from adi.ad405x import ad405x
78
from adi.ad469x import ad469x
89
from adi.ad579x import ad579x

‎adi/ad353xr.py

+305
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,305 @@
1+
# Copyright (C) 2025 Analog Devices, Inc.
2+
#
3+
# SPDX short identifier: ADIBSD
4+
# Copyright (C) 2025 Analog Devices, Inc.
5+
#
6+
# All rights reserved.
7+
#
8+
# Redistribution and use in source and binary forms, with or without modification,
9+
# are permitted provided that the following conditions are met:
10+
# - Redistributions of source code must retain the above copyright
11+
# notice, this list of conditions and the following disclaimer.
12+
# - Redistributions in binary form must reproduce the above copyright
13+
# notice, this list of conditions and the following disclaimer in
14+
# the documentation and/or other materials provided with the
15+
# distribution.
16+
# - Neither the name of Analog Devices, Inc. nor the names of its
17+
# contributors may be used to endorse or promote products derived
18+
# from this software without specific prior written permission.
19+
# - The use of this software may or may not infringe the patent rights
20+
# of one or more patent holders. This license does not release you
21+
# from the requirement that you obtain separate licenses from these
22+
# patent holders to use this software.
23+
# - Use of the software either in source or binary form, must be run
24+
# on or directly connected to an Analog Devices Inc. component.
25+
#
26+
# THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
27+
# INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
28+
# PARTICULAR PURPOSE ARE DISCLAIMED.
29+
#
30+
# IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY
32+
# RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
33+
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34+
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
35+
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36+
37+
from decimal import Decimal
38+
39+
from adi.attribute import attribute
40+
from adi.context_manager import context_manager
41+
from adi.rx_tx import tx
42+
43+
44+
class ad353xr(tx, context_manager):
45+
""" AD353xr DAC """
46+
47+
_complex_data = False
48+
channel = [] # type: ignore
49+
_device_name = ""
50+
51+
def __init__(self, uri="", device_name=""):
52+
"""Constructor for AD353xr class."""
53+
context_manager.__init__(self, uri, self._device_name)
54+
55+
compatible_parts = ["ad3530r"]
56+
57+
self._ctrl = None
58+
59+
if not device_name:
60+
device_name = compatible_parts[0]
61+
else:
62+
if device_name not in compatible_parts:
63+
raise Exception(
64+
f"Not a compatible device: {device_name}. Supported device names "
65+
f"are: {','.join(compatible_parts)}"
66+
)
67+
68+
# Select the device matching device_name as working device
69+
for device in self._ctx.devices:
70+
if device.name == device_name:
71+
self._ctrl = device
72+
self._txdac = device
73+
break
74+
75+
if not self._ctrl:
76+
raise Exception("Error in selecting matching device")
77+
78+
if not self._txdac:
79+
raise Exception("Error in selecting matching device")
80+
81+
self.output_bits = []
82+
for ch in self._ctrl.channels:
83+
name = ch.id
84+
self.output_bits.append(ch.data_format.bits)
85+
self._tx_channel_names.append(name)
86+
self.channel.append(self._channel(self._ctrl, name))
87+
88+
tx.__init__(self)
89+
90+
### Add device attributes here ###
91+
92+
@property
93+
def sampling_frequency(self):
94+
"""AD353xr sampling frequency config"""
95+
return self._get_iio_dev_attr_str("sampling_frequency")
96+
97+
@sampling_frequency.setter
98+
def sampling_frequency(self, value):
99+
self._set_iio_dev_attr_str("sampling_frequency", value)
100+
101+
@property
102+
def all_ch_operating_mode_avail(self):
103+
"""AD353xr all channels operating mode available"""
104+
return self._get_iio_dev_attr_str("all_ch_operating_mode_available")
105+
106+
@property
107+
def all_ch_operating_mode(self):
108+
"""AD353xr all channels operating mode config"""
109+
return self._get_iio_dev_attr_str("all_ch_operating_mode")
110+
111+
@all_ch_operating_mode.setter
112+
def all_ch_operating_mode(self, value):
113+
if value in self.all_ch_operating_mode_avail:
114+
self._set_iio_dev_attr_str("all_ch_operating_mode", value)
115+
else:
116+
raise ValueError(
117+
"Error: Operating mode not supported \nUse one of: "
118+
+ str(self.all_ch_operating_mode_avail)
119+
)
120+
121+
@property
122+
def all_ch_input_registers(self):
123+
"""AD353xr all input registers config"""
124+
return self._get_iio_dev_attr_str("all_ch_input_registers")
125+
126+
@all_ch_input_registers.setter
127+
def all_input_registers(self, value):
128+
self._set_iio_dev_attr_str("all_ch_input_registers", value)
129+
130+
@property
131+
def all_ch_raw(self):
132+
"""AD353xr all dac registers config"""
133+
return self._get_iio_dev_attr_str("all_ch_raw")
134+
135+
@all_ch_raw.setter
136+
def all_ch_raw(self, value):
137+
self._set_iio_dev_attr_str("all_ch_raw", value)
138+
139+
@property
140+
def reference_select_available(self):
141+
"""AD353xr reference voltage available"""
142+
return self._get_iio_dev_attr_str("reference_select_available")
143+
144+
@property
145+
def reference_select(self):
146+
"""AD353xr reference voltage config"""
147+
return self._get_iio_dev_attr_str("reference_select")
148+
149+
@reference_select.setter
150+
def reference_select(self, value):
151+
if value in self.reference_select_available:
152+
self._set_iio_dev_attr_str("reference_select", value)
153+
else:
154+
raise ValueError(
155+
"Error: Reference select not supported \nUse one of: "
156+
+ str(self.reference_select_available)
157+
)
158+
159+
@property
160+
def sw_ldac_trigger_avail(self):
161+
"""AD353xr sw_ldac_trigger available"""
162+
return self._get_iio_dev_attr_str("sw_ldac_trigger_available")
163+
164+
@property
165+
def sw_ldac_trigger(self):
166+
"""AD353xr software ldac trigger config"""
167+
return self._get_iio_dev_attr_str("sw_ldac_trigger")
168+
169+
@sw_ldac_trigger.setter
170+
def sw_ldac_trigger(self, value):
171+
if value in self.sw_ldac_trigger_avail:
172+
self._set_iio_dev_attr_str("sw_ldac_trigger", value)
173+
else:
174+
raise ValueError(
175+
"Error: Trigger value not supported \nUse one of: "
176+
+ str(self.sw_ldac_trigger_avail)
177+
)
178+
179+
@property
180+
def hw_ldac_trigger_avail(self):
181+
"""AD353xr hw_ldac_trigger available"""
182+
return self._get_iio_dev_attr_str("hw_ldac_trigger_available")
183+
184+
@property
185+
def hw_ldac_trigger(self):
186+
"""AD353xr hardware ldac trigger config"""
187+
return self._get_iio_dev_attr_str("hw_ldac_trigger")
188+
189+
@hw_ldac_trigger.setter
190+
def hw_ldac_trigger(self, value):
191+
if value in self.hw_ldac_trigger_avail:
192+
self._set_iio_dev_attr_str("hw_ldac_trigger", value)
193+
else:
194+
raise ValueError(
195+
"Error: Trigger value not supported \nUse one of: "
196+
+ str(self.hw_ldac_trigger_avail)
197+
)
198+
199+
@property
200+
def range_avail(self):
201+
"""AD353xr range available"""
202+
return self._get_iio_dev_attr_str("range_available")
203+
204+
@property
205+
def range(self):
206+
"""AD353xr range config"""
207+
return self._get_iio_dev_attr_str("range")
208+
209+
@range.setter
210+
def range(self, value):
211+
if value in self.range_avail:
212+
self._set_iio_dev_attr_str("range", value)
213+
else:
214+
raise ValueError(
215+
"Error: Range option not supported \nUse one of: "
216+
+ str(self.range_avail)
217+
)
218+
219+
@property
220+
def mux_out_select_avail(self):
221+
"""AD353xr mux_out_select available"""
222+
return self._get_iio_dev_attr_str("mux_out_select_available")
223+
224+
@property
225+
def mux_out_select(self):
226+
"""AD353xr mux out select"""
227+
return self._get_iio_dev_attr_str("mux_out_select")
228+
229+
@mux_out_select.setter
230+
def mux_out_select(self, value):
231+
if value in self.mux_out_select_avail:
232+
self._set_iio_dev_attr_str("mux_out_select", value)
233+
else:
234+
raise ValueError(
235+
"Error: Mux output option not supported \nUse one of: "
236+
+ str(self.mux_out_select_avail)
237+
)
238+
239+
############################################################################
240+
241+
class _channel(attribute):
242+
"""AD353xr channel"""
243+
244+
def __init__(self, ctrl, channel_name):
245+
self.name = channel_name
246+
self._ctrl = ctrl
247+
248+
### Add channel attributes here ###
249+
@property
250+
def input_register(self):
251+
"""AD353xr channel input register value"""
252+
return self._get_iio_attr(self.name, "input_register", True)
253+
254+
@input_register.setter
255+
def input_register(self, value):
256+
self._set_iio_attr(self.name, "input_register", True, str(int(value)))
257+
258+
@property
259+
def raw(self):
260+
"""AD353xr channel raw value"""
261+
return self._get_iio_attr(self.name, "raw", True)
262+
263+
@raw.setter
264+
def raw(self, value):
265+
self._set_iio_attr(self.name, "raw", True, str(int(value)))
266+
267+
@property
268+
def offset(self):
269+
"""AD353xr channel offset"""
270+
return self._get_iio_attr(self.name, "offset", True)
271+
272+
@offset.setter
273+
def offset(self, value):
274+
self._set_iio_attr(self.name, "offset", True, str(Decimal(value).real))
275+
276+
@property
277+
def scale(self):
278+
"""AD353xr channel scale"""
279+
return self._get_iio_attr(self.name, "scale", True)
280+
281+
@scale.setter
282+
def scale(self, value):
283+
self._set_iio_attr(self.name, "scale", True, str(Decimal(value).real))
284+
285+
@property
286+
def operating_mode_avail(self):
287+
"""AD353xr channel operating mode settings"""
288+
return self._get_iio_attr_str(self.name, "operating_mode_available", True)
289+
290+
@property
291+
def operating_mode(self):
292+
"""AD353xr channel operating mode"""
293+
return self._get_iio_attr_str(self.name, "operating_mode", True)
294+
295+
@operating_mode.setter
296+
def operating_mode(self, value):
297+
if value in self.operating_mode_avail:
298+
self._set_iio_attr(self.name, "operating_mode", True, value)
299+
else:
300+
raise ValueError(
301+
"Error: Operating mode not supported \nUse one of: "
302+
+ str(self.operating_mode_avail)
303+
)
304+
305+
#####################################################################

‎doc/source/devices/adi.ad353xr.rst

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ad353xr
2+
=================
3+
4+
.. automodule:: adi.ad353xr
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

‎doc/source/devices/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Supported Devices
99

1010
adi.QuadMxFE_multi
1111
adi.ad2s1210
12+
adi.ad353xr
1213
adi.ad3552r
1314
adi.ad4020
1415
adi.ad405x

‎examples/ad353xr_example.py

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Copyright (C) 2025 Analog Devices, Inc.
2+
#
3+
# All rights reserved.
4+
#
5+
# Redistribution and use in source and binary forms, with or without modification,
6+
# are permitted provided that the following conditions are met:
7+
# - Redistributions of source code must retain the above copyright
8+
# notice, this list of conditions and the following disclaimer.
9+
# - Redistributions in binary form must reproduce the above copyright
10+
# notice, this list of conditions and the following disclaimer in
11+
# the documentation and/or other materials provided with the
12+
# distribution.
13+
# - Neither the name of Analog Devices, Inc. nor the names of its
14+
# contributors may be used to endorse or promote products derived
15+
# from this software without specific prior written permission.
16+
# - The use of this software may or may not infringe the patent rights
17+
# of one or more patent holders. This license does not release you
18+
# from the requirement that you obtain separate licenses from these
19+
# patent holders to use this software.
20+
# - Use of the software either in source or binary form, must be run
21+
# on or directly connected to an Analog Devices Inc. component.
22+
#
23+
# THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
24+
# INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A
25+
# PARTICULAR PURPOSE ARE DISCLAIMED.
26+
#
27+
# IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY
29+
# RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30+
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31+
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
32+
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33+
34+
import argparse
35+
36+
from adi.ad353xr import ad353xr
37+
38+
def main():
39+
# Set up argument parser
40+
parser = argparse.ArgumentParser(description="AD353XR Example Script")
41+
parser.add_argument(
42+
"--uri",
43+
type=str,
44+
help="The URI for the AD353XR device",
45+
default="serial:COM7,230400,8n1",
46+
)
47+
parser.add_argument(
48+
"--device_name",
49+
type=str,
50+
choices=["ad3530r"],
51+
help="The device name (Supported devices are ad3530r)",
52+
default="ad3530r",
53+
)
54+
55+
# Parse arguments
56+
args = parser.parse_args()
57+
58+
# Set up AD3530R
59+
ad3530r_dev = ad353xr(uri=args.uri, device_name=args.device_name)
60+
ad3530r_dev.all_ch_operating_mode = "normal_operation"
61+
62+
ad3530r_dev.reference_select = "internal_ref"
63+
64+
# Configure channel 0
65+
chn_num = 0
66+
ad3530r_chan = ad3530r_dev.channel[chn_num]
67+
68+
# Update dac output for channel 0 instantaneously using the 'raw' attribute
69+
ad3530r_chan.raw = 25000
70+
71+
# Update dac output for channel 0 using software LDAC operation
72+
ad3530r_chan.input_register = 5000
73+
ad3530r_dev.sw_ldac_trigger = "ldac_trigger"
74+
75+
# Update dac output of channel 0 using hardware LDAC operation
76+
ad3530r_chan.input_register = 40000
77+
ad3530r_dev.hw_ldac_trigger = "ldac_trigger"
78+
79+
# Set mux value to "vout0" to monitor vout0 value on the mux_out pin
80+
ad3530r_dev.mux_out_select = "VOUT0"
81+
82+
# Set 0 to 2Vref as output range
83+
ad3530r_dev.range = "0_to_2VREF"
84+
85+
# Determine output voltage using scale and offset
86+
raw = int(ad3530r_chan.raw)
87+
scale = float(ad3530r_chan.scale)
88+
offset = int(ad3530r_chan.offset)
89+
print(f"Channel{chn_num} voltage in Volts: {(raw + offset) * scale/1000}")
90+
91+
if __name__ == "__main__":
92+
main()

‎supported_parts.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
### Currently supported hardware
1313
- AD2S1210
14+
- AD353XR (AD3530R)
1415
- AD3552r (AD3542r)
1516
- AD4000 (AD4004, AD4008)
1617
- AD4001 (AD4005)

‎test/emu/devices/ad353xr.xml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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><!ATTLIST debug-attribute name CDATA #REQUIRED><!ATTLIST buffer-attribute name CDATA #REQUIRED>]><context name="xml" description="no-OS/projects/NO_OS_PROJECT NO_OS_VERSION" ><context-attribute name="fw_version" value="6b3592a6adf" /><context-attribute name="hw_carrier" value="SDP_K1" /><context-attribute name="hw_mezzanine" value="EVAL-AD3530RARDZ" /><context-attribute name="hw_name" value="EVAL-AD3530RARDZ" /><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="ad3530r"><channel id="voltage0" name="Ch0" type="output" ><scan-element index="0" format="le:u16/16>>0" /><attribute name="input_register" filename="out_voltage0_input_register" value="0" /><attribute name="raw" filename="out_voltage0_raw" value="0" /><attribute name="scale" filename="out_voltage0_scale" value="0.0381475538" /><attribute name="offset" filename="out_voltage0_offset" value="0" /><attribute name="operating_mode" filename="out_voltage0_operating_mode" value="32kOhm_to_gnd" /><attribute name="operating_mode_available" filename="out_voltage0_operating_mode_available" value="normal_operation 1kOhm_to_gnd 7k7Ohm_to_gnd 32kOhm_to_gnd" /></channel><channel id="voltage1" name="Ch1" type="output" ><scan-element index="1" format="le:u16/16>>0" /><attribute name="input_register" filename="out_voltage1_input_register" value="0" /><attribute name="raw" filename="out_voltage1_raw" value="0" /><attribute name="scale" filename="out_voltage1_scale" value="0.0381475538" /><attribute name="offset" filename="out_voltage1_offset" /><attribute name="operating_mode" filename="out_voltage1_operating_mode" value="32kOhm_to_gnd" /><attribute name="operating_mode_available" filename="out_voltage1_operating_mode_available" value="normal_operation 1kOhm_to_gnd 7k7Ohm_to_gnd 32kOhm_to_gnd" /></channel><channel id="voltage2" name="Ch2" type="output" ><scan-element index="2" format="le:u16/16>>0" /><attribute name="input_register" filename="out_voltage2_input_register" value="0" /><attribute name="raw" filename="out_voltage2_raw" value="0" /><attribute name="scale" filename="out_voltage2_scale" value="0.0381475538" /><attribute name="offset" filename="out_voltage2_offset" value="0" /><attribute name="operating_mode" filename="out_voltage2_operating_mode" value="32kOhm_to_gnd" /><attribute name="operating_mode_available" filename="out_voltage2_operating_mode_available" value="normal_operation 1kOhm_to_gnd 7k7Ohm_to_gnd 32kOhm_to_gnd" /></channel><channel id="voltage3" name="Ch3" type="output" ><scan-element index="3" format="le:u16/16>>0" /><attribute name="input_register" filename="out_voltage3_input_register" value="0" /><attribute name="raw" filename="out_voltage3_raw" value="0" /><attribute name="scale" filename="out_voltage3_scale" value="0.0381475538" /><attribute name="offset" filename="out_voltage3_offset" value="0" /><attribute name="operating_mode" filename="out_voltage3_operating_mode" value="32kOhm_to_gnd" /><attribute name="operating_mode_available" filename="out_voltage3_operating_mode_available" value="normal_operation 1kOhm_to_gnd 7k7Ohm_to_gnd 32kOhm_to_gnd" /></channel><channel id="voltage4" name="Ch4" type="output" ><scan-element index="4" format="le:u16/16>>0" /><attribute name="input_register" filename="out_voltage4_input_register" value="0" /><attribute name="raw" filename="out_voltage4_raw" value="0" /><attribute name="scale" filename="out_voltage4_scale" value="0.0381475538" /><attribute name="offset" filename="out_voltage4_offset" value="0" /><attribute name="operating_mode" filename="out_voltage4_operating_mode" value="32kOhm_to_gnd" /><attribute name="operating_mode_available" filename="out_voltage4_operating_mode_available" value="0" /></channel><channel id="voltage5" name="Ch5" type="output" ><scan-element index="5" format="le:u16/16>>0" /><attribute name="input_register" filename="out_voltage5_input_register" value="0" /><attribute name="raw" filename="out_voltage5_raw" value="0" /><attribute name="scale" filename="out_voltage5_scale" value="0.0381475538" /><attribute name="offset" filename="out_voltage5_offset" value="0" /><attribute name="operating_mode" filename="out_voltage5_operating_mode" value="32kOhm_to_gnd" /><attribute name="operating_mode_available" filename="out_voltage5_operating_mode_available" value="normal_operation 1kOhm_to_gnd 7k7Ohm_to_gnd 32kOhm_to_gnd" /></channel><channel id="voltage6" name="Ch6" type="output" ><scan-element index="6" format="le:u16/16>>0" /><attribute name="input_register" filename="out_voltage6_input_register" value="0" /><attribute name="raw" filename="out_voltage6_raw" value="0" /><attribute name="scale" filename="out_voltage6_scale" value="0.0381475538" /><attribute name="offset" filename="out_voltage6_offset" value="0" /><attribute name="operating_mode" filename="out_voltage6_operating_mode" value="32kOhm_to_gnd" /><attribute name="operating_mode_available" filename="out_voltage6_operating_mode_available" value="normal_operation 1kOhm_to_gnd 7k7Ohm_to_gnd 32kOhm_to_gnd" /></channel><channel id="voltage7" name="Ch7" type="output" ><scan-element index="7" format="le:u16/16>>0" /><attribute name="input_register" filename="out_voltage7_input_register" value="0" /><attribute name="raw" filename="out_voltage7_raw" value="0" /><attribute name="scale" filename="out_voltage7_scale" value="0.0381475538" /><attribute name="offset" filename="out_voltage7_offset" value="0" /><attribute name="operating_mode" filename="out_voltage7_operating_mode" value="32kOhm_to_gnd" /><attribute name="operating_mode_available" filename="out_voltage7_operating_mode_available" value="normal_operation 1kOhm_to_gnd 7k7Ohm_to_gnd 32kOhm_to_gnd" /><attribute name="reference_select" value="external_ref" /><attribute name="reference_select_available" value="external_ref internal_ref" /><attribute name="range" value="0_to_VREF" /><attribute name="range_available" value="0_to_VREF 0_to_2VREF" /><attribute name="mux_out_select" value="powered_down" /><attribute name="mux_out_select_available" value="powered_down VOUT0 IOUT0_source IOUT0_sink VOUT1 IOUT1_source IOUT1_sink VOUT2 IOUT2_source IOUT2_sink VOUT3 IOUT3_source IOUT3_sink VOUT4 IOUT4_source IOUT4_sink VOUT5 IOUT5_source IOUT5_sink VOUT6 IOUT6_source IOUT6_sink VOUT7 IOUT7_source IOUT7_sink" /><attribute name="all_ch_operating_mode" value="32kOhm_to_gnd" /><attribute name="all_ch_operating_mode_available" value="normal_operation 1kOhm_to_gnd 7k7Ohm_to_gnd 32kOhm_to_gnd" /><attribute name="all_ch_input_registers" value="0" /><attribute name="all_ch_raw" value="0" /><attribute name="sampling_frequency" value="562746" /><attribute name="sw_ldac_trigger" value="ldac_trigger" /><attribute name="sw_ldac_trigger_available" value="ldac_trigger" /><attribute name="hw_ldac_trigger" value="ldac_trigger" /><attribute name="hw_ldac_trigger_available" value="ldac_trigger" /><debug-attribute name="direct_reg_access" /></device></context>

‎test/emu/hardware_map.yml

+8
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,14 @@ adxl355:
373373
- filename: adxl355.xml
374374
- data_devices:
375375
- iio:device0
376+
ad3530r:
377+
- ad3530r
378+
- pyadi_iio_class_support:
379+
- ad353xr
380+
- emulate:
381+
- filename: ad353xr.xml
382+
- data_devices:
383+
- iio:device0
376384
ad3552r:
377385
- ad3552r
378386
- pyadi_iio_class_support:

‎test/test_ad353xr.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import pytest
2+
3+
hardware = "ad3530r"
4+
classname = "adi.ad353xr"
5+
6+
#########################################
7+
@pytest.mark.iio_hardware(hardware)
8+
@pytest.mark.parametrize("classname", [(classname)])
9+
@pytest.mark.parametrize(
10+
"attr, start, stop, step, tol, repeats, sub_channel",
11+
[
12+
("raw", 0, 20000, 2000, 1, 3, "voltage0"),
13+
("raw", 0, 20000, 2000, 1, 3, "voltage1"),
14+
],
15+
)
16+
def test_ad353xr_raw_attr(
17+
test_attribute_single_value,
18+
iio_uri,
19+
classname,
20+
attr,
21+
start,
22+
stop,
23+
step,
24+
tol,
25+
repeats,
26+
sub_channel,
27+
):
28+
test_attribute_single_value(
29+
iio_uri, classname, attr, start, stop, step, tol, repeats, sub_channel
30+
)

0 commit comments

Comments
 (0)
Please sign in to comment.