Documentation / iio / adis16480.rst


Based on kernel version 6.11. Page generated on 2024-09-24 08:21 EST.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443
.. SPDX-License-Identifier: GPL-2.0

================
ADIS16480 driver
================

This driver supports Analog Device's IMUs on SPI bus.

1. Supported devices
====================

* `ADIS16375 <https://www.analog.com/ADIS16375>`_
* `ADIS16480 <https://www.analog.com/ADIS16480>`_
* `ADIS16485 <https://www.analog.com/ADIS16485>`_
* `ADIS16488 <https://www.analog.com/ADIS16488>`_
* `ADIS16490 <https://www.analog.com/ADIS16490>`_
* `ADIS16495 <https://www.analog.com/ADIS16495>`_
* `ADIS16497 <https://www.analog.com/ADIS16497>`_
* `ADIS16545 <https://www.analog.com/ADIS16545>`_
* `ADIS16547 <https://www.analog.com/ADIS16547>`_

Each supported device is a complete inertial system that includes a triaxial
gyroscope and a triaxial accelerometer. Each inertial sensor in device combines
with signal conditioning that optimizes dynamic performance. The factory
calibration characterizes each sensor for sensitivity, bias, and alignment. As
a result, each sensor has its own dynamic compensation formulas that provide
accurate sensor measurements.

2. Device attributes
====================

Accelerometer, gyroscope measurements are always provided. Furthermore, the
driver offers the capability to retrieve the delta angle and the delta velocity
measurements computed by the device.

The delta angle measurements represent a calculation of angular displacement
between each sample update, while the delta velocity measurements represent a
calculation of linear velocity change between each sample update.

Finally, temperature data are provided which show a coarse measurement of
the temperature inside of the IMU device. This data is most useful for
monitoring relative changes in the thermal environment.

ADIS16480 and ADIS16488 also provide access to barometric pressure data and
triaxial magnetometer measurements.

Each IIO device, has a device folder under ``/sys/bus/iio/devices/iio:deviceX``,
where X is the IIO index of the device. Under these folders reside a set of
device files, depending on the characteristics and features of the hardware
device in questions. These files are consistently generalized and documented in
the IIO ABI documentation.

The following tables show the adis16480 related device files, found in the
specific device folder path ``/sys/bus/iio/devices/iio:deviceX``.

**Available only for ADIS16480 and ADIS16488:**

+------------------------------------------+---------------------------------------------------------+
| 3-Axis Magnetometer related device files | Description                                             |
+------------------------------------------+---------------------------------------------------------+
| in_magn_scale                            | Scale for the magnetometer channels.                    |
+------------------------------------------+---------------------------------------------------------+
| in_magn_x_calibbias                      | Calibration offset for the X-axis magnetometer channel. |
+------------------------------------------+---------------------------------------------------------+
| in_magn_x_filter_low_pass_3db_frequency  | Bandwidth for the X-axis magnetometer channel.          |
+------------------------------------------+---------------------------------------------------------+
| in_magn_x_raw                            | Raw X-axis magnetometer channel value.                  |
+------------------------------------------+---------------------------------------------------------+
| in_magn_y_calibbias                      | Calibration offset for the Y-axis magnetometer channel. |
+------------------------------------------+---------------------------------------------------------+
| in_magn_y_filter_low_pass_3db_frequency  | Bandwidth for the Y-axis magnetometer channel.          |
+------------------------------------------+---------------------------------------------------------+
| in_magn_y_raw                            | Raw Y-axis magnetometer channel value.                  |
+------------------------------------------+---------------------------------------------------------+
| in_magn_z_calibbias                      | Calibration offset for the Z-axis magnetometer channel. |
+------------------------------------------+---------------------------------------------------------+
| in_magn_z_filter_low_pass_3db_frequency  | Bandwidth for the Z-axis magnetometer channel.          |
+------------------------------------------+---------------------------------------------------------+
| in_magn_z_raw                            | Raw Z-axis magnetometer channel value.                  |
+------------------------------------------+---------------------------------------------------------+

