This shows you the differences between two versions of the page.
Previous revisionNext revision | |||
— | resources:tools-software:linux-drivers:iio-adc:ad738x [17 Oct 2018 15:43] – created Stefan Popa | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== AD738x IIO Dual Channel Serial ADC Linux Driver ====== | ||
+ | ===== Supported Devices ===== | ||
+ | |||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | ===== Evaluation Boards ===== | ||
+ | |||
+ | * [[adi> | ||
+ | |||
+ | ===== Description ===== | ||
+ | |||
+ | This is a Linux industrial I/O ([[software: | ||
+ | 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 [[software: | ||
+ | |||
+ | ====== Source Code ====== | ||
+ | |||
+ | ===== Status ===== | ||
+ | |||
+ | ^ Source ^ Mainlined? ^ | ||
+ | | [[https:// | ||
+ | |||
+ | ===== Files ===== | ||
+ | |||
+ | ^ Function ^ File ^ | ||
+ | | driver | ||
+ | |||
+ | ===== Devicetree ===== | ||
+ | |||
+ | Required devicetree properties: | ||
+ | * compatible: Needs to be the name of the device. E.g. " | ||
+ | * reg: The chipselect number used for the device | ||
+ | * spi-max-frequency: | ||
+ | * spi-cpol: Needs to be set for the correct SPI mode | ||
+ | * vref-supply: | ||
+ | |||
+ | < | ||
+ | adc_vref: fixedregulator@0 { | ||
+ | compatible = " | ||
+ | regulator-name = " | ||
+ | regulator-min-microvolt = < | ||
+ | regulator-max-microvolt = < | ||
+ | regulator-boot-on; | ||
+ | }; | ||
+ | |||
+ | # | ||
+ | # | ||
+ | status = " | ||
+ | |||
+ | ad738x@0 { | ||
+ | compatible = " | ||
+ | reg = <0>; | ||
+ | spi-max-frequency = < | ||
+ | spi-cpol; | ||
+ | vref-supply = <& | ||
+ | }; | ||
+ | </ | ||
+ | |||
+ | ====== Driver testing ====== | ||
+ | |||
+ | <WRAP box bggreen>< | ||
+ | < | ||
+ | root:/> **cd / | ||
+ | root:/ | ||
+ | iio:device0 | ||
+ | |||
+ | root:/ | ||
+ | |||
+ | root:/ | ||
+ | drwxr-xr-x 2 root root 0 Sep 12 20:11 buffer | ||
+ | -r--r--r-- 1 root root 4096 Sep 12 20:11 dev | ||
+ | -rw-r--r-- 1 root root 4096 Sep 12 20:11 in_voltage0_raw | ||
+ | -rw-r--r-- 1 root root 4096 Sep 12 20:11 in_voltage1_raw | ||
+ | -rw-r--r-- 1 root root 4096 Sep 12 20:11 in_voltage_scale | ||
+ | -r--r--r-- 1 root root 4096 Sep 12 20:11 name | ||
+ | lrwxrwxrwx 1 root root 0 Sep 12 20:11 of_node -> ../ | ||
+ | drwxr-xr-x 2 root root 0 Sep 12 20:11 power | ||
+ | drwxr-xr-x 2 root root 0 Sep 12 20:11 scan_elements | ||
+ | lrwxrwxrwx 1 root root 0 Sep 12 20:11 subsystem -> ../ | ||
+ | drwxr-xr-x 2 root root 0 Sep 12 20:11 trigger | ||
+ | -rw-r--r-- 1 root root 4096 Sep 12 20:11 uevent | ||
+ | </ | ||
+ | |||
+ | === Show device name === | ||
+ | |||
+ | <WRAP box bggreen>< | ||
+ | < | ||
+ | root:/ | ||
+ | ad7380 | ||
+ | </ | ||
+ | |||
+ | === Show scale === | ||
+ | |||
+ | **Description: | ||
+ | scale to be applied to in_voltage0_raw in order to obtain the measured voltage in millivolts. | ||
+ | |||
+ | <WRAP box bggreen>< | ||
+ | < | ||
+ | root:/ | ||
+ | 0.076293945 | ||
+ | </ | ||
+ | |||
+ | === Show channel 0 measurement === | ||
+ | |||
+ | **Description: | ||
+ | Raw unscaled voltage measurement on channel 0 | ||
+ | |||
+ | <WRAP box bggreen>< | ||
+ | < | ||
+ | root:/ | ||
+ | 28583 | ||
+ | </ | ||
+ | |||
+ | **U** = // | ||
+ | |||
+ | ===== Trigger management ===== | ||
+ | |||
+ | If deviceX supports triggered sampling, it’s a so called trigger consumer and there will be an additional folder / | ||
+ | |||
+ | This driver uses **high resolution timers** as interrupt source | ||
+ | |||
+ | **Description: | ||
+ | Hrtimer triggers creation and destruction | ||
+ | |||
+ | Loading iio-trig-hrtimer module will register hrtimer trigger types allowing users to create hrtimer triggers: | ||
+ | |||
+ | <WRAP box bggreen>< | ||
+ | < | ||
+ | root:/ | ||
+ | </ | ||
+ | |||
+ | **Description: | ||
+ | Read name of trigger0 | ||
+ | |||
+ | <WRAP box bggreen>< | ||
+ | < | ||
+ | root:/ | ||
+ | trigger0 | ||
+ | </ | ||
+ | |||
+ | **Description: | ||
+ | Configure the sampling frequency of trigger0 | ||
+ | |||
+ | <WRAP box bggreen>< | ||
+ | < | ||
+ | root:/ | ||
+ | trigger0 | ||
+ | </ | ||
+ | |||
+ | **Description: | ||
+ | Make trigger0 to current trigger of device0 | ||
+ | |||
+ | <WRAP box bggreen>< | ||
+ | < | ||
+ | root:/ | ||
+ | </ | ||
+ | |||
+ | **Description: | ||
+ | Read current trigger source of device0 | ||
+ | |||
+ | <WRAP box bggreen>< | ||
+ | < | ||
+ | root:/ | ||
+ | trigger0 | ||
+ | </ | ||
+ | |||
+ | ===== Buffer management ===== | ||
+ | |||
+ | <WRAP box bggreen>< | ||
+ | < | ||
+ | root:/ | ||
+ | **enable** | ||
+ | root:/ | ||
+ | </ | ||
+ | |||
+ | Every buffer implementation features a set of files: | ||
+ | |||
+ | **length**\\ | ||
+ | Get/set the number of sample sets that may be held by the buffer. | ||
+ | |||
+ | **enable**\\ | ||
+ | Enables/ | ||
+ | |||
+ | **scan_elements**\\ | ||
+ | The scan_elements directory contains interfaces for elements that will be captured for a single triggered sample set in the buffer. | ||
+ | |||
+ | <WRAP box bggreen>< | ||
+ | < | ||
+ | root:/ | ||
+ | in_voltage0_en in_voltage0_index | ||
+ | root:/ | ||
+ | </ | ||
+ | |||
+ | **in_voltageX_en / in_voltageX-voltageY_en / timestamp_en: | ||
+ | Scan element control for triggered data capture. Writing 1 will enable the scan element, writing 0 will disable it | ||
+ | |||
+ | **in_voltageX_type / in_voltageX-voltageY_type / timestamp_type: | ||
+ | Description of the scan element data storage within the buffer and therefore in the form in which it is read from user-space. Form is [s|u]bits/ | ||
+ | |||
+ | **in_voltageX_index / in_voltageX-voltageY_index / timestamp_index: | ||
+ | A single positive integer specifying the position of this scan element in the buffer. Note these are not dependent on what is enabled and may not be contiguous. Thus for user-space to establish the full layout these must be used in conjunction with all _en attributes to establish which channels are present, and the relevant _type attributes to establish the data storage format. | ||
+ | |||
+ | ====== More Information ====== | ||
+ | |||
+ | {{page> |