Wiki

This version (30 Apr 2021 08:56) was approved by Nuno Sá.

AD9162 DAC Linux Driver

Supported Devices

Evaluation Boards

HDL Support

Description

The AD9161/AD91621 are high performance, 11-bit/16-bit digital-to-analog converters (DACs) that supports data rates to 6 GSPS. The DAC core is based on a quad-switch architecture coupled with a 2x interpolator filter that enables an effective DAC update rate of up to 12 GSPS in some modes. The high dynamic range and bandwidth makes these DACs ideally suited for the most demanding high speed radio frequency (RF) DAC applications.

Source Code

Status

Files

Example platform device initialization

The AD9162 driver is a SPI bus driver and can be instantiated via device tree.

For detailed information about the required/optional devicetree properties look at ad916x.yaml and ad916x-amp.yaml.

Enabling Linux driver support

Configure kernel with “make menuconfig” (alternatively use “make xconfig” or “make qconfig”)

The AD9162 driver depends on CONFIG_SPI and CONFIG_CF_AXI_DDS

Adding Linux driver support

Configure kernel with “make menuconfig” (alternatively use “make xconfig” or “make qconfig”)

Linux Kernel Configuration
	Device Drivers  --->
	<*>     Industrial I/O support --->
	    --- Industrial I/O support
	    -*-   Enable ring buffer support within IIO
	    -*-     Industrial I/O lock free software ring
	    -*-   Enable triggered sampling support

	          *** Direct Digital Synthesis ***
	    [--snip--]

		<*>   Analog Devices CoreFPGA AXI DDS driver
		<*>   Analog Devices AD9162 DAC 

	    [--snip--]

Driver testing

Each and every IIO device, typically a hardware chip, has a device folder under /sys/bus/iio/devices/iio:deviceX. Where X is the IIO index of the device. Under every of these directory folders reside a set of files, depending on the characteristics and features of the hardware device in question. These files are consistently generalized and documented in the IIO ABI documentation. In order to determine which IIO deviceX corresponds to which hardware device, the user can read the name file /sys/bus/iio/devices/iio:deviceX/name. In case the sequence in which the iio device drivers are loaded/registered is constant, the numbering is constant and may be known in advance.

02 Mar 2011 15:16

The driver has two main ways of functioning depending on the adi,standalone-probe devicetree property. If set, the driver will probe in standalone mode which means that it won't link with the AXI DAC HDL Linux Driver. This means that different attributes will be seen depending on the working mode. The next ABI is the same independent of the working mode.

Show device name

This specifies any shell prompt running on the target

analog@analog:/sys/bus/iio/devices/iio:device2 $ cat name 
ad9166

Change NCO Frequency

What: out_voltageX_nco_frequency

Set channel NCO frequency (fCARRIER) in Hz

Range is: −fclk/2 ≤ fCARRIER < +fclk/2 or 0 ≤ fCARRIER < fclk if FIR85 is enabled

This specifies any shell prompt running on the target

analog@analog:/sys/bus/iio/devices/iio:device2 $ echo 1000000000 > out_altvoltage0_nco_frequency
analog@analog:/sys/bus/iio/devices/iio:device2 $ cat out_altvoltage0_nco_frequency
1000000000

Standalone Mode

This mode can be used together with adi,dc-test-en for running the device as a signal generator. The present attributes are:

This specifies any shell prompt running on the target

analog@analog:~ $ cd /sys/bus/iio/devices/iio\:device2
analog@analog:/sys/bus/iio/devices/iio:device2 $ 
analog@analog:/sys/bus/iio/devices/iio:device2 $ ls -l
total 0
-r--r--r-- 1 root root 4096 Jan 18 22:03 dev
-rw-r--r-- 1 root root 4096 Jan 18 22:03 fir85_enable
-rw-r--r-- 1 root root 4096 Jan 18 22:03 in_temp0_input
-rw-r--r-- 1 root root 4096 Jan 18 22:03 in_temp0_raw
-rw-r--r-- 1 root root 4096 Jan 18 22:03 in_temp0_single_point_calib
-r--r--r-- 1 root root 4096 Jan 18 22:03 name
lrwxrwxrwx 1 root root    0 Jan 18 22:03 of_node -> ../../../../../../../../firmware/devicetree/base/soc/spi@7e204000/ad9166@0
-rw-r--r-- 1 root root 4096 Jan 18 22:03 out_altvoltage0_nco_frequency
-rw-r--r-- 1 root root 4096 Jan 18 22:03 out_altvoltage0_raw
drwxr-xr-x 2 root root    0 Jan 18 22:03 power
-rw-r--r-- 1 root root 4096 Jan 18 22:03 sampling_frequency
lrwxrwxrwx 1 root root    0 Jan 18 22:03 subsystem -> ../../../../../../../../bus/iio
-rw-r--r-- 1 root root 4096 Jan 18 22:03 uevent

Change DC Test Word

What: out_altvoltageX_raw

Set the DC test word data. This will be the data source of the digital path when adi,dc-test-en is enabled. We can control the signal amplitude with this attribute.

This specifies any shell prompt running on the target

analog@analog:/sys/bus/iio/devices/iio:device2 $ echo 100 > out_altvoltage0_raw
analog@analog:/sys/bus/iio/devices/iio:device2 $ cat out_altvoltage0_raw
100

Change Temperature Sensor Single point calibration

What: in_tempX_single_point_calib

This setting allows for runtime calibration of the device internal temperature sensor (mostly useful for evaluation and testing). For that, a valid temperature in milli degrees °C should be written to this attribute. Internally, the driver will get the raw temperature value. With this pair of values, the driver can then calculate the parameters needed to get the processed temperature from the sensor…

