AD4000 driver

Device driver for Analog Devices Inc. AD4000 series of ADCs and similar devices.

Supported devices

Wiring connections

Devices of the AD4000 series can be connected to the SPI host controller in afew different modes.

CS mode, 3-wire turbo mode

Datasheet “3-wire” mode is what most resembles standard SPI connection which,for these devices, comprises of connecting the controller CS line to device CNVpin and other SPI lines as usual. This configuration is (misleadingly) called“CS Mode, 3-Wire Turbo Mode” connection in datasheets.NOTE: The datasheet definition of 3-wire mode for the AD4000 series is NOT thesame of standard spi-3wire mode.This is the only connection mode that allows configuration register access butit requires the SPI controller to support theSPI_MOSI_IDLE_HIGH feature.

Omit theadi,sdi-pin property in device tree to select this mode.

                                    +-------------++ ----------------------------------| SDO         ||                                   |             ||               +-------------------| CS          ||               v                   |             ||    +--------------------+         |     HOST    ||    |        CNV         |         |             |+--->| SDI   AD4000   SDO |-------->| SDI         |     |        SCK         |         |             |     +--------------------+         |             |               ^                    |             |               +--------------------| SCLK        |                                    +-------------+

CS mode, 3-wire, without busy indicator

Another wiring configuration supported as “3-wire” mode has the SDI pinhard-wired to digital input/output interface supply (VIO). In this setup, thecontroller is not required to supportSPI_MOSI_IDLE_HIGH but register accessis not possible. This connection mode saves one wire and works with any SPIcontroller.

Set theadi,sdi-pin device tree property to"high" to select this mode.

                                     +-------------+                +--------------------| CS          |                v                    |             |VIO   +--------------------+         |     HOST    | |    |        CNV         |         |             | +--->| SDI   AD4000   SDO |-------->| SDI         |      |        SCK         |         |             |      +--------------------+         |             |                ^                    |             |                +--------------------| SCLK        |                                     +-------------+

Alternatively, a GPIO may be connected to the device CNV pin. This is similar tothe previous wiring configuration but saves the use of a CS line.

                                     +-------------+                +--------------------| GPIO        |                v                    |             |VIO   +--------------------+         |     HOST    | |    |        CNV         |         |             | +--->| SDI   AD4000   SDO |-------->| SDI         |      |        SCK         |         |             |      +--------------------+         |             |                ^                    |             |                +--------------------| SCLK        |                                     +-------------+

CS mode, 4-wire without busy indicator

In datasheet “4-wire” mode, the controller CS line is connected to the ADC SDIpin and a GPIO is connected to the ADC CNV pin. This connection mode may bettersuit scenarios where multiple ADCs can share one CNV trigger.

Setadi,sdi-pin to"cs" to select this mode.

                                    +-------------++ ----------------------------------| CS          ||                                   |             ||               +-------------------| GPIO        ||               v                   |             ||    +--------------------+         |     HOST    ||    |        CNV         |         |             |+--->| SDI   AD4000   SDO |-------->| SDI         |     |        SCK         |         |             |     +--------------------+         |             |               ^                    |             |               +--------------------| SCLK        |                                    +-------------+

IIO Device characteristics

The AD4000 series driver supports differential and pseudo-differential ADCs.

The span compression feature available in AD4000 series devices can beenabled/disabled by changing the_scale_available attribute of the voltagechannel. Note that span compression configuration requires writing to AD4000configuration register, which is only possible when the ADC is wired in 3-wireturbo mode, and the SPI controller isSPI_MOSI_IDLE_HIGH capable. If thoseconditions are not met, no_scale_available attribute is provided.

Besides that, differential and pseudo-differential voltage channels presentslightly different sysfs interfaces.

Pseudo-differential ADCs

Typical voltage channel attributes of a pseudo-differential AD4000 series device:

Voltage Channel Attributes

Description

in_voltage0_raw

Raw ADC output code.

in_voltage0_offset

Offset to convert raw value to mV.

in_voltage0_scale

Scale factor to convert raw value to mV.

in_voltage0_scale_available

Toggles input span compression

Differential ADCs

Typical voltage channel attributes of a differential AD4000 series device:

Voltage Channel Attributes

Description

in_voltage0-voltage1_raw

Raw ADC output code.

in_voltage0-voltage1_scale

Scale factor to convert raw value to mV.

in_voltage0-voltage1_scale_available

Toggles input span compression

SPI offload support

To be able to achieve the maximum sample rate, the driver can be used with SPIoffload engines such as the one usually present inAXI SPI Engine, to provideSPI offload support.

To keep up with SPI offloading transfer speeds, the ADC must be connected eitherin 3-wire turbo mode or in 3-wire without busy indicator mode and have SPIcontroller CS line connected to the CNV pin.

When set for SPI offload support, the IIO device will provide differentinterfaces.

  • Eitherin_voltage0_sampling_frequency orin_voltage0-voltage1_sampling_frequency file is provided to allow settingthe sample rate.

  • IIO trigger device is not provided (notrigger directory).

  • timestamp channel is not provided.

Also, because the ADC output has a one sample latency (delay) when the device iswired in “3-wire” mode and only one transfer per sample is done when using SPIoffloading, the first data sample in the buffer is not valid because it containsthe output of an earlier conversion result.