Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
resources:tools-software:linux-drivers:iio-adc:ad7998 [16 Nov 2012 13:29] – [Reference Circuit Notes] fix heading Lars-Peter Clausen | resources:tools-software:linux-drivers:iio-adc:ad7998 [29 Jan 2014 21:01] – [Example platform device initialization] Lars-Peter Clausen |
---|
</code> | </code> |
| |
<note tip> | <WRAP tip> |
In case platform_data is not present or set to NULL, the driver will use the AD7998 internal reference. | In case platform_data is not present or set to NULL, the driver will use the AD7998 internal reference. |
</note> | </WRAP> |
| |
{{page>software/linux/docs/platform_and_bus_model#Declaring I2C devices&firstseconly&noeditbtn}} | {{page>software/linux/docs/platform_and_bus_model#Declaring I2C devices&firstseconly&noeditbtn}} |
</code> | </code> |
| |
====== Adding Linux drive | ====== Adding Linux driver support ====== |
r support ====== | |
| |
Configure kernel with "make menuconfig" (alternatively use "make xconfig" or | Configure kernel with "make menuconfig" (alternatively use "make xconfig" or |
"make qconfig") | "make qconfig") |
| |
<note> | <WRAP round help> |
The AD7998 Driver depends on **CONFIG_I2C** | The AD7998 Driver depends on **CONFIG_I2C** |
</note> | </WRAP> |
| |
<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/** |
drwxr-xr-x 2 root root 0 Jan 1 00:00 trigger | drwxr-xr-x 2 root root 0 Jan 1 00:00 trigger |
-rw-r--r-- 1 root root 4096 Jan 1 00:00 uevent | -rw-r--r-- 1 root root 4096 Jan 1 00:00 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/i2c-bfin-twi.0/i2c-0/0-0024/iio:device0> **cat name** | root:/sys/devices/platform/i2c-bfin-twi.0/i2c-0/0-0024/iio:device0> **cat name** |
ad7998 | ad7998 |
</xterm></box> | </xterm></WRAP> |
| |
=== Show scale === | === Show scale === |
scale to be applied to in_voltage0_raw in order to obtain the measured voltage in millivolts. | scale to be applied to in_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/i2c-bfin-twi.0/i2c-0/0-0024/iio:device0> **cat in_voltage_scale** | root:/sys/devices/platform/i2c-bfin-twi.0/i2c-0/0-0024/iio:device0> **cat in_voltage_scale** |
1.000 | 1.000 |
</xterm></box> | </xterm></WRAP> |
| |
=== Show channel 0 measurement === | === Show channel 0 measurement === |
Raw unscaled voltage measurement on channel 0 | Raw unscaled voltage measurement on channel 0 |
| |
<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/i2c-bfin-twi.0/i2c-0/0-0024/iio:device0> **cat in_voltage0_raw** | root:/sys/devices/platform/i2c-bfin-twi.0/i2c-0/0-0024/iio:device0> **cat in_voltage0_raw** |
1491 | 1491 |
</xterm></box> | </xterm></WRAP> |
| |
**U** = //in_voltage0_raw * in_voltage_scale// = 1491 * 1.000 = **1491,00 //mV//** | **U** = //in_voltage0_raw * in_voltage_scale// = 1491 * 1.000 = **1491,00 //mV//** |
===== Buffer management ===== | ===== Buffer management ===== |
| |
<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/i2c-bfin-twi.0/i2c-0/0-0024/iio:device0/buffer> **ls** | root:/sys/devices/platform/i2c-bfin-twi.0/i2c-0/0-0024/iio:device0/buffer> **ls** |
**enable** **length** | **enable** **length** |
root:/sys/devices/platform/i2c-bfin-twi.0/i2c-0/0-0024/iio:device0/buffer> | root:/sys/devices/platform/i2c-bfin-twi.0/i2c-0/0-0024/iio:device0/buffer> |
</xterm></box> | </xterm></WRAP> |
| |
{{page>software:linux:docs:iio:iio_snippets#Buffer management&noheader&firstseconly&noeditbtn}} | {{page>software:linux:docs:iio:iio_snippets#Buffer management&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:/sys/devices/platform/i2c-bfin-twi.0/i2c-0/0-0024/iio:device0/scan_elements> **ls** | root:/sys/devices/platform/i2c-bfin-twi.0/i2c-0/0-0024/iio:device0/scan_elements> **ls** |
in_voltage2_en in_voltage4_index in_voltage7_en timestamp_type | in_voltage2_en in_voltage4_index in_voltage7_en timestamp_type |
root:/sys/devices/platform/i2c-bfin-twi.0/i2c-0/0-0024/iio:device0/scan_elements> | root:/sys/devices/platform/i2c-bfin-twi.0/i2c-0/0-0024/iio:device0/scan_elements> |
</xterm></box> | </xterm></WRAP> |
| |
| |