This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
resources:tools-software:linux-drivers:iio-adc:ad7793 [26 Aug 2011 21:45] – [Supported Devices] Michael Hennerich | resources:tools-software:linux-drivers:iio-adc:ad7793 [05 Jan 2021 15:59] (current) – Removed old references Ioana Chelaru | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== Supported Devices ===== | ===== Supported Devices ===== | ||
- | This driver supports the\\ | + | * [[adi> |
- | [[adi> | + | |
- | [[adi> | + | |
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | |||
+ | ===== Reference Circuits ===== | ||
+ | |||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | |||
+ | ===== Evaluation Boards ===== | ||
+ | |||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
+ | * [[adi> | ||
===== Description ===== | ===== Description ===== | ||
Line 17: | Line 44: | ||
===== Status ===== | ===== Status ===== | ||
- | ^ Source | + | ^ Source ^ Mainlined? ^ |
- | | [[bfgit>linux-kernel?drivers/staging/ | + | | [[git.linux.org>drivers/ |
===== Files ===== | ===== Files ===== | ||
^ Function ^ File ^ | ^ Function ^ File ^ | ||
- | | driver | + | | driver |
- | | include | [[staging.kernel.org>drivers/staging/iio/adc/ad7793.h]] | | + | | include | [[git.linux.org>include/linux/platform_data/ad7793.h]] | |
====== Example platform device initialization ====== | ====== Example platform device initialization ====== | ||
Line 31: | Line 58: | ||
The reference voltage may vary between boards and models. The platform_data for the device' | The reference voltage may vary between boards and models. The platform_data for the device' | ||
- | < | + | <code c> |
+ | /** | ||
+ | * enum ad7793_clock_source - AD7793 clock source | ||
+ | * @AD7793_CLK_SRC_INT: | ||
+ | * @AD7793_CLK_SRC_INT_CO: | ||
+ | * @AD7793_CLK_SRC_EXT: | ||
+ | * @AD7793_CLK_SRC_EXT_DIV2: | ||
+ | */ | ||
+ | enum ad7793_clock_source { | ||
+ | AD7793_CLK_SRC_INT, | ||
+ | AD7793_CLK_SRC_INT_CO, | ||
+ | AD7793_CLK_SRC_EXT, | ||
+ | AD7793_CLK_SRC_EXT_DIV2, | ||
+ | }; | ||
+ | |||
+ | /** | ||
+ | * enum ad7793_bias_voltage - AD7793 bias voltage selection | ||
+ | * @AD7793_BIAS_VOLTAGE_DISABLED: | ||
+ | * @AD7793_BIAS_VOLTAGE_AIN1: | ||
+ | * @AD7793_BIAS_VOLTAGE_AIN2: | ||
+ | * @AD7793_BIAS_VOLTAGE_AIN3: | ||
+ | | ||
+ | */ | ||
+ | enum ad7793_bias_voltage { | ||
+ | AD7793_BIAS_VOLTAGE_DISABLED, | ||
+ | AD7793_BIAS_VOLTAGE_AIN1, | ||
+ | AD7793_BIAS_VOLTAGE_AIN2, | ||
+ | AD7793_BIAS_VOLTAGE_AIN3, | ||
+ | }; | ||
+ | |||
+ | /** | ||
+ | * enum ad7793_refsel - AD7793 reference voltage selection | ||
+ | * @AD7793_REFSEL_REFIN1: | ||
+ | * and REFIN1(-). | ||
+ | * @AD7793_REFSEL_REFIN2: External reference applied between REFIN2(+) and | ||
+ | * and REFIN1(-). Only valid for AD7795/ | ||
+ | * @AD7793_REFSEL_INTERNAL: | ||
+ | */ | ||
+ | enum ad7793_refsel | ||
+ | AD7793_REFSEL_REFIN1 = 0, | ||
+ | AD7793_REFSEL_REFIN2 = 1, | ||
+ | AD7793_REFSEL_INTERNAL = 2, | ||
+ | }; | ||
+ | |||
+ | /** | ||
+ | * enum ad7793_current_source_direction | ||
+ | * @AD7793_IEXEC1_IOUT1_IEXEC2_IOUT2: | ||
+ | | ||
+ | * @AD7793_IEXEC1_IOUT2_IEXEC2_IOUT1: | ||
+ | | ||
+ | * @AD7793_IEXEC1_IEXEC2_IOUT1: | ||
+ | | ||
+ | * @AD7793_IEXEC1_IEXEC2_IOUT2: | ||
+ | | ||
+ | */ | ||
+ | enum ad7793_current_source_direction { | ||
+ | AD7793_IEXEC1_IOUT1_IEXEC2_IOUT2 = 0, | ||
+ | AD7793_IEXEC1_IOUT2_IEXEC2_IOUT1 = 1, | ||
+ | AD7793_IEXEC1_IEXEC2_IOUT1 = 2, | ||
+ | AD7793_IEXEC1_IEXEC2_IOUT2 = 3, | ||
+ | }; | ||
+ | |||
+ | /** | ||
+ | * enum ad7793_excitation_current - AD7793 excitation current selection | ||
+ | * @AD7793_IX_DISABLED: | ||
+ | * @AD7793_IX_10uA: | ||
+ | * @AD7793_IX_210uA: | ||
+ | * @AD7793_IX_1mA: | ||
+ | */ | ||
+ | enum ad7793_excitation_current { | ||
+ | AD7793_IX_DISABLED = 0, | ||
+ | AD7793_IX_10uA = 1, | ||
+ | AD7793_IX_210uA = 2, | ||
+ | AD7793_IX_1mA = 3, | ||
+ | }; | ||
+ | |||
+ | /** | ||
+ | * struct ad7793_platform_data - AD7793 platform data | ||
+ | * @clock_src: Clock source selection | ||
+ | * @burnout_current: | ||
+ | * @boost_enable: | ||
+ | * @buffered: If set to true configure the device for buffered input mode. | ||
+ | * @unipolar: If set to true sample in unipolar mode, if set to false sample in | ||
+ | | ||
+ | * @refsel: Reference voltage selection | ||
+ | * @bias_voltage: | ||
+ | * @exitation_current: | ||
+ | * @current_source_direction: | ||
+ | */ | ||
+ | struct ad7793_platform_data { | ||
+ | enum ad7793_clock_source clock_src; | ||
+ | bool burnout_current; | ||
+ | bool boost_enable; | ||
+ | bool buffered; | ||
+ | bool unipolar; | ||
+ | |||
+ | enum ad7793_refsel refsel; | ||
+ | enum ad7793_bias_voltage bias_voltage; | ||
+ | enum ad7793_excitation_current exitation_current; | ||
+ | enum ad7793_current_source_direction current_source_direction; | ||
+ | }; | ||
+ | </code> | ||
<code c> | <code c> | ||
static struct ad7793_platform_data ad7793_pdata = { | static struct ad7793_platform_data ad7793_pdata = { | ||
- | .vref_mv | + | .clock_src |
- | .mode = AD7793_MODE_CLKSRC(AD7793_CLK_INT) | AD7793_MODE_RATE(12), | + | .unipolar |
- | .conf = AD7793_CONF_REFSEL | AD7793_CONF_BUF | AD7793_CONF_GAIN(0) | AD7793_CONF_UNIPOLAR, | + | .buffered |
+ | .refsel = AD7793_REFSEL_INTERNAL, | ||
}; | }; | ||
</ | </ | ||
Line 76: | Line 205: | ||
arch_initcall(board_init); | arch_initcall(board_init); | ||
</ | </ | ||
- | |||
====== Adding Linux driver support ====== | ====== Adding Linux driver support ====== | ||
Line 82: | Line 210: | ||
"make qconfig" | "make qconfig" | ||
- | <note> | + | <WRAP round help> |
The AD7793 Driver depends on **CONFIG_SPI** | The AD7793 Driver depends on **CONFIG_SPI** | ||
- | </note> | + | </WRAP> |
< | < | ||
Linux Kernel Configuration | Linux Kernel Configuration | ||
- | Device Drivers | + | |
- | [*] Staging drivers | + | ... |
- | < | + | < |
- | | + | --- Industrial I/O support |
- | -*- | + | ... |
- | -*- | + | Analog to digital converters |
- | -*- | + | ... |
- | + | < | |
- | *** Analog to digital converters | + | ... |
- | [--snip--] | + | ... |
- | + | ... | |
- | | + | |
- | + | ||
- | [--snip--] | + | |
</ | </ | ||
Line 112: | Line 236: | ||
{{page> | {{page> | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
root:/> **cd / | root:/> **cd / | ||
root:/ | root:/ | ||
- | device0 | + | device0 |
- | root:/ | + | root:/ |
- | root:/ | + | root:/ |
drwxr-xr-x | drwxr-xr-x | ||
- | -rw-r--r-- | + | -rw-r--r-- |
- | -r--r--r-- | + | -r--r--r-- |
- | -r--r--r-- | + | -r--r--r-- |
- | -r--r--r-- | + | -r--r--r-- |
- | -r--r--r-- | + | -r--r--r-- |
- | -r--r--r-- | + | -r--r--r-- |
- | -r--r--r-- | + | -r--r--r-- |
- | -rw-r--r-- | + | -rw-r--r-- |
-r--r--r-- | -r--r--r-- | ||
drwxr-xr-x | drwxr-xr-x | ||
Line 135: | Line 259: | ||
-r--r--r-- | -r--r--r-- | ||
lrwxrwxrwx | lrwxrwxrwx | ||
- | -r--r--r-- | + | -r--r--r-- |
- | -rw-r--r-- | + | -rw-r--r-- |
drwxr-xr-x | drwxr-xr-x | ||
-rw-r--r-- | -rw-r--r-- | ||
- | root:/ | + | root:/ |
- | </ | + | </ |
=== Show device name === | === Show device name === | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
- | root:/ | + | root:/ |
ad7793 | ad7793 | ||
- | </ | + | </ |
=== Show available sampling frequencies / update rates === | === Show available sampling frequencies / update rates === | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
- | root:/ | + | root:/ |
470 242 123 62 50 39 33 19 17 16 12 10 8 6 4 | 470 242 123 62 50 39 33 19 17 16 12 10 8 6 4 | ||
- | </ | + | </ |
=== Set sampling frequency / update rate === | === Set sampling frequency / update rate === | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
- | root:/ | + | root:/ |
10 | 10 | ||
- | root:/ | + | root:/ |
- | root:/ | + | root:/ |
50 | 50 | ||
- | root:/ | + | root:/ |
- | </ | + | </ |
=== Show supply voltage === | === Show supply voltage === | ||
Line 176: | Line 300: | ||
Shows the AVDD supply voltage | Shows the AVDD supply voltage | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
- | root:/ | + | root:/ |
7817399 | 7817399 | ||
- | root:/ | + | root:/ |
0.000418420 | 0.000418420 | ||
- | </ | + | </ |
- | **U** = //in4_supply_raw | + | **U** = //in_voltage4_supply_raw |
=== Show available scales for differential input channels === | === Show available scales for differential input channels === | ||
Line 190: | Line 314: | ||
Lists all available scales for the differential input pairs: | Lists all available scales for the differential input pairs: | ||
^ ADC Input Pair ^ Channel name ^ | ^ ADC Input Pair ^ Channel name ^ | ||
- | | AIN1(+) - AIN1(-) | in0-in0_raw | + | | AIN1(+) - AIN1(-) | in_voltage0-in_voltage0_raw |
- | | AIN2(+) - AIN2(-) | in1-in1_raw | + | | AIN2(+) - AIN2(-) | in_voltage1-in_voltage1_raw |
- | | AIN3(+) - AIN3(-) | in1-in1_raw | + | | AIN3(+) - AIN3(-) | in_voltage1-in_voltage1_raw |
- | | AIN1(-) - AIN1(-) | in0-in0_shorted_raw | + | | AIN1(-) - AIN1(-) | in_voltage0-in_voltage0_shorted_raw |
Setting these directly influences the ADC input range, by altering the GAIN amplifier. | Setting these directly influences the ADC input range, by altering the GAIN amplifier. | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
- | root:/ | + | root:/ |
| | ||
- | </ | + | </ |
=== Set scale for differential input channels === | === Set scale for differential input channels === | ||
- | Scale to be applied to in0-in0_raw, in1-in1_raw, in2-in2_raw | + | Scale to be applied to in_voltage0-in_voltage0_raw, in_voltage1-in_voltage1_raw, in_voltage2-in_voltage2_raw |
Allows the user to select one scale out of the available scales. | Allows the user to select one scale out of the available scales. | ||
If the written scale differs from the current scale. The driver performs full and zero offset calibration on all differential input channels. | If the written scale differs from the current scale. The driver performs full and zero offset calibration on all differential input channels. | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
- | root:/ | + | root:/ |
0.000149010 | 0.000149010 | ||
- | root:/ | + | root:/ |
- | root:/ | + | root:/ |
0.000074500 | 0.000074500 | ||
- | root:/ | + | </ |
- | </ | + | |
- | === Show channel | + | === Show channel |
**Description: | **Description: | ||
- | Raw unscaled voltage measurement | + | Raw unscaled voltage measurement |
^ ADC Input Pair ^ Channel name ^ | ^ ADC Input Pair ^ Channel name ^ | ||
- | | AIN1(+) - AIN1(-) | in0-in0_raw | + | | AIN1(+) - AIN1(-) | in_voltage0-in_voltage0_raw |
- | | AIN2(+) - AIN2(-) | in1-in1_raw | + | | AIN2(+) - AIN2(-) | in_voltage1-in_voltage1_raw |
- | | AIN3(+) - AIN3(-) | in1-in1_raw | + | | AIN3(+) - AIN3(-) | in_voltage2-in_voltage2_raw | |
- | | AIN1(-) - AIN1(-) | in0-in0_shorted_raw | + | | AIN4(+) - AIN4(-) | in_voltage3-in_voltage3_raw | |
+ | | AIN5(+) - AIN5(-) | in_voltage4-in_voltage4_raw | | ||
+ | | AIN6(+) - AIN6(-) | in_voltage5-in_voltage5_raw | ||
+ | | AIN1(-) - AIN1(-) | in_voltage0-in_voltage0_shorted_raw | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
- | root:/ | + | root:/ |
6710665 | 6710665 | ||
- | </ | + | </ |
- | + | ||
- | **U** = // | + | |
+ | **U** = // | ||
===== Trigger management ===== | ===== Trigger management ===== | ||
- | <note> | + | <WRAP round help> |
This driver only supports it's own default trigger source **ad7793-dev0** | This driver only supports it's own default trigger source **ad7793-dev0** | ||
- | </note> | + | </WRAP> |
- | < | + | <WRAP box bggreen>< |
< | < | ||
root:/ | root:/ | ||
ad7793-dev0 | ad7793-dev0 | ||
- | </ | + | </ |
===== Buffer management ===== | ===== Buffer management ===== | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
- | root:/ | + | root:/ |
- | **bytes_per_datum** | + | **enable** |
- | dev | + | root:/ |
- | root:/ | + | </ |
- | </ | + | |
{{page> | {{page> | ||
- | < | + | <WRAP box bggreen>< |
< | < | ||
- | root:/ | + | root:/ |
- | in0-in0_en | + | in_voltage0-in_voltage0_en |
- | in0-in0_index | + | in_voltage0-in_voltage0_index |
- | in0-in0_shorted_en | + | in_voltage0-in_voltage0_shorted_en |
- | in0-in0_shorted_index | + | in_voltage0-in_voltage0_shorted_index |
- | in0-in0_shorted_type | + | in_voltage0-in_voltage0_shorted_type |
- | in0-in0_type | + | in_voltage0-in_voltage0_type |
- | in1-in1_en | + | in_voltage1-in_voltage1_en |
- | root:/ | + | root:/ |
- | </ | + | </ |
{{page> | {{page> | ||
- | |||
====== More Information ====== | ====== More Information ====== | ||
{{page> | {{page> |