Wiki

The most recent version of this page is a draft.DiffThis version (10 May 2021 12:35) was approved by Antoniu Miclaus.

This is an old revision of the document!


ADA4250 Programmable Gain Instrumentation Amplifier Linux Driver

Supported Devices

Evaluation Boards

Description

This is a Linux industrial I/O (IIO) subsystem driver, targeting serial interface PGA amplifiers. 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 WIP

Files

Declaring SPI slave devices

Unlike PCI or USB devices, SPI devices are not enumerated at the hardware level. Instead, the software must know which devices are connected on each SPI bus segment, and what slave selects these devices are using. For this reason, the kernel code must instantiate SPI devices explicitly. The most common method is to declare the SPI devices by bus number.

This method is appropriate when the SPI bus is a system bus, as in many embedded systems, wherein each SPI bus has a number which is known in advance. It is thus possible to pre-declare the SPI devices that inhabit this bus. This is done with an array of struct spi_board_info, which is registered by calling spi_register_board_info().

For more information see: Documentation/spi/spi-summary.rst

21 Oct 2010 16:10

properties

compatible:

  • enum:
    • adi,ada4250

reg:

  • maxItems: 1

avdd-supply:

  • description: analog voltage regulator (see regulator/regulator.txt)

adi,refbuf-enable:

  • description: Enable internal buffer to drive the reference pin.
  • type: boolean

required:

  • compatible
  • reg
  • avdd-supply

Example

    spi {
      #address-cells = <1>;
      #size-cells = <0>;
      status = "okay";
      ada4250@0{
        compatible = "adi,ada4250";
        reg = <0>;
        avdd-supply = <&avdd>;
      };
    };

Adding Linux driver support

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

The AD8366 Driver depends on CONFIG_SPI

Linux Kernel Configuration
	Device Drivers  --->
		<*>     Industrial I/O support --->
		    --- Industrial I/O support
				Amplifiers  --->
					<*> Analog Devices ADA4250 Instrumentation Amplifier

Hardware configuration

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

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> iio:device0

root:/> ls -l
-r--r--r-- 1 root root 4096 May  6 12:20 dev
-r--r--r-- 1 root root 4096 May  6 12:20 name
-rw-r--r-- 1 root root 4096 May  6 13:00 out_voltage0_calibbias
-r--r--r-- 1 root root 4096 May  6 12:20 out_voltage0_calibbias_available
-rw-r--r-- 1 root root 4096 May  6 13:00 out_voltage0_hardwaregain
-r--r--r-- 1 root root 4096 May  6 12:20 out_voltage0_hardwaregain_available
-rw-r--r-- 1 root root 4096 May  6 13:01 out_voltage0_offset
lrwxrwxrwx 1 root root    0 May  6 12:20 subsystem -> ../../../../../../../../bus/iio
-rw-r--r-- 1 root root 4096 May  6 12:20 uevent

Show device name

This specifies any shell prompt running on the target

root:/> cd /sys/bus/iio/devices/iio\:device0/
root:/> cat name
ada4250

Set ChannelY Gain

/sys/bus/iio/devices/iio:deviceX/out_voltageY_hardwaregain

Hardware applied gain factor. If shared across all channels, <type>_hardwaregain is used.

This specifies any shell prompt running on the target

root:/> cat out_voltage0_hardwaregain_available
0 1 2 3 4 5 6 7

root:/> cat out_voltage0_hardwaregain
0

root:/> echo 1 > out_voltage0_hardwaregain
root:/> cat out_voltage0_hardwaregain
1

Set ChannelY Current Bias Set

/sys/bus/iio/devices/iio:deviceX/out_voltageY_calibbias

Current bias for different ranges of the sensor offset calibration. If shared across all channels, <type>_calibbias is used.

This specifies any shell prompt running on the target

root:/> cat out_voltage0_calibbias_available
0 1 2 3

root:/> cat out_voltage0_calibbias
0

root:/> echo 2 > out_voltage0_calibbias
root:/> cat out_voltage0_calibbias
2

Set ChannelY Offset value

/sys/bus/iio/devices/iio:deviceX/out_voltageY_offset

Sensor offset calibration value in uV. If shared across all channels, <type>_offset is used.

This specifies any shell prompt running on the target

root:/> cat out_voltage0_offset
0

root:/> echo -32000 > out_voltage0_offset
root:/> cat out_voltage0_offset
-31752

More Information

/srv/wiki.analog.com/data/pages/resources/tools-software/linux-drivers/iio-amplifiers/ada4250.txt · Last modified: 27 Jun 2021 14:01 by Antoniu Miclaus