Wiki

This version is outdated by a newer approved version.DiffThis version (21 Aug 2019 14:48) was approved by Nuno Sá.

This is an old revision of the document!


LTC2983 Multi-Sensor Digital Temperature Measurement System Driver

Supported Devices

Evaluation Boards

Description

This is a Linux industrial I/O (IIO) subsystem driver, targeting temperature sensors. The industrial I/O subsystem provides a unified framework for drivers for many different types of converters and sensors using a number of different physical interfaces (i2c, spi, etc). See IIO for more information.

Source Code

Status

Source Mainlined?
git WIP

Files

Example SPI device initialization

The LTC2983 supports SPI interfaces. Currently, the devices can only be instantiated via device tree. All the sensors attached on the LTC2983 channels must be described and instantiated on the devicetree.

Required devicetree properties:

  • compatible: Must be always one of these:
    • adi,ltc2983
  • reg: Must be the SPI device chip select number.
  • interrupts: Interrupt line.

Example with thermoucouple and RTD:

spi0 {
         #address-cells = <1>;
         #size-cells = <0>;
         sensor_ltc2983: ltc2983@0 {
                 compatible = "adi,ltc2983";
                 reg = <0>;

                 #address-cells = <1>;
                 #size-cells = <0>;
                 adi,temperature-celcius;
                 interrupts = <20 IRQ_TYPE_EDGE_RISING>;
                 
                 diode5: diode@5 {
                         reg = <5>;
                         adi,sensor-type = <28>;
                 };

                 thermocouple@18 {
                         reg = <18>;
                         adi,sensor-type = <8>; //Type B
                         adi,sensor-config = <1>; //Differential, open-circuit current
                         adi,cold-junction-handle = <&diode5>;
                 };
                 
                 rsense2: rsense@2 {
                        reg = <2>;
                        adi,sensor-type = <29>;
                        adi,rsense-val-micro-ohms = /bits/ 64 <1200000000>; //1.2Kohms
                 };
                 
                 rtd@14 {
                         reg = <14>;
                         adi,sensor-type = <15>; //PT1000
                         /*2-wire, internal gnd, no current rotation*/
                         adi,sensor-config = <1>;
                         adi,excitation-current = <7>; //500uA
                         adi,rsense-handle = <&rsense2>;
                 };
        };
};

For more details, look at bindings.

Adding Linux driver support

Configure kernel with “make menuconfig” (alternatively use “make xconfig” or “make qconfig”).

The LTC2983 driver depends CONFIG_SPI.

Linux Kernel Configuration
	Device Drivers  --->
	<*>     Industrial I/O support --->
	    --- Industrial I/O support
            [--snip--]
	          Temperature sensors --->
	    [--snip--]
	        -*- Analog Devices Multi-Sensor Digital Temperature Measurement System
	    [--snip--]

Hardware configuration

Driver testing

Each and every IIO device, typically a hardware chip, has a device folder under /sys/bus/iio/devices/iio:deviceX. Where X is the IIO index of the device. Under every of these directory folders reside a set of files, depending on the characteristics and features of the hardware device in question. These files are consistently generalized and documented in the IIO ABI documentation. In order to determine which IIO deviceX corresponds to which hardware device, the user can read the name file /sys/bus/iio/devices/iio:deviceX/name. In case the sequence in which the iio device drivers are loaded/registered is constant, the numbering is constant and may be known in advance.

02 Mar 2011 15:16

This specifies any shell prompt running on the target

root:/> cd /sys/bus/iio/devices/
root:/sys/bus/iio/devices> ls
iio:device0
root:/sys/bus/iio/devices> cd iio:device0
root:/sys/bus/iio/devices/iio:device0> ls -l
-r--r--r-- 1 root root 4096 Nov 16 11:17 dev
-rw-r--r-- 1 root root 4096 Nov 16 11:17 in_temp0_thermistor_raw
-rw-r--r-- 1 root root 4096 Nov 16 11:17 in_temp1_rtd_raw
-rw-r--r-- 1 root root 4096 Nov 16 11:17 in_temp2_diode_raw
-rw-r--r-- 1 root root 4096 Nov 16 11:17 in_temp3_thermocouple_raw
-rw-r--r-- 1 root root 4096 Nov 16 11:17 in_temp_scale
-rw-r--r-- 1 root root 4096 Nov 16 11:17 in_voltage0_direct_adc_raw
-rw-r--r-- 1 root root 4096 Nov 16 11:17 in_voltage_scale
-r--r--r-- 1 root root 4096 Nov 16 11:17 name
lrwxrwxrwx 1 root root    0 Nov 16 11:17 of_node -> ../../../../../../../../firmware/devicetree/base/soc/spi@7e204000/ltc2983@0
drwxr-xr-x 2 root root    0 Nov 16 11:17 power
lrwxrwxrwx 1 root root    0 Nov 16 11:17 subsystem -> ../../../../../../../../bus/iio
-rw-r--r-- 1 root root 4096 Nov 16 11:17 uevent
root:/sys/bus/iio/devices/iio:device0>

Show device name

This specifies any shell prompt running on the target

root:/sys/bus/iio/devices/iio:device0> cat name
ltc2983

Show temperature

This specifies any shell prompt running on the target

root:/sys/bus/iio/devices/iio:device0> cat in_temp0_thermistor_raw
1048576

Show temperature scale

Description:
scale to be applied to in_tempX_${sensor_type}_raw in order to obtain the measured temperature in °C or °F (depending on chip configuration).

This specifies any shell prompt running on the target

root:/sys/bus/iio/devices/iio:device0> cat in_temp_scale
0.000976562

Show voltage

This specifies any shell prompt running on the target

root:/sys/bus/iio/devices/iio:device0> cat in_voltage0_direct_adc_raw
2621440

Show Voltage scale

Description:
scale to be applied to in_voltageX_direct_adc_raw in order to obtain the measured voltage in Volts

This specifies any shell prompt running on the target

root:/sys/bus/iio/devices/iio:device0> cat in_voltage_scale
0.000000476

More Information

resources/tools-software/linux-drivers/iio-temperature/ltc2983.1566391693.txt.gz · Last modified: 21 Aug 2019 14:48 by Nuno Sá