+------------------------------------------+-----------------------------------------------------+
| Barometric pressure sensor related files | Description                                         |
+------------------------------------------+-----------------------------------------------------+
| in_pressure0_calibbias                   | Calibration offset for barometric pressure channel. |
+------------------------------------------+-----------------------------------------------------+
| in_pressure0_raw                         | Raw barometric pressure channel value.              |
+------------------------------------------+-----------------------------------------------------+
| in_pressure0_scale                       | Scale for the barometric pressure sensor channel.   |
+------------------------------------------+-----------------------------------------------------+

**Available for all supported devices:**

+-------------------------------------------+----------------------------------------------------------+
| 3-Axis Accelerometer related device files | Description                                              |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_scale                            | Scale for the accelerometer channels.                    |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_x_calibbias                      | Calibration offset for the X-axis accelerometer channel. |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_x_calibscale                     | Calibration scale for the X-axis accelerometer channel.  |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_x_filter_low_pass_3db_frequency  | Bandwidth for the X-axis accelerometer channel.          |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_x_raw                            | Raw X-axis accelerometer channel value.                  |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_y_calibbias                      | Calibration offset for the Y-axis accelerometer channel. |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_y_calibscale                     | Calibration scale for the Y-axis accelerometer channel.  |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_y_filter_low_pass_3db_frequency  | Bandwidth for the Y-axis accelerometer channel.          |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_y_raw                            | Raw Y-axis accelerometer channel value.                  |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_z_calibbias                      | Calibration offset for the Z-axis accelerometer channel. |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_z_calibscale                     | Calibration scale for the Z-axis accelerometer channel.  |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_z_filter_low_pass_3db_frequency  | Bandwidth for the Z-axis accelerometer channel.          |
+-------------------------------------------+----------------------------------------------------------+
| in_accel_z_raw                            | Raw Z-axis accelerometer channel value.                  |
+-------------------------------------------+----------------------------------------------------------+
| in_deltavelocity_scale                    | Scale for delta velocity channels.                       |
+-------------------------------------------+----------------------------------------------------------+
| in_deltavelocity_x_raw                    | Raw X-axis delta velocity channel value.                 |
+-------------------------------------------+----------------------------------------------------------+
| in_deltavelocity_y_raw                    | Raw Y-axis delta velocity channel value.                 |
+-------------------------------------------+----------------------------------------------------------+
| in_deltavelocity_z_raw                    | Raw Z-axis delta velocity channel value.                 |
+-------------------------------------------+----------------------------------------------------------+

+--------------------------------------------+------------------------------------------------------+
| 3-Axis Gyroscope related device files      | Description                                          |
+--------------------------------------------+------------------------------------------------------+
| in_anglvel_scale                           | Scale for the gyroscope channels.                    |
+--------------------------------------------+------------------------------------------------------+
| in_anglvel_x_calibbias                     | Calibration offset for the X-axis gyroscope channel. |
+--------------------------------------------+------------------------------------------------------+
| in_anglvel_x_calibscale                    | Calibration scale for the X-axis gyroscope channel.  |
+--------------------------------------------+------------------------------------------------------+
| in_anglvel_x_filter_low_pass_3db_frequency | Bandwidth for the X-axis gyroscope channel.          |
+--------------------------------------------+------------------------------------------------------+
| in_anglvel_x_raw                           | Raw X-axis gyroscope channel value.                  |
+--------------------------------------------+------------------------------------------------------+
| in_anglvel_y_calibbias                     | Calibration offset for the Y-axis gyroscope channel. |
+--------------------------------------------+------------------------------------------------------+
| in_anglvel_y_calibscale                    | Calibration scale for the Y-axis gyroscope channel.  |
+--------------------------------------------+------------------------------------------------------+
| in_anglvel_y_filter_low_pass_3db_frequency | Bandwidth for the Y-axis gyroscope channel.          |
+--------------------------------------------+------------------------------------------------------+
| in_anglvel_y_raw                           | Raw Y-axis gyroscope channel value.                  |
+--------------------------------------------+------------------------------------------------------+
| in_anglvel_z_calibbias                     | Calibration offset for the Z-axis gyroscope channel. |
+--------------------------------------------+------------------------------------------------------+
| in_anglvel_z_calibscale                    | Calibration scale for the Z-axis gyroscope channel.  |
+--------------------------------------------+------------------------------------------------------+
| in_anglvel_z_filter_low_pass_3db_frequency | Bandwidth for the Z-axis gyroscope channel.          |
+--------------------------------------------+------------------------------------------------------+
| in_anglvel_z_raw                           | Raw Z-axis gyroscope channel value.                  |
+--------------------------------------------+------------------------------------------------------+
| in_deltaangl_scale                         | Scale for delta angle channels.                      |
+--------------------------------------------+------------------------------------------------------+
| in_deltaangl_x_raw                         | Raw X-axis delta angle channel value.                |
+--------------------------------------------+------------------------------------------------------+
| in_deltaangl_y_raw                         | Raw Y-axis delta angle channel value.                |
+--------------------------------------------+------------------------------------------------------+
| in_deltaangl_z_raw                         | Raw Z-axis delta angle channel value.                |
+--------------------------------------------+------------------------------------------------------+

