Wiki

This version is outdated by a newer approved version.DiffThis version (03 Dec 2014 15:11) was approved by Paul Cercueil.

This is an old revision of the document!


AD5593R IIO DAC/ADC Linux Driver

Supported Devices

Evaluation Boards

Description

The AD5593R have eight I/Ox pins (I/O0 to I/O7) that can be independently configured as digital-to-analog converter (DAC) outputs, analog-to-digital converter (ADC) inputs, digital outputs, or digital inputs.

When an I/Ox pin is configured as an analog output, it is driven by a 12-bit DAC. The output range of the DAC is 0 V to VREF or 0 V to 2 × VREF.

When an I/Ox pin is configured as an analog input, it is connected to a 12-bit ADC via an analog multiplexer. The input range of the ADC is 0 V to VREF or 0 V to 2 × VREF. The ADC has a total throughput rate of 400 kSPS.

The I/Ox pins can also be configured as digital, general-purpose input or output (GPIO) pins. The state of the GPIO pins can be set or read back by accessing the GPIO write data register or the GPIO read configuration register, respectively, via an I2C write or read operation.

The AD5593R have an integrated 2.5 V, 25 ppm/°C reference, which is turned off by default, and an integrated temperature indicator, which gives an indication of the die temperature. The temperature value is read back as part of an ADC read sequence.

Hardware configuration

ad5592r_eval.jpg

Adding Linux driver support

Enabling the driver

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

The AD5593R Driver depends on CONFIG_I2C

Linux Kernel Configuration
    Device Drivers  --->
        ...
        <*>     Industrial I/O support --->
            --- Industrial I/O support
            ...
            Digital to analog converters  ---> 
                ...
                <*>   Analog Devices AD5593R ADC/DAC driver
                ...
            ...
        ...

Adding a device tree entry

Required properties

  • compatible: Must be one of:
    • “adi,ad5593r”
  • reg: I2C address of the chip (generally 0x10).
  • channel-modes: An array of eight 8-bit values (one per channel) describing the mode of each channel according to the following:
    • 0 = unused (pulled down),
    • 1 = DAC,
    • 2 = ADC,
    • 6 = tri-state

Device tree example

The following example instanciates the ad5593r driver for a AD5593R device connected on a I2C bus. It sets the I/O0 port as a DAC, the I/O1 and I/O2 ports as ADCs. The other I/O ports are connected to the ground with a pull-down resistor.

ad5593r@0 {
	compatible = "adi,ad5593r";
	reg = <0x10>;
	channel-modes = /bits/ 8 <1 2 2 0 0 0 0 0>;
};

Driver testing

If the driver correctly detected the device, the “iio_info” program should inform us about the available channels:

root@linaro-ubuntu-desktop:~# iio_info 
IIO context created: local
IIO context has 1 devices:
        iio:device1: ad5593r
                3 channels found:
                        voltage0:  (output)
                        1 channel-specific attributes found:
                                attr 0: raw value: 0
                        voltage1:  (input)
                        1 channel-specific attributes found:
                                attr 0: raw value: 0
                        voltage2:  (input)
                        1 channel-specific attributes found:
                                attr 0: raw value: 0
resources/tools-software/linux-drivers/iio-dac/ad5593r.1417615890.txt.gz · Last modified: 03 Dec 2014 15:11 by Paul Cercueil