This specifies any shell prompt running on the target

analog@analog:/sys/bus/iio/devices/iio:device2 $ echo 45000 > in_temp0_single_point_calib

Read Temperature

What: in_tempX_input

To get the temperature already processed in milli degrees °C:

This specifies any shell prompt running on the target

analog@analog:/sys/bus/iio/devices/iio:device2 $ cat in_temp0_input 
75000

What: in_tempX_raw

To get the raw value:

This specifies any shell prompt running on the target

analog@analog:/sys/bus/iio/devices/iio:device2 $ cat in_temp0_raw
25010

Enable FIR85 filter

What: fir85_enable

With fir85 enabled, 0 ≤ fCARRIER < fclk.

This specifies any shell prompt running on the target

analog@analog:/sys/bus/iio/devices/iio:device2 $ echo 1 > fir85_enable
analog@analog:/sys/bus/iio/devices/iio:device2 $ cat fir85_enable
1

Attached Mode

As said, in this mode the driver is used in conjunction with the AXI DAC HDL Linux Driver.

This specifies any shell prompt running on the target

analog@analog:~$ cd /sys/bus/iio/devices/iio\:device6
analog@analog:/sys/bus/iio/devices/iio:device6$ 
analog@analog:/sys/bus/iio/devices/iio:device6$ 
analog@analog:/sys/bus/iio/devices/iio:device6$ ls -la
total 0
drwxr-xr-x 5 root root    0 Apr 27 16:20 .
drwxr-xr-x 4 root root    0 Apr 27 16:20 ..
drwxr-xr-x 2 root root    0 Apr 27 16:20 buffer
-r--r--r-- 1 root root 4096 Apr 27 16:20 dev
-r--r--r-- 1 root root 4096 Apr 27 16:20 name
lrwxrwxrwx 1 root root    0 Apr 27 16:20 of_node -> ../../../../../firmware/devicetree/base/fpga-axi@0/axi-ad9162-hpc@44a04000
-rw-r--r-- 1 root root 4096 Apr 27 16:20 out_altvoltage0_1A_frequency
-rw-r--r-- 1 root root 4096 Apr 27 16:20 out_altvoltage0_1A_phase
-rw-r--r-- 1 root root 4096 Apr 27 16:20 out_altvoltage0_1A_raw
-rw-r--r-- 1 root root 4096 Apr 27 16:20 out_altvoltage0_1A_scale
-rw-r--r-- 1 root root 4096 Apr 27 16:20 out_altvoltage1_1B_frequency
-rw-r--r-- 1 root root 4096 Apr 27 16:20 out_altvoltage1_1B_phase
-rw-r--r-- 1 root root 4096 Apr 27 16:20 out_altvoltage1_1B_raw
-rw-r--r-- 1 root root 4096 Apr 27 16:20 out_altvoltage1_1B_scale
-rw-r--r-- 1 root root 4096 Apr 27 16:20 out_altvoltage2_frequency_nco
-rw-r--r-- 1 root root 4096 Apr 27 16:20 out_altvoltage_sampling_frequency
-rw-r--r-- 1 root root 4096 Apr 27 16:20 out_voltage0_calibphase
-rw-r--r-- 1 root root 4096 Apr 27 16:20 out_voltage0_calibscale
-rw-r--r-- 1 root root 4096 Apr 27 16:20 out_voltage1_calibphase
-rw-r--r-- 1 root root 4096 Apr 27 16:20 out_voltage1_calibscale
-rw-r--r-- 1 root root 4096 Apr 27 16:20 out_voltage_fir85_enable
-rw-r--r-- 1 root root 4096 Apr 27 16:20 out_voltage_sampling_frequency
drwxr-xr-x 2 root root    0 Apr 27 16:20 power
drwxr-xr-x 2 root root    0 Apr 27 16:20 scan_elements
lrwxrwxrwx 1 root root    0 Apr 27 16:20 subsystem -> ../../../../../bus/iio
-rw-r--r-- 1 root root 4096 Apr 27 16:20 uevent

Enable FIR85 filter

What: out_voltage_fir85_enable

With fir85 enabled, 0 ≤ fCARRIER < fclk.

This specifies any shell prompt running on the target

analog@analog:/sys/bus/iio/devices/iio:device6 $ echo 1 > out_voltage_fir85_enable
analog@analog:/sys/bus/iio/devices/iio:device6 $ cat out_voltage_fir85_enable
1

Documentation for following subfolders and channel attributes can be found here: AXI DAC HDL Linux Driver

  • buffer
  • name
  • out_altvoltage0_1A_frequency
  • out_altvoltage0_1A_phase
  • out_altvoltage0_1A_raw
  • out_altvoltage0_1A_scale
  • out_altvoltage1_1B_frequency
  • out_altvoltage1_1B_phase
  • out_altvoltage1_1B_raw
  • out_altvoltage1_1B_scale
  • out_altvoltage_sampling_frequency
  • out_voltage0_calibphase
  • out_voltage0_calibscale
  • out_voltage1_calibphase
  • out_voltage1_calibscale
  • out_voltage_sampling_frequency
  • scan_elements

AD9166 Amplifier

The AD9166 comes with an integrated differential to single-ended output buffer amplifier, matched to a 50Ω load up to 10 GHz. This amplifier has it's own SPI interface and thus, it has it's own device driver. For more info go to AD9166-AMP.

More Information

resources/tools-software/linux-drivers/iio-pll/ad9162.txt · Last modified: 28 Apr 2021 12:39 by Nuno Sá