Wiki

Differences

This shows you the differences between two versions of the page.


Previous revision
Next revision
resources:tools-software:linux-drivers:iio-accelerometer:adis16201 [09 Nov 2011 11:24] – [Supported Devices] Michael Hennerich
Line 1: Line 1:
 +====== ADIS16201 IIO Dual-Axis Digital Inclinometer and Accelerometer Linux Driver ======
  
 +===== Supported Devices =====
 +
 +  * [[adi>ADIS16201]]
 +
 +===== Evaluation Boards =====
 +
 +  * [[adi>ADIS16201/PCBZ]]
 +===== Description =====
 +
 +This is a Linux industrial I/O ([[software:linux:docs:iio:iio|IIO]]) subsystem driver, targeting serial interface Inclinometer and Accelerometer.
 +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:linux:docs:iio:iio|IIO]] for more information.
 +
 +====== Source Code ======
 +
 +===== Status =====
 +
 +^  Source  ^  Mainlined?  ^
 +| [[bfgit>linux-kernel?drivers/staging/iio/accel/adis16201_core.c|git]] |  [[git.linux.org>drivers/staging/iio/accel/adis16201_core.c|Yes]]  |
 +===== Files =====
 +
 +^ Function ^ File ^
 +| driver  | [[staging.kernel.org>drivers/staging/iio/accel/adis16201_core.c]] |
 +| driver  | [[staging.kernel.org>drivers/staging/iio/accel/adis16201_ring.c]] |
 +| driver  | [[staging.kernel.org>drivers/staging/iio/accel/adis16201_trigger.c]] |
 +| include | [[staging.kernel.org>drivers/staging/iio/accel/adis16201.h]] |
 +
 +{{page>software/linux/docs/platform_and_bus_model#Declaring SPI slave devices&firstseconly&noeditbtn}}
 +
 +Depending on the converter IC used, you may need to set the modalias accordingly, matching your part name.
 +It may also required to adjust max_speed_hz. Please consult the datasheet, for maximum spi clock supported by the device in question.
 +
 +<code c>
 +static struct spi_board_info board_spi_board_info[] __initdata = {
 +#if defined(CONFIG_ADIS16201) \
 + || defined(CONFIG_ADIS16201_MODULE)
 + {
 + .modalias = "adis16201",
 + .max_speed_hz = 1000000,     /* max spi clock (SCK) speed in HZ */
 + .bus_num = 0,
 + .chip_select = 5, /* CS, change it for your board */
 + .platform_data = NULL, /* No spi_driver specific config */
 + .mode = SPI_MODE_3,
 + .irq = IRQ_PF4,
 + },
 +#endif
 +};
 +</code>
 +
 +<code c>
 +static int __init board_init(void)
 +{
 + [--snip--]
 +
 + spi_register_board_info(board_spi_board_info, ARRAY_SIZE(board_spi_board_info));
 +
 + [--snip--]
 +
 + return 0;
 +}
 +arch_initcall(board_init);
 +</code>
 +
 +====== Adding Linux driver support ======
 +
 +Configure kernel with "make menuconfig" (alternatively use "make xconfig" or
 +"make qconfig")
 +
 +<note>
 +The ADIS16201 Driver depends on **CONFIG_SPI**
 +</note>
 +
 +<code>
 +Linux Kernel Configuration
 + Device Drivers  --->
 + [*] Staging drivers  --->
 + <*>     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
 +
 +           *** Accelerometers ***
 +     [--snip--]
 +
 +     <*>   Analog Devices ADIS16201 Dual-Axis Digital Inclinometer and Accelerometer
 +
 +     [--snip--]
 +
 +</code>
 +
 +====== Hardware configuration ======
 +
 +
 +====== Driver testing ======
 +
 +{{page>software:linux:docs:iio:iio_snippets#iio device files&noheader&firstseconly&noeditbtn}}
 +
 +<box 100% green|shell prompt running on the target>
 +<xterm>
 +root:/> **cd /sys/bus/iio/devices/**
 +root:/sys/bus/iio/devices> **ls**
 +iio:device0  trigger0
 +
 +
 +root:/sys/bus/iio/devices> **cd iio:device0**
 +root:/sys/devices/platform/bfin-spi.0/spi0.5/iio:device0> **ls -l**
 +drwxr-xr-x    2 root     root             0 Jan  4 04:43 buffer
 +-r--r--r--    1 root     root          4096 Jan  4 04:43 dev
 +-rw-r--r--    1 root     root          4096 Jan  4 04:43 in_accel_x_calibbias
 +-r--r--r--    1 root     root          4096 Jan  4 04:43 in_accel_x_raw
 +-rw-r--r--    1 root     root          4096 Jan  4 04:43 in_accel_x_scale
 +-rw-r--r--    1 root     root          4096 Jan  4 04:43 in_accel_y_calibbias
 +-r--r--r--    1 root     root          4096 Jan  4 04:43 in_accel_y_raw
 +-rw-r--r--    1 root     root          4096 Jan  4 04:43 in_accel_y_scale
 +-rw-r--r--    1 root     root          4096 Jan  4 04:43 in_incli_x_calibbias
 +-r--r--r--    1 root     root          4096 Jan  4 04:43 in_incli_x_raw
 +-rw-r--r--    1 root     root          4096 Jan  4 04:43 in_incli_x_scale
 +-rw-r--r--    1 root     root          4096 Jan  4 04:43 in_incli_y_calibbias
 +-r--r--r--    1 root     root          4096 Jan  4 04:43 in_incli_y_raw
 +-rw-r--r--    1 root     root          4096 Jan  4 04:43 in_incli_y_scale
 +-rw-r--r--    1 root     root          4096 Jan  4 04:43 in_temp0_offset
 +-r--r--r--    1 root     root          4096 Jan  4 04:43 in_temp0_raw
 +-rw-r--r--    1 root     root          4096 Jan  4 04:43 in_temp0_scale
 +-r--r--r--    1 root     root          4096 Jan  4 04:43 in_voltage0_supply_raw
 +-rw-r--r--    1 root     root          4096 Jan  4 04:43 in_voltage0_supply_scale
 +-r--r--r--    1 root     root          4096 Jan  4 04:43 in_voltage1_raw
 +-rw-r--r--    1 root     root          4096 Jan  4 04:43 in_voltage1_scale
 +-r--r--r--    1 root     root          4096 Jan  4 04:43 name
 +drwxr-xr-x    2 root     root             0 Jan  4 04:43 power
 +--w-------    1 root     root          4096 Jan  4 04:43 reset
 +drwxr-xr-x    2 root     root             0 Jan  4 04:43 scan_elements
 +lrwxrwxrwx    1 root     root             0 Jan  4 04:43 subsystem -> ../../../../../bus/iio
 +drwxr-xr-x    2 root     root             0 Jan  4 04:43 trigger
 +-rw-r--r--    1 root     root          4096 Jan  4 04:43 uevent
 +</xterm></box>
 +
 +=== Show device name ===
 +
 +<box 100% green|shell prompt running on the target>
 +<xterm>
 +root:/sys/devices/platform/bfin-spi.0/spi0.5/iio:device0> **cat name**
 +adis16201
 +</xterm></box>
 +
 +=== ADIS16201 device attributes ===
 +
 +For a detailed description please see:
 +[[staging.kernel.org>drivers/staging/iio/Documentation/sysfs-bus-iio]]
 +
 +^ Device files ^
 +| in_accel_x_calibbias |
 +| in_accel_x_raw |
 +| in_accel_x_scale |
 +| in_accel_y_calibbias |
 +| in_accel_y_raw |
 +| in_accel_y_scale |
 +| in_incli_x_raw |
 +| in_incli_x_scale |
 +| in_incli_y_raw |
 +| in_incli_y_scale |
 +| in_temp0_offset |
 +| in_temp0_raw |
 +| in_temp0_scale |
 +| in_voltage0_supply_raw |
 +| in_voltage0_supply_scale |
 +| in_voltage1_raw |
 +| in_voltage1_scale  |
 +| name |
 +| reset |
 +
 +===== Trigger management =====
 +
 +<note>
 +This driver only supports it's own default trigger source **adis16201-dev0**
 +</note>
 +
 +<box 100% green|shell prompt running on the target>
 +<xterm>
 +root:/sys/devices/platform/bfin-spi.0/spi0.5/iio:device0> **cat trigger/current_trigger**
 +adis16201-dev0
 +</xterm></box>
 +
 +===== Buffer management =====
 +
 +<box 100% green|shell prompt running on the target>
 +<xterm>
 +root:/sys/devices/platform/bfin-spi.0/spi0.5/iio:device0/buffer> **ls**
 +**bytes_per_datum**  **enable**           **length**
 +</xterm></box>
 +
 +{{page>software:linux:docs:iio:iio_snippets#Buffer management&noheader&firstseconly&noeditbtn}}
 +
 +<box 100% green|shell prompt running on the target>
 +<xterm>
 +root:/sys/devices/platform/bfin-spi.0/spi0.5/iio:device0/scan_elements>**ls**
 +in_accel_x_en             in_incli_x_type           in_timestamp_index
 +in_accel_x_index          in_incli_y_en             in_timestamp_type
 +in_accel_x_type           in_incli_y_index          in_voltage0_supply_en
 +in_accel_y_en             in_incli_y_type           in_voltage0_supply_index
 +in_accel_y_index          in_temp0_en               in_voltage0_supply_type
 +in_accel_y_type           in_temp0_index            in_voltage1_en
 +in_incli_x_en             in_temp0_type             in_voltage1_index
 +in_incli_x_index          in_timestamp_en           in_voltage1_type
 +</xterm></box>
 +
 +{{page>software:linux:docs:iio:iio_snippets#Typical ADC scan elements&noheader&firstseconly&noeditbtn}}
 +
 +====== More Information ======
 +
 +{{page>software:linux:docs:iio:iio_snippets#iio pointers&noheader&firstseconly&noeditbtn}}
resources/tools-software/linux-drivers/iio-accelerometer/adis16201.txt · Last modified: 23 Feb 2017 13:33 by Lars-Peter Clausen