+----------------------------------+-------------------------------------------+
| Temperature sensor related files | Description                               |
+----------------------------------+-------------------------------------------+
| in_temp0_raw                     | Raw temperature channel value.            |
+----------------------------------+-------------------------------------------+
| in_temp0_offset                  | Offset for the temperature sensor channel.|
+----------------------------------+-------------------------------------------+
| in_temp0_scale                   | Scale for the temperature sensor channel. |
+----------------------------------+-------------------------------------------+

+-------------------------------+---------------------------------------------------------+
| Miscellaneous device files    | Description                                             |
+-------------------------------+---------------------------------------------------------+
| name                          | Name of the IIO device.                                 |
+-------------------------------+---------------------------------------------------------+
| sampling_frequency            | Currently selected sample rate.                         |
+-------------------------------+---------------------------------------------------------+

The following table shows the adis16480 related device debug files, found in the
specific device debug folder path ``/sys/kernel/debug/iio/iio:deviceX``.

+----------------------+-------------------------------------------------------------------------+
| Debugfs device files | Description                                                             |
+----------------------+-------------------------------------------------------------------------+
| serial_number        | The serial number of the chip in hexadecimal format.                    |
+----------------------+-------------------------------------------------------------------------+
| product_id           | Chip specific product id (e.g. 16480, 16488, 16545, etc.).              |
+----------------------+-------------------------------------------------------------------------+
| flash_count          | The number of flash writes performed on the device.                     |
+----------------------+-------------------------------------------------------------------------+
| firmware_revision    | String containing the firmware revision in the following format ##.##.  |
+----------------------+-------------------------------------------------------------------------+
| firmware_date        | String containing the firmware date in the following format mm-dd-yyyy. |
+----------------------+-------------------------------------------------------------------------+

Channels processed values
-------------------------

A channel value can be read from its _raw attribute. The value returned is the
raw value as reported by the devices. To get the processed value of the channel,
apply the following formula:

.. code-block:: bash

        processed value = (_raw + _offset) * _scale

Where _offset and _scale are device attributes. If no _offset attribute is
present, simply assume its value is 0.

The adis16480 driver offers data for 7 types of channels, the table below shows
the measurement units for the processed value, which are defined by the IIO
framework:

+--------------------------------------+---------------------------+
| Channel type                         | Measurement unit          |
+--------------------------------------+---------------------------+
| Acceleration on X, Y, and Z axis     | Meters per Second squared |
+--------------------------------------+---------------------------+
| Angular velocity on X, Y and Z axis  | Radians per second        |
+--------------------------------------+---------------------------+
| Delta velocity on X. Y, and Z axis   | Meters per Second         |
+--------------------------------------+---------------------------+
| Delta angle on X, Y, and Z axis      | Radians                   |
+--------------------------------------+---------------------------+
| Temperature                          | Millidegrees Celsius      |
+--------------------------------------+---------------------------+
| Magnetic field along X, Y and Z axis | Gauss                     |
+--------------------------------------+---------------------------+
| Barometric pressure                  | kilo Pascal               |
+--------------------------------------+---------------------------+

