Debian Codegraph @

Documentation/iio/ad7380.rst

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