Wiki

This version (01 Feb 2018 15:03) was approved by spopa.The Previously approved version (29 Jan 2018 14:56) is available.Diff

AD5676 IIO DAC Linux Driver

Supported Devices

Reference Circuits

Evaluation Boards

Description

This is a Linux industrial I/O (IIO) subsystem driver, targeting multi-channel serial interface DACs. The industrial I/O subsystem provides a unified framework for drivers for many different types of converters and sensors using a number of different physical interfaces (i2c, spi, etc). See IIO for more information.

Source Code

Status

Source Mainlined?
git [No]

Files

Devicetree

Required devicetree properties for spi devices:

  • compatible: Needs to be the name of the device. E.g. “ad5676”
  • reg: The chipselect number used for the device
  • spi-max-frequency: Maximum SPI clock frequency.
  • spi-cpol: Needs to be set for the correct SPI mode
  • vcc-supply: Phandle to the fixed regulator
        adc_vref: fixedregulator@0 {
	        compatible = "regulator-fixed";
		regulator-name = "fixed-supply";
		regulator-min-microvolt = <2500000>;
		regulator-max-microvolt = <2500000>;
		regulator-boot-on;
	};

	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";

	ad5676@0 {
		compatible = "ad5676";
		reg = <0>;
		spi-max-frequency = <1000000>;
		spi-cpha;
		vcc-supply = <&adc_vref>;
	};

Required devicetree properties for i2c devices:

  • compatible: Needs to be the name of the device. E.g. “AD5696”
  • reg: The chipselect number used for the device
  • vcc-supply: Phandle to the fixed regulator
        adc_vref: fixedregulator@0 {
	        compatible = "regulator-fixed";
		regulator-name = "fixed-supply";
		regulator-min-microvolt = <2500000>;
		regulator-max-microvolt = <2500000>;
		regulator-boot-on;
	};

	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";

	ad5696@e {
		    compatible = "ad5696";
		    reg = <0xe>;
		    vcc-supply = <&adc_vref>;
	};

Driver testing

This specifies any shell prompt running on the target

root:/> cd /sys/bus/iio/devices/
root:/sys/bus/iio/devices> ls
iio:device0

root:/sys/bus/iio/devices> cd iio\:device0

root:/sys/bus/iio/devices/iio:device0> ls -l
-r--r--r-- 1 root root 4096 Nov 11 12:03 dev
-r--r--r-- 1 root root 4096 Nov 11 12:03 name
-rw-r--r-- 1 root root 4096 Nov 11 12:03 out_voltage0_powerdown
-rw-r--r-- 1 root root 4096 Nov 11 12:03 out_voltage0_powerdown_mode
-rw-r--r-- 1 root root 4096 Nov 11 12:03 out_voltage0_raw
-rw-r--r-- 1 root root 4096 Nov 11 12:03 out_voltage1_powerdown
-rw-r--r-- 1 root root 4096 Nov 11 12:03 out_voltage1_powerdown_mode
-rw-r--r-- 1 root root 4096 Nov 11 12:03 out_voltage1_raw
-rw-r--r-- 1 root root 4096 Nov 11 12:03 out_voltage2_powerdown
-rw-r--r-- 1 root root 4096 Nov 11 12:03 out_voltage2_powerdown_mode
-rw-r--r-- 1 root root 4096 Nov 11 12:03 out_voltage2_raw
-rw-r--r-- 1 root root 4096 Nov 11 12:03 out_voltage3_powerdown
-rw-r--r-- 1 root root 4096 Nov 11 12:03 out_voltage3_powerdown_mode
-rw-r--r-- 1 root root 4096 Nov 11 12:03 out_voltage3_raw
-r--r--r-- 1 root root 4096 Nov 11 12:03 out_voltage_powerdown_mode_available
-rw-r--r-- 1 root root 4096 Nov 11 12:03 out_voltage_scale
drwxr-xr-x 2 root root    0 Nov 11 12:03 power
lrwxrwxrwx 1 root root    0 Nov 11 12:03 subsystem -> ../../../../../../../bus/iio
-rw-r--r-- 1 root root 4096 Nov 11 12:03 uevent

Show device name

This specifies any shell prompt running on the target

root:/sys/bus/iio/devices/iio:device0> cat name
ad5696

Show scale

Description:
scale to be applied to in_voltage0_raw in order to obtain the measured voltage in millivolts.

This specifies any shell prompt running on the target

root:/sys/bus/iio/devices/iio:device0> cat out_voltage_scale 
0.038146972

Set channel Y output voltage

Description:
/sys/bus/iio/devices/deviceX/out_voltageY_raw

Raw (unscaled, no bias etc.) output voltage for channel Y.

This specifies any shell prompt running on the target

root:/sys/bus/iio/devices/iio:device0> echo 10000 > out_voltage0_raw

U = out_voltage0_raw * out_voltage_scale = 10000 * 0.038140 = 381.40 mV

List available power down modes

/sys/bus/iio/devices/deviceX/out_powerdown_mode_available

Description:
Lists all available output power down modes.

This specifies any shell prompt running on the target

root:/sys/bus/iio/devices/iio:device0> cat out_voltage_powerdown_mode_available
1kohm_to_gnd 100kohm_to_gnd three_state

Set channel Y power down mode

/sys/bus/iio/devices/deviceX/out_voltageY_powerdown_mode

Description:
Specifies the output power down mode. DAC output stage is disconnected from the amplifier and

1kohm_to_gnd connected to ground via an 1kOhm resistor
100kohm_to_gnd connected to ground via an 100kOhm resistor
three_state left floating

For a list of available output power down options read out_voltageX_powerdown_mode_available.

This specifies any shell prompt running on the target

root:/sys/bus/iio/devices/iio:device0> echo three_state > out_voltage0_powerdown_mode
root:/sys/bus/iio/devices/iio:device0> cat out_voltage0_powerdown_mode
three_state

Enable power down mode on output Y

/sys/bus/iio/devices/deviceX/out_voltageY_powerdown

Description:
Writing 1 causes output Y to enter the power down mode specified by the corresponding out_voltageY_powerdown_mode. Clearing returns to normal operation. Y may be suppressed if all outputs are controlled together.

This specifies any shell prompt running on the target

root:/sys/bus/iio/devices/iio:device0> echo 1 > out_voltage0_powerdown
root:/sys/bus/iio/devices/iio:device0>  cat out_voltage0_powerdown
1
root:/sys/bus/iio/devices/iio:device0> echo 0 > out_voltage0_powerdown
root:/sys/bus/iio/devices/iio:device0>  cat out_voltage0_powerdown
0

More Information

resources/tools-software/linux-drivers/iio-dac/ad5676.txt · Last modified: 01 Feb 2018 15:03 by spopa