Usage examples
--------------

Show device name:

.. code-block:: bash

	root:/sys/bus/iio/devices/iio:device0> cat name
        adis16545-1

Show accelerometer channels value:

.. code-block:: bash

        root:/sys/bus/iio/devices/iio:device0> cat in_accel_x_raw
        1376728
        root:/sys/bus/iio/devices/iio:device0> cat in_accel_y_raw
        4487621
        root:/sys/bus/iio/devices/iio:device0> cat in_accel_z_raw
        262773792
        root:/sys/bus/iio/devices/iio:device0> cat in_accel_scale
        0.000000037

- X-axis acceleration = in_accel_x_raw * in_accel_scale = 0.050938936 m/s^2
- Y-axis acceleration = in_accel_y_raw * in_accel_scale = 0.166041977 m/s^2
- Z-axis acceleration = in_accel_z_raw * in_accel_scale = 9.722630304 m/s^2

Show gyroscope channels value:

.. code-block:: bash

        root:/sys/bus/iio/devices/iio:device0> cat in_anglvel_x_raw
        -1041702
        root:/sys/bus/iio/devices/iio:device0> cat in_anglvel_y_raw
        -273013
        root:/sys/bus/iio/devices/iio:device0> cat in_anglvel_z_raw
        2745116
        root:/sys/bus/iio/devices/iio:device0> cat in_anglvel_scale
        0.000000001

- X-axis angular velocity = in_anglvel_x_raw * in_anglvel_scale = −0.001041702 rad/s
- Y-axis angular velocity = in_anglvel_y_raw * in_anglvel_scale = −0.000273013 rad/s
- Z-axis angular velocity = in_anglvel_z_raw * in_anglvel_scale = 0.002745116 rad/s

Set calibration offset for accelerometer channels:

.. code-block:: bash

        root:/sys/bus/iio/devices/iio:device0> cat in_accel_x_calibbias
        0

        root:/sys/bus/iio/devices/iio:device0> echo 5000 > in_accel_x_calibbias
        root:/sys/bus/iio/devices/iio:device0> cat in_accel_x_calibbias
        5000

Set calibration offset for gyroscope channels:

.. code-block:: bash

        root:/sys/bus/iio/devices/iio:device0> cat in_anglvel_y_calibbias
        0

        root:/sys/bus/iio/devices/iio:device0> echo -5000 > in_anglvel_y_calibbias
        root:/sys/bus/iio/devices/iio:device0> cat in_anglvel_y_calibbias
        -5000

Set sampling frequency:

.. code-block:: bash

	root:/sys/bus/iio/devices/iio:device0> cat sampling_frequency
        4250.000000

        root:/sys/bus/iio/devices/iio:device0> echo 1000 > sampling_frequency
        1062.500000

Set bandwidth for accelerometer channels:

.. code-block:: bash

        root:/sys/bus/iio/devices/iio:device0> cat in_accel_x_filter_low_pass_3db_frequency
        0

        root:/sys/bus/iio/devices/iio:device0> echo 300 > in_accel_x_filter_low_pass_3db_frequency
        root:/sys/bus/iio/devices/iio:device0> cat in_accel_x_filter_low_pass_3db_frequency
        300

Show serial number:

.. code-block:: bash

        root:/sys/kernel/debug/iio/iio:device0> cat serial_number
        0x000c

Show product id:

.. code-block:: bash

        root:/sys/kernel/debug/iio/iio:device0> cat product_id
        16545

Show flash count:

.. code-block:: bash

        root:/sys/kernel/debug/iio/iio:device0> cat flash_count
        88

Show firmware revision:

