-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #487 from machschmitt/staging/adaq4224
Add support for ADAQ42xx
- Loading branch information
Showing
10 changed files
with
151 additions
and
9 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Copyright (C) 2023 Analog Devices, Inc. | ||
# | ||
# SPDX short identifier: ADIBSD | ||
|
||
import sys | ||
|
||
import adi | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
# Optionally pass URI as command line argument, | ||
# else use default context manager search | ||
my_uri = sys.argv[1] if len(sys.argv) >= 2 else None | ||
print("uri: " + str(my_uri)) | ||
|
||
device_name = "adaq4224" | ||
|
||
adc = adi.adaq42xx(uri=my_uri, device_name=device_name) | ||
adc.rx_buffer_size = 500 | ||
adc.sample_rate = 2000000 | ||
try: | ||
adc.sample_averaging = 16 | ||
except: | ||
print("Sample average not supported in this mode") | ||
|
||
# Available gains are 0.33, 0.56, 2.22, 6.67 | ||
# but due to Linux ABI technicalities they must be expressed with different values. | ||
|
||
gains_avail = adc.chan0.scale_available | ||
|
||
adc.chan0.scale = gains_avail[0] | ||
print("Sampling with gain set to 0.33") | ||
|
||
data = adc.rx() | ||
|
||
for ch in range(0, len(data)): | ||
x = np.arange(0, len(data[ch])) | ||
plt.figure(adc._ctrl.channels[ch]._name) | ||
plt.plot(x, data[ch]) | ||
plt.title("Samples read with 0.33 gain") | ||
plt.show() | ||
|
||
adc.chan0.scale = gains_avail[1] | ||
print("Sampling with gain set to 0.56") | ||
|
||
data = adc.rx() | ||
|
||
for ch in range(0, len(data)): | ||
x = np.arange(0, len(data[ch])) | ||
plt.figure(adc._ctrl.channels[ch]._name) | ||
plt.plot(x, data[ch]) | ||
plt.title("Samples read with 0.56 gain") | ||
plt.show() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,6 +105,9 @@ | |
- AD4858 | ||
- AD9739A | ||
- ADA4961 | ||
- ADAQ4216 | ||
- ADAQ4220 | ||
- ADAQ4224 | ||
- ADAQ8092 | ||
- ADAR1000 | ||
- ADF4159 | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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="network" description="10.48.65.140 Linux analog 5.15.0-175797-g686d161a4f43 #385 SMP PREEMPT Fri Sep 22 17:08:22 EEST 2023 armv7l" ><context-attribute name="hdl_system_id" value="[AD463XADAQ42XXN0_CLKMODE0_NUMOFSDI1_CAPTUREZONE2_DDREN0/ad463x_adaq42xx_zed] [sys rom custom string placeholder] on [zed] git branch [dev_adaq4224_final] git [7df56bd2d04bdccc44d9bbfa94c800b828abb80f] dirty [2023-11-01 14:03:21] UTC" /><context-attribute name="hw_carrier" value="Xilinx Zynq ZED" /><context-attribute name="hw_model" value="EVAL-ADAQ4224-FMCZ on Xilinx Zynq ZED" /><context-attribute name="local,kernel" value="5.15.0-175797-g686d161a4f43" /><context-attribute name="uri" value="ip:10.48.65.140" /><context-attribute name="ip,ip-addr" value="10.48.65.140" /><device id="hwmon0" name="e000b000ethernetffffffff00" ><channel id="temp1" type="input" ><attribute name="crit" filename="temp1_crit" value="100000" /><attribute name="input" filename="temp1_input" value="31000" /><attribute name="max_alarm" filename="temp1_max_alarm" value="0" /></channel></device><device id="hwmon1" name="max31827" ><channel id="temp1" type="input" ><attribute name="enable" filename="temp1_enable" value="1" /><attribute name="input" filename="temp1_input" value="37437" /><attribute name="max" filename="temp1_max" value="100000" /><attribute name="max_alarm" filename="temp1_max_alarm" value="1" /><attribute name="max_hyst" filename="temp1_max_hyst" value="-312" /><attribute name="min" filename="temp1_min" value="-40000" /><attribute name="min_alarm" filename="temp1_min_alarm" value="0" /><attribute name="min_hyst" filename="temp1_min_hyst" value="-30000" /><attribute name="resolution" filename="temp1_resolution" value="62" /></channel><attribute name="pec" value="0" /><attribute name="update_interval" value="1000" /></device><device id="iio:device0" name="adaq4224" ><channel id="voltage0" type="input" ><scan-element index="0" format="le:s24/64>>0" scale="0.000197" /><attribute name="calibbias" filename="in_voltage0_calibbias" value="0" /><attribute name="calibscale" filename="in_voltage0_calibscale" value="1.000000" /><attribute name="scale" filename="in_voltage_scale" value="0.000196695" /><attribute name="scale_available" filename="in_voltage_scale_available" value="0.000196695 0.000333786 0.001323223 0.003975629" /></channel><attribute name="sampling_frequency" value="2000000" /><buffer-attribute name="data_available" value="0" /><buffer-attribute name="length_align_bytes" value="8" /><debug-attribute name="test_pattern_enable" value="0" /><debug-attribute name="test_pattern" value="1515851535" /><debug-attribute name="direct_reg_access" value="0x10" /></device><device id="iio:device1" name="xadc" ><channel id="voltage5" name="vccoddr" type="input" ><attribute name="label" filename="in_voltage5_vccoddr_label" value="vccoddr" /><attribute name="raw" filename="in_voltage5_vccoddr_raw" value="2028" /><attribute name="scale" filename="in_voltage5_vccoddr_scale" value="0.732421875" /></channel><channel id="voltage0" name="vccint" type="input" ><attribute name="label" filename="in_voltage0_vccint_label" value="vccint" /><attribute name="raw" filename="in_voltage0_vccint_raw" value="1348" /><attribute name="scale" filename="in_voltage0_vccint_scale" value="0.732421875" /></channel><channel id="voltage4" name="vccpaux" type="input" ><attribute name="label" filename="in_voltage4_vccpaux_label" value="vccpaux" /><attribute name="raw" filename="in_voltage4_vccpaux_raw" value="2454" /><attribute name="scale" filename="in_voltage4_vccpaux_scale" value="0.732421875" /></channel><channel id="temp0" type="input" ><attribute name="offset" filename="in_temp0_offset" value="-2219" /><attribute name="raw" filename="in_temp0_raw" value="2591" /><attribute name="scale" filename="in_temp0_scale" value="123.040771484" /></channel><channel id="voltage7" name="vrefn" type="input" ><attribute name="label" filename="in_voltage7_vrefn_label" value="vrefn" /><attribute name="raw" filename="in_voltage7_vrefn_raw" value="-2" /><attribute name="scale" filename="in_voltage7_vrefn_scale" value="0.732421875" /></channel><channel id="voltage1" name="vccaux" type="input" ><attribute name="label" filename="in_voltage1_vccaux_label" value="vccaux" /><attribute name="raw" filename="in_voltage1_vccaux_raw" value="2460" /><attribute name="scale" filename="in_voltage1_vccaux_scale" value="0.732421875" /></channel><channel id="voltage2" name="vccbram" type="input" ><attribute name="label" filename="in_voltage2_vccbram_label" value="vccbram" /><attribute name="raw" filename="in_voltage2_vccbram_raw" value="1351" /><attribute name="scale" filename="in_voltage2_vccbram_scale" value="0.732421875" /></channel><channel id="voltage3" name="vccpint" type="input" ><attribute name="label" filename="in_voltage3_vccpint_label" value="vccpint" /><attribute name="raw" filename="in_voltage3_vccpint_raw" value="1346" /><attribute name="scale" filename="in_voltage3_vccpint_scale" value="0.732421875" /></channel><channel id="voltage6" name="vrefp" type="input" ><attribute name="label" filename="in_voltage6_vrefp_label" value="vrefp" /><attribute name="raw" filename="in_voltage6_vrefp_raw" value="1701" /><attribute name="scale" filename="in_voltage6_vrefp_scale" value="0.732421875" /></channel><attribute name="sampling_frequency" value="961538" /></device><device id="iio:device2" name="one-bit-adc-dac" ><channel id="voltage0" type="input" ><attribute name="label" filename="in_voltage0_label" value="MAX17687_RST" /><attribute name="raw" filename="in_voltage0_raw" value="1" /></channel></device><device id="iio_sysfs_trigger" ><attribute name="add_trigger" value="ERROR" /><attribute name="remove_trigger" value="ERROR" /></device></context> |
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
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