ad4000.rst 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. .. SPDX-License-Identifier: GPL-2.0-only
  2. =============
  3. AD4000 driver
  4. =============
  5. Device driver for Analog Devices Inc. AD4000 series of ADCs and similar devices.
  6. Supported devices
  7. =================
  8. * `AD4000 <https://www.analog.com/AD4000>`_
  9. * `AD4001 <https://www.analog.com/AD4001>`_
  10. * `AD4002 <https://www.analog.com/AD4002>`_
  11. * `AD4003 <https://www.analog.com/AD4003>`_
  12. * `AD4004 <https://www.analog.com/AD4004>`_
  13. * `AD4005 <https://www.analog.com/AD4005>`_
  14. * `AD4006 <https://www.analog.com/AD4006>`_
  15. * `AD4007 <https://www.analog.com/AD4007>`_
  16. * `AD4008 <https://www.analog.com/AD4008>`_
  17. * `AD4010 <https://www.analog.com/AD4010>`_
  18. * `AD4011 <https://www.analog.com/AD4011>`_
  19. * `AD4020 <https://www.analog.com/AD4020>`_
  20. * `AD4021 <https://www.analog.com/AD4021>`_
  21. * `AD4022 <https://www.analog.com/AD4022>`_
  22. * `ADAQ4001 <https://www.analog.com/ADAQ4001>`_
  23. * `ADAQ4003 <https://www.analog.com/ADAQ4003>`_
  24. * `AD7685 <https://www.analog.com/AD7685>`_
  25. * `AD7686 <https://www.analog.com/AD7686>`_
  26. * `AD7687 <https://www.analog.com/AD7687>`_
  27. * `AD7688 <https://www.analog.com/AD7688>`_
  28. * `AD7690 <https://www.analog.com/AD7690>`_
  29. * `AD7691 <https://www.analog.com/AD7691>`_
  30. * `AD7693 <https://www.analog.com/AD7693>`_
  31. * `AD7942 <https://www.analog.com/AD7942>`_
  32. * `AD7946 <https://www.analog.com/AD7946>`_
  33. * `AD7980 <https://www.analog.com/AD7980>`_
  34. * `AD7982 <https://www.analog.com/AD7982>`_
  35. * `AD7983 <https://www.analog.com/AD7983>`_
  36. * `AD7984 <https://www.analog.com/AD7984>`_
  37. * `AD7988-1 <https://www.analog.com/AD7988-1>`_
  38. * `AD7988-5 <https://www.analog.com/AD7988-5>`_
  39. Wiring connections
  40. ------------------
  41. Devices of the AD4000 series can be connected to the SPI host controller in a
  42. few different modes.
  43. CS mode, 3-wire turbo mode
  44. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  45. Datasheet "3-wire" mode is what most resembles standard SPI connection which,
  46. for these devices, comprises of connecting the controller CS line to device CNV
  47. pin and other SPI lines as usual. This configuration is (misleadingly) called
  48. "CS Mode, 3-Wire Turbo Mode" connection in datasheets.
  49. NOTE: The datasheet definition of 3-wire mode for the AD4000 series is NOT the
  50. same of standard spi-3wire mode.
  51. This is the only connection mode that allows configuration register access but
  52. it requires the SPI controller to support the ``SPI_MOSI_IDLE_HIGH`` feature.
  53. Omit the ``adi,sdi-pin`` property in device tree to select this mode.
  54. ::
  55. +-------------+
  56. + ----------------------------------| SDO |
  57. | | |
  58. | +-------------------| CS |
  59. | v | |
  60. | +--------------------+ | HOST |
  61. | | CNV | | |
  62. +--->| SDI AD4000 SDO |-------->| SDI |
  63. | SCK | | |
  64. +--------------------+ | |
  65. ^ | |
  66. +--------------------| SCLK |
  67. +-------------+
  68. CS mode, 3-wire, without busy indicator
  69. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  70. Another wiring configuration supported as "3-wire" mode has the SDI pin
  71. hard-wired to digital input/output interface supply (VIO). In this setup, the
  72. controller is not required to support ``SPI_MOSI_IDLE_HIGH`` but register access
  73. is not possible. This connection mode saves one wire and works with any SPI
  74. controller.
  75. Set the ``adi,sdi-pin`` device tree property to ``"high"`` to select this mode.
  76. ::
  77. +-------------+
  78. +--------------------| CS |
  79. v | |
  80. VIO +--------------------+ | HOST |
  81. | | CNV | | |
  82. +--->| SDI AD4000 SDO |-------->| SDI |
  83. | SCK | | |
  84. +--------------------+ | |
  85. ^ | |
  86. +--------------------| SCLK |
  87. +-------------+
  88. Alternatively, a GPIO may be connected to the device CNV pin. This is similar to
  89. the previous wiring configuration but saves the use of a CS line.
  90. ::
  91. +-------------+
  92. +--------------------| GPIO |
  93. v | |
  94. VIO +--------------------+ | HOST |
  95. | | CNV | | |
  96. +--->| SDI AD4000 SDO |-------->| SDI |
  97. | SCK | | |
  98. +--------------------+ | |
  99. ^ | |
  100. +--------------------| SCLK |
  101. +-------------+
  102. CS mode, 4-wire without busy indicator
  103. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  104. In datasheet "4-wire" mode, the controller CS line is connected to the ADC SDI
  105. pin and a GPIO is connected to the ADC CNV pin. This connection mode may better
  106. suit scenarios where multiple ADCs can share one CNV trigger.
  107. Set ``adi,sdi-pin`` to ``"cs"`` to select this mode.
  108. ::
  109. +-------------+
  110. + ----------------------------------| CS |
  111. | | |
  112. | +-------------------| GPIO |
  113. | v | |
  114. | +--------------------+ | HOST |
  115. | | CNV | | |
  116. +--->| SDI AD4000 SDO |-------->| SDI |
  117. | SCK | | |
  118. +--------------------+ | |
  119. ^ | |
  120. +--------------------| SCLK |
  121. +-------------+
  122. IIO Device characteristics
  123. ==========================
  124. The AD4000 series driver supports differential and pseudo-differential ADCs.
  125. The span compression feature available in AD4000 series devices can be
  126. enabled/disabled by changing the ``_scale_available`` attribute of the voltage
  127. channel. Note that span compression configuration requires writing to AD4000
  128. configuration register, which is only possible when the ADC is wired in 3-wire
  129. turbo mode, and the SPI controller is ``SPI_MOSI_IDLE_HIGH`` capable. If those
  130. conditions are not met, no ``_scale_available`` attribute is provided.
  131. Besides that, differential and pseudo-differential voltage channels present
  132. slightly different sysfs interfaces.
  133. Pseudo-differential ADCs
  134. ------------------------
  135. Typical voltage channel attributes of a pseudo-differential AD4000 series device:
  136. +-------------------------------------------+------------------------------------------+
  137. | Voltage Channel Attributes | Description |
  138. +===========================================+==========================================+
  139. | ``in_voltage0_raw`` | Raw ADC output code. |
  140. +-------------------------------------------+------------------------------------------+
  141. | ``in_voltage0_offset`` | Offset to convert raw value to mV. |
  142. +-------------------------------------------+------------------------------------------+
  143. | ``in_voltage0_scale`` | Scale factor to convert raw value to mV. |
  144. +-------------------------------------------+------------------------------------------+
  145. | ``in_voltage0_scale_available`` | Toggles input span compression |
  146. +-------------------------------------------+------------------------------------------+
  147. Differential ADCs
  148. -----------------
  149. Typical voltage channel attributes of a differential AD4000 series device:
  150. +-------------------------------------------+------------------------------------------+
  151. | Voltage Channel Attributes | Description |
  152. +===========================================+==========================================+
  153. | ``in_voltage0-voltage1_raw`` | Raw ADC output code. |
  154. +-------------------------------------------+------------------------------------------+
  155. | ``in_voltage0-voltage1_scale`` | Scale factor to convert raw value to mV. |
  156. +-------------------------------------------+------------------------------------------+
  157. | ``in_voltage0-voltage1_scale_available`` | Toggles input span compression |
  158. +-------------------------------------------+------------------------------------------+
  159. SPI offload support
  160. -------------------
  161. To be able to achieve the maximum sample rate, the driver can be used with SPI
  162. offload engines such as the one usually present in `AXI SPI Engine`_, to provide
  163. SPI offload support.
  164. .. _AXI SPI Engine: http://analogdevicesinc.github.io/hdl/projects/pulsar_adc/index.html
  165. To keep up with SPI offloading transfer speeds, the ADC must be connected either
  166. in 3-wire turbo mode or in 3-wire without busy indicator mode and have SPI
  167. controller CS line connected to the CNV pin.
  168. When set for SPI offload support, the IIO device will provide different
  169. interfaces.
  170. * Either ``in_voltage0_sampling_frequency`` or
  171. ``in_voltage0-voltage1_sampling_frequency`` file is provided to allow setting
  172. the sample rate.
  173. * IIO trigger device is not provided (no ``trigger`` directory).
  174. * ``timestamp`` channel is not provided.
  175. Also, because the ADC output has a one sample latency (delay) when the device is
  176. wired in "3-wire" mode and only one transfer per sample is done when using SPI
  177. offloading, the first data sample in the buffer is not valid because it contains
  178. the output of an earlier conversion result.