.. code-block:: bash

        root:/sys/kernel/debug/iio/iio:device0> cat firmware_revision
        1.4

Show firmware date:

.. code-block:: bash

        root:/sys/kernel/debug/iio/iio:device0> cat firmware_date
        09-23-2023

3. Device buffers
=================

This driver supports IIO buffers.

All devices support retrieving the raw acceleration, gyroscope and temperature
measurements using buffers.

The following device families also support retrieving the delta velocity, delta
angle and temperature measurements using buffers:

- ADIS16545
- ADIS16547

However, when retrieving acceleration or gyroscope data using buffers, delta
readings will not be available and vice versa. This is because the device only
allows to read either acceleration and gyroscope data or delta velocity and
delta angle data at a time and switching between these two burst data selection
modes is time consuming.

Usage examples
--------------

Set device trigger in current_trigger, if not already set:

.. code-block:: bash

        root:/sys/bus/iio/devices/iio:device0> cat trigger/current_trigger

        root:/sys/bus/iio/devices/iio:device0> echo adis16545-1-dev0 > trigger/current_trigger
        root:/sys/bus/iio/devices/iio:device0> cat trigger/current_trigger
        adis16545-1-dev0

Select channels for buffer read:

.. code-block:: bash

        root:/sys/bus/iio/devices/iio:device0> echo 1 > scan_elements/in_deltavelocity_x_en
        root:/sys/bus/iio/devices/iio:device0> echo 1 > scan_elements/in_deltavelocity_y_en
        root:/sys/bus/iio/devices/iio:device0> echo 1 > scan_elements/in_deltavelocity_z_en
        root:/sys/bus/iio/devices/iio:device0> echo 1 > scan_elements/in_temp0_en

Set the number of samples to be stored in the buffer:

.. code-block:: bash

        root:/sys/bus/iio/devices/iio:device0> echo 10 > buffer/length

Enable buffer readings:

.. code-block:: bash

        root:/sys/bus/iio/devices/iio:device0> echo 1 > buffer/enable

Obtain buffered data::

  root:/sys/bus/iio/devices/iio:device0> hexdump -C /dev/iio\:device0
  ...
  00006aa0  09 62 00 00 ff ff fc a4  00 00 01 69 00 03 3c 08  |.b.........i..<.|
  00006ab0  09 61 00 00 00 00 02 96  00 00 02 8f 00 03 37 50  |.a............7P|
  00006ac0  09 61 00 00 00 00 12 3d  00 00 0b 89 00 03 2c 0b  |.a.....=......,.|
  00006ad0  09 61 00 00 00 00 1e dc  00 00 16 dd 00 03 25 bf  |.a............%.|
  00006ae0  09 61 00 00 00 00 1e e3  00 00 1b bf 00 03 27 0b  |.a............'.|
  00006af0  09 61 00 00 00 00 15 50  00 00 19 44 00 03 30 fd  |.a.....P...D..0.|
  00006b00  09 61 00 00 00 00 09 0e  00 00 14 41 00 03 3d 7f  |.a.........A..=.|
  00006b10  09 61 00 00 ff ff ff f0  00 00 0e bc 00 03 48 d0  |.a............H.|
  00006b20  09 63 00 00 00 00 00 9f  00 00 0f 37 00 03 4c fe  |.c.........7..L.|
  00006b30  09 64 00 00 00 00 0b f6  00 00 18 92 00 03 43 22  |.d............C"|
  00006b40  09 64 00 00 00 00 18 df  00 00 22 33 00 03 33 ab  |.d........"3..3.|
  00006b50  09 63 00 00 00 00 1e 81  00 00 26 be 00 03 29 60  |.c........&...)`|
  00006b60  09 63 00 00 00 00 1b 13  00 00 22 2f 00 03 23 91  |.c........"/..#.|
  ...

See ``Documentation/iio/iio_devbuf.rst`` for more information about how buffered
data is structured.

4. IIO Interfacing Tools
========================

See ``Documentation/iio/iio_tools.rst`` for the description of the available IIO
interfacing tools.