MAX11205

MAX11205 IIO ADC Linux Driver.

Supported Devices

Evaluation Boards

Description

The MAX11205 is an ultra-low-power (< 300µA max active current), high-resolution, serial output ADC. This device provides the highest resolution per unit power in the industry and is optimized for applications that require very high dynamic range with low power such as sensors on a 4mA to 20mA industrial control loop. The MAX11205 provides a high-accuracy internal oscillator that requires no external components.

When used with the specified data rates, the internal digital filter provides more than 80dB rejection of 50Hz or 60Hz line noise. The MAX11205 provides a simple 2-wire serial interface in the space-saving, 10-pin µMAX® package. The MAX11205 operates over the -40°C to +85°C temperature range.

https://wiki.analog.com/_media/resources/tools-software/uc-drivers/max11205pmb1.png

Source Code

Status

Files

Function

File

driver

drivers/iio/adc/max11205.c

Documentation

maxim,max11205.yaml

Driver testing

The driver exposes one voltage input channel. The following example uses MAX11205A; MAX11205B has a different fixed sample rate.

root@analog:/sys/bus/iio/devices# ls
iio:device0  iio_sysfs_trigger  trigger0
root@analog:/sys/bus/iio/devices# cd iio:device0
root@analog:/sys/bus/iio/devices/iio:device0# ls -l
total 0
drwxr-xr-x 2 root root    0 Sep  6 08:17 buffer
-r--r--r-- 1 root root 4096 Sep  6 08:17 dev
-rw-r--r-- 1 root root 4096 Sep  6 08:17 in_voltage0_raw
-rw-r--r-- 1 root root 4096 Sep  6 08:17 in_voltage0_sampling_frequency
-rw-r--r-- 1 root root 4096 Sep  6 08:17 in_voltage0_scale
-r--r--r-- 1 root root 4096 Sep  6 08:17 name
lrwxrwxrwx 1 root root    0 Sep  6 08:17 of_node -> ../../../../../../../../firmware/devicetree/base/soc/spi@7e204000/max11205@0
drwxr-xr-x 2 root root    0 Sep  6 08:17 power
drwxr-xr-x 2 root root    0 Sep  6 08:17 scan_elements
lrwxrwxrwx 1 root root    0 Sep  6 08:17 subsystem -> ../../../../../../../../bus/iio
drwxr-xr-x 2 root root    0 Sep  6 08:17 trigger
-rw-r--r-- 1 root root 4096 Sep  6 08:17 uevent

Identify the device

root@analog:/sys/bus/iio/devices/iio:device0# cat name
max11205a

Basic operation

Show raw measurement

Description: Raw measurement of voltage on channel 0.

root@analog:/sys/bus/iio/devices/iio:device0# cat in_voltage0_raw
20137

U = in_voltage0_raw * in_voltage0_scale = 20137 * 0.097656250 = 1966.50390625 mV

Show scale

Description: Scale to be applied to the raw measurement of voltage on channel 0 in order to obtain the actual voltage.

root@analog:/sys/bus/iio/devices/iio:device0# cat in_voltage0_scale
0.097656250

Show sampling frequency

Description: Fixed sample rate reported by the driver: 116 Hz for MAX11205A and 13 Hz for MAX11205B. The driver implements no write callback, so writing this attribute fails; select the rate by using the correct maxim,max11205a or maxim,max11205b compatible.

root@analog:/sys/bus/iio/devices/iio:device0# cat in_voltage0_sampling_frequency
116

Trigger management

root@analog:/sys/bus/iio/devices/iio:device0# cat trigger/current_trigger
max11205a-dev0

Buffer management

The Industrial I/O subsystem supports buffered data acquisition. Buffer implementation and capabilities depend on the driver. Devices with buffer support expose each buffer at /sys/bus/iio/devices/iio:deviceX/bufferY, where Y is the buffer index, starting at 0. The first buffer is additionally exposed through the legacy buffer directory, which contains its buffer-control attributes. Its scan configuration is exposed through the legacy scan_elements directory, while multi-buffer systems expose the scan attributes in the corresponding bufferY directory. Read samples from the device character node /dev/iio:deviceX; the selected buffer is determined by the active buffer configuration.

length

Get/set the number of sample sets that may be held by the buffer.

enable

Enables/disables the buffer. This file should be written last, after length and selection of scan elements.

watermark

A single positive integer specifying the maximum number of scan elements to wait for. Poll will block until the watermark is reached. Blocking read will wait until the minimum between the requested read amount or the low water mark is available. Non-blocking read will retrieve the available samples from the buffer even if there are less samples then watermark level. This allows the application to block on poll with a timeout and read the available samples after the timeout expires and thus have a maximum delay guarantee.

data_available

A read-only value indicating the bytes of data available in the buffer. In the case of an output buffer, this indicates the amount of empty space available to write data to. In the case of an input buffer, this indicates the amount of data available for reading.

length_align_bytes

Using the high-speed interface. DMA buffers may have an alignment requirement for the buffer length. Newer versions of the kernel will report the alignment requirements associated with a device through the length_align_bytes property.

scan_elements

The scan_elements directory contains interfaces for elements that will be captured for a single triggered sample set in the buffer.

root@analog:/sys/bus/iio/devices/iio:device0/scan_elements# ls
in_voltage0_en  in_voltage0_index  in_voltage0_type
in_voltageX_en / in_voltageX-voltageY_en / in_timestamp_en:

Scan element control for triggered data capture. Writing 1 will enable the scan element, writing 0 will disable it

in_voltageX_type / in_voltageX-voltageY_type / in_timestamp_type:

Describes the scan element’s representation in the buffer. The format is [be|le]:[s|u]bits/storagebits[Xrepeat]>>shift. The prefix gives byte order; s or u specifies signed (two’s complement) or unsigned data. bits is the number of meaningful bits and storagebits is the storage width. The optional repeat count describes repeated elements. After interpreting byte order, shift the storage value right by shift and mask it to bits; signed values also require sign extension. For example, be:u12/16>>1 describes an unsigned 12-bit value in big-endian 16-bit storage, shifted right by one bit. Account for alignment padding when combining enabled elements into a complete scan.

in_voltageX_index / in_voltageX-voltageY_index / in_timestamp_index:

A nonnegative integer specifying the ordering of this scan element in the buffer. Note these are not dependent on what is enabled and may not be contiguous. Thus for user-space to establish the full layout these must be used in conjunction with all _en attributes to establish which channels are present, and the relevant _type attributes to establish the data storage format.

More Information