Both sides previous revisionPrevious revisionNext revision | Previous revision |
resources:tools-software:linux-drivers:iio-dac:ad5504 [26 Aug 2011 22:56] – [AD5504 IIO High Voltage ADC Linux Driver] Michael Hennerich | resources:tools-software:linux-drivers:iio-dac:ad5504 [23 Feb 2017 13:32] (current) – Lars-Peter Clausen |
---|
====== AD5504 IIO High Voltage ADC Linux Driver ====== | ====== AD5504 IIO High Voltage ADC Linux Driver ====== |
| |
| |
===== Supported Devices ===== | ===== Supported Devices ===== |
| |
This driver supports the\\ | * [[adi>AD5504]] |
[[adi>AD5504]]\\ | * [[adi>AD5501]] |
[[adi>AD5501]] | |
| ===== Reference Circuits ===== |
| |
| * [[adi>CN0193]] |
| |
| ===== Evaluation Boards ===== |
| |
| * [[adi>EVAL-AD5504EBZ]] |
| * [[adi>EVAL-AD5501EBZ]] |
| |
===== Description ===== | ===== Description ===== |
| |
^ Source ^ Mainlined? ^ | ^ Source ^ Mainlined? ^ |
| [[bfgit>linux-kernel?drivers/staging/iio/dac/ad5504.c|git]] | [[git.linux.org>drivers/staging/iio/dac/ad5504.c|Yes]] | | | [[git.linux.org>drivers/iio/dac/ad5504.c|git]] | [[git.linux.org>drivers/iio/dac/ad5504.c|Yes]] | |
===== Files ===== | ===== Files ===== |
| |
^ Function ^ File ^ | ^ Function ^ File ^ |
| driver | [[git.linux.org>drivers/staging/iio/dac/ad5504.c]] | | | driver | [[git.linux.org>drivers/iio/dac/ad5504.c]] | |
| include | [[git.linux.org>drivers/staging/iio/dac/ad5504.h]] | | | include | [[git.linux.org>drivers/iio/dac/ad5504.h]] | |
| |
====== Example platform device initialization ====== | ====== Example platform device initialization ====== |
</code> | </code> |
| |
<note tip> | <WRAP tip> |
This driver supports also an alternative way of specifying the reference voltage, by using the Linux regulator framework. | This driver supports also an alternative way of specifying the reference voltage, by using the Linux regulator framework. |
</note> | </WRAP> |
| |
===== Specifying reference voltage via the regulator framework ===== | ===== Specifying reference voltage via the regulator framework ===== |
"make qconfig") | "make qconfig") |
| |
<note> | <WRAP round help> |
The AD5504 Driver depends on **CONFIG_SPI** | The AD5504 Driver depends on **CONFIG_SPI** |
</note> | </WRAP> |
| |
<code> | <code> |
Linux Kernel Configuration | Linux Kernel Configuration |
Device Drivers ---> | Device Drivers ---> |
[*] Staging drivers ---> | <*> Industrial I/O support ---> |
<*> Industrial I/O support ---> | --- Industrial I/O support |
--- Industrial I/O support | |
-*- Enable ring buffer support within IIO | |
-*- Industrial I/O lock free software ring | |
-*- Enable triggered sampling support | |
| |
*** Digital to analog convertors *** | |
[--snip--] | |
| |
<*> Analog Devices AD5504/AD5501 DAC spi driver | |
| |
[--snip--] | |
| |
| *** Digital to analog convertors *** |
| [--snip--] |
| <*> Analog Devices AD5504/AD5501 DAC spi driver |
| [--snip--] |
</code> | </code> |
| |
{{page>software:linux:docs:iio:iio_snippets#iio device files&noheader&firstseconly&noeditbtn}} | {{page>software:linux:docs:iio:iio_snippets#iio device files&noheader&firstseconly&noeditbtn}} |
| |
<box 100% green|shell prompt running on the target> | <WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap> |
<xterm> | <xterm> |
root:/> **cd /sys/bus/iio/devices/** | root:/> **cd /sys/bus/iio/devices/** |
root:/sys/bus/iio/devices> ls | root:/sys/bus/iio/devices> ls |
device0 device0:event0 | iio:device0 iio:device0:event0 |
| |
root:/sys/bus/iio/devices> **cd device0** | root:/sys/bus/iio/devices> **cd iio:device0** |
| |
root:/sys/devices/platform/bfin-spi.0/spi0.3/device0> **ls -l** | root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> **ls -l** |
-r--r--r-- 1 root root 4096 Jan 3 14:39 name | -r--r--r-- 1 root root 4096 Jan 3 14:39 name |
-rw-r--r-- 1 root root 4096 Jan 3 14:39 out0_powerdown | -rw-r--r-- 1 root root 4096 Jan 3 14:39 out_voltage0_powerdown |
-rw-r--r-- 1 root root 4096 Jan 3 14:39 out0_raw | -rw-r--r-- 1 root root 4096 Jan 3 14:39 out_voltage0_raw |
-rw-r--r-- 1 root root 4096 Jan 3 14:39 out1_powerdown | -rw-r--r-- 1 root root 4096 Jan 3 14:39 out_voltage1_powerdown |
-rw-r--r-- 1 root root 4096 Jan 3 14:39 out1_raw | -rw-r--r-- 1 root root 4096 Jan 3 14:39 out_voltage1_raw |
-rw-r--r-- 1 root root 4096 Jan 3 14:39 out2_powerdown | -rw-r--r-- 1 root root 4096 Jan 3 14:39 out_voltage2_powerdown |
-rw-r--r-- 1 root root 4096 Jan 3 14:39 out2_raw | -rw-r--r-- 1 root root 4096 Jan 3 14:39 out_voltage2_raw |
-rw-r--r-- 1 root root 4096 Jan 3 14:39 out3_powerdown | -rw-r--r-- 1 root root 4096 Jan 3 14:39 out_voltage3_powerdown |
-rw-r--r-- 1 root root 4096 Jan 3 14:39 out3_raw | -rw-r--r-- 1 root root 4096 Jan 3 14:39 out_voltage3_raw |
-rw-r--r-- 1 root root 4096 Jan 3 14:39 out_powerdown_mode | -rw-r--r-- 1 root root 4096 Jan 3 14:39 out_voltage_powerdown_mode |
-r--r--r-- 1 root root 4096 Jan 3 14:39 out_powerdown_mode_available | -r--r--r-- 1 root root 4096 Jan 3 14:39 out_voltage_powerdown_mode_available |
-r--r--r-- 1 root root 4096 Jan 3 14:39 out_scale | -r--r--r-- 1 root root 4096 Jan 3 14:39 out_voltage_scale |
lrwxrwxrwx 1 root root 0 Jan 3 14:39 subsystem -> ../../../../../bus/iio | lrwxrwxrwx 1 root root 0 Jan 3 14:39 subsystem -> ../../../../../bus/iio |
-rw-r--r-- 1 root root 4096 Jan 3 14:39 uevent | -rw-r--r-- 1 root root 4096 Jan 3 14:39 uevent |
</xterm></box> | </xterm></WRAP> |
| |
| |
=== Show device name === | === Show device name === |
| |
<box 100% green|shell prompt running on the target> | <WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap> |
<xterm> | <xterm> |
root:/sys/devices/platform/bfin-spi.0/spi0.3/device0> **cat name** | root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> **cat name** |
ad5504 | ad5504 |
</xterm></box> | </xterm></WRAP> |
| |
=== Show scale === | === Show scale === |
| |
**Description:**\\ | **Description:**\\ |
scale to be applied to out0_raw in order to obtain the measured voltage in millivolts. | scale to be applied to out_voltage0_raw in order to obtain the measured voltage in millivolts. |
| |
<box 100% green|shell prompt running on the target> | <WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap> |
<xterm> | <xterm> |
root:/sys/devices/platform/bfin-spi.0/spi0.3/device0> **cat out_scale** | root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> **cat out_voltage_scale** |
7.324 | 7.324 |
</xterm></box> | </xterm></WRAP> |
| |
=== Set channel Y output voltage === | === Set channel Y output voltage === |
| |
**Description:**\\ | **Description:**\\ |
/sys/bus/iio/devices/deviceX/outY_raw\\ | /sys/bus/iio/devices/iio:deviceX/out_voltageY_raw\\ |
| |
Raw (unscaled, no bias etc.) output voltage for | Raw (unscaled, no bias etc.) output voltage for |
channel Y. | channel Y. |
| |
<box 100% green|shell prompt running on the target> | <WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap> |
<xterm> | <xterm> |
root:/sys/devices/platform/bfin-spi.0/spi0.3/device0> echo 1234 > out0_raw | root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> echo 1234 > out0_raw |
</xterm></box> | </xterm></WRAP> |
| |
**U** = //out0_raw * out_scale// = 1234 * 7.324 = **9037,816 //mV//** | **U** = //out_voltage0_raw * out_voltage_scale// = 1234 * 7.324 = **9037,816 //mV//** |
| |
| |
=== List available power down modes === | === List available power down modes === |
| |
/sys/bus/iio/devices/deviceX/out_powerdown_mode_available | /sys/bus/iio/devices/deviceX/out_voltage_powerdown_mode_available |
| |
**Description:**\\ | **Description:**\\ |
Lists all available output power down modes. | Lists all available output power down modes. |
| |
<box 100% green|shell prompt running on the target> | <WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap> |
<xterm> | <xterm> |
root:/sys/devices/platform/bfin-spi.0/spi0.3/device0> **cat out_powerdown_mode_available** | root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> **cat out_voltage_powerdown_mode_available** |
20kohm_to_gnd three_state | 20kohm_to_gnd three_state |
</xterm></box> | </xterm></WRAP> |
| |
=== Set power down mode === | === Set power down mode === |
| |
/sys/bus/iio/devices/deviceX/out_powerdown_mode | /sys/bus/iio/devices/iio:deviceX/out_voltage_powerdown_mode |
| |
**Description:**\\ | **Description:**\\ |
| |
For a list of available output power down options read | For a list of available output power down options read |
outX_powerdown_mode_available. | out_voltageX_powerdown_mode_available. |
| |
| |
<box 100% green|shell prompt running on the target> | <WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap> |
<xterm> | <xterm> |
root:/sys/devices/platform/bfin-spi.0/spi0.3/device0> **echo three_state > out_powerdown_mode** | root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> **echo three_state > out_voltage_powerdown_mode** |
root:/sys/devices/platform/bfin-spi.0/spi0.3/device0> **cat out_powerdown_mode** | root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> **cat out_voltage_powerdown_mode** |
three_state | three_state |
</xterm></box> | </xterm></WRAP> |
| |
=== Enable power down mode on output Y === | === Enable power down mode on output Y === |
| |
/sys/bus/iio/devices/deviceX/outY_powerdown | /sys/bus/iio/devices/iio:deviceX/out_voltageY_powerdown |
| |
**Description:**\\ | **Description:**\\ |
Writing 1 causes output Y to enter the power down mode specified | Writing 1 causes output Y to enter the power down mode specified |
by the corresponding outY_powerdown_mode. Clearing returns to | by the corresponding out_voltageY_powerdown_mode. Clearing returns to |
normal operation. Y may be suppressed if all outputs are | normal operation. Y may be suppressed if all outputs are |
controlled together. | controlled together. |
| |
<box 100% green|shell prompt running on the target> | <WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap> |
<xterm> | <xterm> |
root:/sys/devices/platform/bfin-spi.0/spi0.3/device0> **echo 1 > out0_powerdown** | root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> **echo 1 > out_voltage0_powerdown** |
root:/sys/devices/platform/bfin-spi.0/spi0.3/device0> **cat out0_powerdown** | root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> **cat out_voltage0_powerdown** |
1 | 1 |
root:/sys/devices/platform/bfin-spi.0/spi0.3/device0> **echo 0 > out0_powerdown** | root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> **echo 0 > out_voltage0_powerdown** |
root:/sys/devices/platform/bfin-spi.0/spi0.3/device0> **cat out0_powerdown** | root:/sys/devices/platform/bfin-spi.0/spi0.3/iio:device0> **cat out_voltage0_powerdown** |
0 | 0 |
</xterm></box> | </xterm></WRAP> |
| |
====== More Information ====== | ====== More Information ====== |
| |
{{page>software:linux:docs:iio:iio_snippets#iio pointers&noheader&firstseconly&noeditbtn}} | {{page>software:linux:docs:iio:iio_snippets#iio pointers&noheader&firstseconly&noeditbtn}} |