diff --git a/adi/adis16475.py b/adi/adis16475.py
index a4a5f3354..ce8b5b2d6 100644
--- a/adi/adis16475.py
+++ b/adi/adis16475.py
@@ -65,6 +65,21 @@ def __init__(self, uri="", device_name="adis16505-2"):
self._ctrl = self._ctx.find_device(device_name)
self._rxadc = self._ctx.find_device(device_name)
+ if self._ctrl is None:
+ print(
+ "No device found with device_name = "
+ + device_name
+ + ". Searching for a device found in the compatible list."
+ )
+ for i in compatible_parts:
+ self._ctrl = self._ctx.find_device(i)
+ self._rxadc = self._ctx.find_device(i)
+ if self._ctrl is not None:
+ print("Fond device = " + i + ". Will use this device instead.")
+ break
+ if self._ctrl is None:
+ raise Exception("No compatible device found")
+
self.anglvel_x = self._channel_with_offset(self._ctrl, "anglvel_x")
self.anglvel_y = self._channel_with_offset(self._ctrl, "anglvel_y")
self.anglvel_z = self._channel_with_offset(self._ctrl, "anglvel_z")
diff --git a/test/emu/devices/adis16475.xml b/test/emu/devices/adis16475.xml
index f78c74fb6..8169a83cd 100644
--- a/test/emu/devices/adis16475.xml
+++ b/test/emu/devices/adis16475.xml
@@ -1,2 +1,123 @@
-]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/test_adis16475_p.py b/test/test_adis16475_p.py
index 2a70e76f7..81f58a2da 100644
--- a/test/test_adis16475_p.py
+++ b/test/test_adis16475_p.py
@@ -1,15 +1,110 @@
+import adi
import pytest
hardware = "adis16475"
classname = "adi.adis16475"
+@pytest.mark.iio_hardware(hardware, True)
+@pytest.mark.parametrize("classname", [(classname)])
+@pytest.mark.parametrize("channel", [0])
+def test_adis16475_rx_data(test_dma_rx, iio_uri, classname, channel):
+ test_dma_rx(iio_uri, classname, channel, buffer_size=16)
+
+
+@pytest.mark.iio_hardware(hardware)
+def test_adis16475_filter_low_pass_3db_frequency(iio_uri):
+ adis16475 = adi.adis16475(uri=iio_uri)
+
+ for i in [10, 20, 40, 80, 164, 360, 720]:
+ adis16475.filter_low_pass_3db_frequency = i
+ assert adis16475.filter_low_pass_3db_frequency == i
+
+ for i in range(0, 10):
+ adis16475.filter_low_pass_3db_frequency = i
+ assert adis16475.filter_low_pass_3db_frequency <= 10
+
+ for i in range(11, 20):
+ adis16475.filter_low_pass_3db_frequency = i
+ assert adis16475.filter_low_pass_3db_frequency <= 20
+
+ for i in range(21, 40):
+ adis16475.filter_low_pass_3db_frequency = i
+ assert adis16475.filter_low_pass_3db_frequency <= 40
+
+ for i in range(41, 80):
+ adis16475.filter_low_pass_3db_frequency = i
+ assert adis16475.filter_low_pass_3db_frequency <= 80
+
+ for i in range(81, 164):
+ adis16475.filter_low_pass_3db_frequency = i
+ assert adis16475.filter_low_pass_3db_frequency <= 164
+
+ for i in range(165, 360):
+ adis16475.filter_low_pass_3db_frequency = i
+ assert adis16475.filter_low_pass_3db_frequency <= 360
+
+ for i in range(361, 720):
+ adis16475.filter_low_pass_3db_frequency = i
+ assert adis16475.filter_low_pass_3db_frequency <= 720
+
+
+@pytest.mark.iio_hardware(hardware)
+def test_adis16475_firmware_date(iio_uri):
+ adis16475 = adi.adis16475(uri=iio_uri)
+
+ assert adis16475.firmware_date != "00-00-0000"
+
+
+@pytest.mark.iio_hardware(hardware)
+def test_adis16475_firmware_revision(iio_uri):
+ adis16475 = adi.adis16475(uri=iio_uri)
+
+ assert adis16475.firmware_revision != "0.0"
+
+
+@pytest.mark.iio_hardware(hardware)
+def test_adis16475_product_id(iio_uri):
+ adis16475 = adi.adis16475(uri=iio_uri)
+
+ assert adis16475.product_id != 0
+
+
+@pytest.mark.iio_hardware(hardware)
+def test_adis16475_serial_number(iio_uri):
+ adis16475 = adi.adis16475(uri=iio_uri)
+
+ assert adis16475.serial_number != "0x0000"
+
+
+@pytest.mark.iio_hardware(hardware)
+def test_adis16476_conv_data(iio_uri):
+ adis16475 = adi.adis16475(uri=iio_uri)
+
+ assert adis16475.accel_x_conv != 0.0
+ assert adis16475.accel_y_conv != 0.0
+ assert adis16475.accel_z_conv != 0.0
+ assert adis16475.anglvel_x_conv != 0.0
+ assert adis16475.anglvel_y_conv != 0.0
+ assert adis16475.anglvel_z_conv != 0.0
+ assert adis16475.temp_conv != 0.0
+
+
@pytest.mark.iio_hardware(hardware)
+@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize(
- "classname, attr, start, stop, step, tol",
- [(classname, "sample_rate", 1000, 2000, 1000, 0)],
+ "attr, start, stop, step, tol",
+ [
+ ("sample_rate", 1000, 2000, 1000, 0),
+ ("anglvel_x_calibbias", -2147483648, 2147483647, 1, 0),
+ ("anglvel_y_calibbias", -2147483648, 2147483647, 1, 0),
+ ("anglvel_z_calibbias", -2147483648, 2147483647, 1, 0),
+ ("accel_x_calibbias", -2147483648, 2147483647, 1, 0),
+ ("accel_y_calibbias", -2147483648, 2147483647, 1, 0),
+ ("accel_z_calibbias", -2147483648, 2147483647, 1, 0),
+ ],
)
-def test_adis16475_sample_rate(
+def test_adis16475_attr(
test_attribute_single_value, iio_uri, classname, attr, start, stop, step, tol
):
test_attribute_single_value(iio_uri, classname, attr, start, stop, step, tol)