ad7380.rst 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. .. SPDX-License-Identifier: GPL-2.0-only
  2. =============
  3. AD7380 driver
  4. =============
  5. ADC driver for Analog Devices Inc. AD7380 and similar devices. The module name
  6. is ``ad7380``.
  7. Supported devices
  8. =================
  9. The following chips are supported by this driver:
  10. * `AD7380 <https://www.analog.com/en/products/ad7380.html>`_
  11. * `AD7381 <https://www.analog.com/en/products/ad7381.html>`_
  12. * `AD7383 <https://www.analog.com/en/products/ad7383.html>`_
  13. * `AD7384 <https://www.analog.com/en/products/ad7384.html>`_
  14. * `AD7386 <https://www.analog.com/en/products/ad7386.html>`_
  15. * `AD7387 <https://www.analog.com/en/products/ad7387.html>`_
  16. * `AD7388 <https://www.analog.com/en/products/ad7388.html>`_
  17. * `AD7380-4 <https://www.analog.com/en/products/ad7380-4.html>`_
  18. * `AD7381-4 <https://www.analog.com/en/products/ad7381-4.html>`_
  19. * `AD7383-4 <https://www.analog.com/en/products/ad7383-4.html>`_
  20. * `AD7384-4 <https://www.analog.com/en/products/ad7384-4.html>`_
  21. * `AD7386-4 <https://www.analog.com/en/products/ad7386-4.html>`_
  22. * `AD7387-4 <https://www.analog.com/en/products/ad7387-4.html>`_
  23. * `AD7388-4 <https://www.analog.com/en/products/ad7388-4.html>`_
  24. * `AD7389-4 <https://www.analog.com/en/products/ad7389-4.html>`_
  25. * `ADAQ4370-4 <https://www.analog.com/en/products/adaq4370-4.html>`_
  26. * `ADAQ4380-4 <https://www.analog.com/en/products/adaq4380-4.html>`_
  27. * `ADAQ4381-4 <https://www.analog.com/en/products/adaq4381-4.html>`_
  28. Supported features
  29. ==================
  30. SPI wiring modes
  31. ----------------
  32. ad738x ADCs can output data on several SDO lines (1/2/4). The driver currently
  33. supports only 1 SDO line.
  34. Reference voltage
  35. -----------------
  36. ad7380-4
  37. ~~~~~~~~
  38. ad7380-4 supports only an external reference voltage (2.5V to 3.3V). It must be
  39. declared in the device tree as ``refin-supply``.
  40. ad7389-4
  41. ~~~~~~~~
  42. ad7389-4 supports only an internal reference voltage. ``refin-supply`` and
  43. ``refio-supply`` properties are both omitted in this case.
  44. ADAQ devices
  45. ~~~~~~~~~~~~
  46. ADAQ devices don't have an external reference, but use a 3.3V internal reference
  47. derived from one of its supplies (``refin-supply``)
  48. All other devices from ad738x family
  49. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  50. All other devices from ad738x support 2 possible reference voltage sources:
  51. - Internal reference (2.5V)
  52. - External reference (2.5V to 3.3V)
  53. The source is determined by the device tree. If ``refio-supply`` is present,
  54. then it is used as external reference, else the internal reference is used.
  55. Oversampling and resolution boost
  56. ---------------------------------
  57. This family supports 2 types of oversampling: normal average and rolling
  58. average. Only normal average is supported by the driver, as rolling average can
  59. be achieved by processing a captured data buffer. The following ratios are
  60. available: 1 (oversampling disabled)/2/4/8/16/32.
  61. When the on-chip oversampling function is enabled the performance of the ADC can
  62. exceed the default resolution. To accommodate the performance boost achievable,
  63. it is possible to enable an additional two bits of resolution. Because the
  64. resolution boost feature can only be enabled when oversampling is enabled and
  65. oversampling is not as useful without the resolution boost, the driver
  66. automatically enables the resolution boost if and only if oversampling is
  67. enabled.
  68. Since the resolution boost feature causes 16-bit chips to now have 18-bit data
  69. which means the storagebits has to change from 16 to 32 bits, we use the new
  70. ext_scan_type feature to allow changing the scan_type at runtime. Unfortunately
  71. libiio does not support it. So when enabling or disabling oversampling, user
  72. must restart iiod using the following command:
  73. .. code-block:: bash
  74. root:~# systemctl restart iiod
  75. Alert
  76. -----
  77. 2 channels variants of the ad738x family, can use the SDOB line as an alert pin
  78. when configured in 1 SDO line mode. 4 channels variants, can use SDOD as an
  79. alert pin when configured in 1 or 2 SDO line(s) mode, although only 1 SDO line
  80. mode is currently supported by the driver (see `SPI wiring modes`_).
  81. At the end of a conversion the active-low alert pin gets asserted if the
  82. conversion result exceeds the alert high limit or falls below the alert low
  83. limit. It is cleared, on a falling edge of CS. The alert pin is common to all
  84. channels.
  85. User can enable alert using the regular iio events attribute:
  86. .. code-block:: bash
  87. events/thresh_either_en
  88. The high and low thresholds are common to all channels and can also be set using
  89. regular iio events attributes:
  90. .. code-block:: bash
  91. events/in_thresh_falling_value
  92. events/in_thresh_rising_value
  93. If debugfs is available, user can read the ALERT register to determine the
  94. faulty channel and direction.
  95. In most use cases, user will hardwire the alert pin to trigger a shutdown.
  96. Channel selection and sequencer (single-end chips only)
  97. -------------------------------------------------------
  98. Single-ended chips of this family (ad7386/7/8(-4)) have a 2:1 multiplexer in
  99. front of each ADC. They also include additional configuration registers that
  100. allow for either manual selection or automatic switching (sequencer mode), of
  101. the multiplexer inputs.
  102. From an IIO point of view, all inputs are exported, i.e ad7386/7/8
  103. export 4 channels and ad7386-4/7-4/8-4 export 8 channels.
  104. Inputs ``AinX0`` of multiplexers correspond to the first half of IIO channels (i.e
  105. 0-1 or 0-3) and inputs ``AinX1`` correspond to second half (i.e 2-3 or 4-7).
  106. Example for AD7386/7/8 (2 channels parts):
  107. .. code-block::
  108. IIO | AD7386/7/8
  109. | +----------------------------
  110. | | _____ ______
  111. | | | | | |
  112. voltage0 | AinA0 --|--->| | | |
  113. | | | mux |----->| ADCA |---
  114. voltage2 | AinA1 --|--->| | | |
  115. | | |_____| |_____ |
  116. | | _____ ______
  117. | | | | | |
  118. voltage1 | AinB0 --|--->| | | |
  119. | | | mux |----->| ADCB |---
  120. voltage3 | AinB1 --|--->| | | |
  121. | | |_____| |______|
  122. | |
  123. | +----------------------------
  124. When enabling sequencer mode, the effective sampling rate is divided by two.
  125. Gain (ADAQ devices only)
  126. ~~~~~~~~~~~~~~~~~~~~~~~~
  127. ADAQ devices have a pin selectable gain in front of each ADC. The appropriate
  128. gain is selectable from device tree using the ``adi,gain-milli`` property.
  129. Refer to the typical connection diagrams section of the datasheet for pin
  130. wiring.
  131. Unimplemented features
  132. ----------------------
  133. - 2/4 SDO lines
  134. - Rolling average oversampling
  135. - Power down mode
  136. - CRC indication
  137. SPI offload support
  138. ===================
  139. To be able to achieve the maximum sample rate, the driver can be used with the
  140. `AXI SPI Engine`_ to provide SPI offload support.
  141. .. _AXI SPI Engine: http://analogdevicesinc.github.io/hdl/projects/pulsar_adc/index.html
  142. When SPI offload is being used, some attributes will be different.
  143. * ``trigger`` directory is removed.
  144. * ``in_voltage0_sampling_frequency`` attribute is added for setting the sample
  145. rate.
  146. * ``in_voltage0_sampling_frequency_available`` attribute is added for querying
  147. the max sample rate.
  148. * ``timestamp`` channel is removed.
  149. * Buffer data format may be different compared to when offload is not used,
  150. e.g. the ``in_voltage0_type`` attribute.
  151. Device buffers
  152. ==============
  153. This driver supports IIO triggered buffers.
  154. See :doc:`iio_devbuf` for more information.