This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
resources:tools-software:linux-drivers:iio-dac:ad5593r [22 Feb 2016 17:30] – [Device tree example] Michael Hennerich | resources:tools-software:linux-drivers:iio-dac:ad5593r [07 Jun 2016 16:36] – [Status] Michael Hennerich | ||
---|---|---|---|
Line 26: | Line 26: | ||
The AD5593R have an integrated 2.5 V, 25 ppm/°C reference, which is turned off by default, and an integrated temperature indicator, which gives an indication of the die temperature. The temperature value is read back as part of an ADC read sequence. | The AD5593R have an integrated 2.5 V, 25 ppm/°C reference, which is turned off by default, and an integrated temperature indicator, which gives an indication of the die temperature. The temperature value is read back as part of an ADC read sequence. | ||
+ | |||
+ | ====== Source Code ====== | ||
+ | |||
+ | ===== Status ===== | ||
+ | |||
+ | ^ Source ^ Mainlined? ^ | ||
+ | | [[git.linux.org> | ||
+ | |||
+ | ===== Files ===== | ||
+ | |||
+ | ^ Function ^ File ^ | ||
+ | | driver | ||
+ | | include | ||
+ | | driver | ||
+ | | include | ||
+ | | Documentation | ||
====== Hardware configuration ====== | ====== Hardware configuration ====== | ||
Line 66: | Line 82: | ||
* " | * " | ||
* **reg**: I2C address of the chip (generally 0x10). | * **reg**: I2C address of the chip (generally 0x10). | ||
- | * **channel-modes**: | + | * **channel-modes**: |
- | * 0 = unused | + | * CH_MODE_ADC (the pin is ADC input) |
- | * 1 = DAC, | + | * CH_MODE_DAC (the pin is DAC output) |
- | * 2 = ADC, | + | * CH_MODE_DAC_AND_ADC (the pin is DAC output but can be monitored by an ADC) |
- | * 6 = tri-state | + | * CH_MODE_UNUSED_PULL_DOWN |
+ | * CH_MODE_UNUSED_OUT_LOW (the pin is output low) | ||
+ | * CH_MODE_UNUSED_OUT_HIGH (the pin is output high) | ||
+ | * CH_MODE_UNUSED_OUT_TRISTATE (the pin is tristated output) | ||
+ | * CH_MODE_GPIO (the pin is registered with GPIOLIB) | ||
+ | * CH_MODE_GPIO_OPEN_DRAIN (the pin is configured open drain and registered with GPIOLIB) | ||
+ | ==== Optional properties ==== | ||
+ | * **vref-supply**: Phandle to the external reference voltage supply. This should only be set if there is an external reference voltage connected to the VREF pin. If the property is not set the internal 2.5V reference is used. | ||
+ | * **reset-gpios**: | ||
==== Device tree example ==== | ==== Device tree example ==== | ||
- | The following example instanciates the ad5593r driver for a AD5593R device connected on a I2C bus. It sets the I/O0 port as a DAC, the I/O1 and I/O2 ports as ADCs. The other I/O ports are connected to the ground with a pull-down resistor. | + | The following example instanciates the ad5593r driver for a AD5593R device connected on a I2C bus. It sets the I/O0 port as a DAC, the I/O1 port as ADC. I/O2 and I/O3 are configured for primary function DAC the additional ADC can measure the voltage being provided by the DAC. This feature can monitor the output voltage to detect short circuits or overload conditions. I/O4 is connected to the ground with a pull-down resistor. |
+ | |||
< | < | ||
Line 156: | Line 180: | ||
attr 2: scale value: 452.147700000 | attr 2: scale value: 452.147700000 | ||
+ | </ | ||
+ | === IIO sysfs interface === | ||
+ | |||
+ | < | ||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | total 0 | ||
+ | drwxr-xr-x 3 root root 0 Jan 1 1970 . | ||
+ | drwxr-xr-x 5 root root 0 Jan 1 1970 .. | ||
+ | -rw-rw-rw- 1 root root 4096 Jan 1 1970 dev | ||
+ | -rw-rw-rw- 1 root root 4096 Jan 1 1970 in_temp_offset | ||
+ | -rw-rw-rw- 1 root root 4096 Jan 1 1970 in_temp_raw | ||
+ | -rw-rw-rw- 1 root root 4096 Jan 1 1970 in_temp_scale | ||
+ | -rw-rw-rw- 1 root root 4096 Jan 1 1970 in_voltage1_raw | ||
+ | -rw-rw-rw- 1 root root 4096 Jan 1 1970 in_voltage2_raw | ||
+ | -rw-rw-rw- 1 root root 4096 Jan 1 1970 in_voltage3_raw | ||
+ | -rw-rw-rw- 1 root root 4096 Jan 1 1970 in_voltage_scale | ||
+ | -rw-rw-rw- 1 root root 4096 Jan 1 1970 in_voltage_scale_available | ||
+ | -rw-rw-rw- 1 root root 4096 Jan 1 1970 name | ||
+ | lrwxrwxrwx 1 root root 0 Jan 1 1970 of_node -> ../ | ||
+ | -rw-rw-rw- 1 root root 4096 Jan 1 1970 out_voltage0_raw | ||
+ | -rw-rw-rw- 1 root root 4096 Jan 1 1970 out_voltage2_raw | ||
+ | -rw-rw-rw- 1 root root 4096 Jan 1 1970 out_voltage3_raw | ||
+ | -rw-rw-rw- 1 root root 4096 Jan 1 1970 out_voltage_scale | ||
+ | -rw-rw-rw- 1 root root 4096 Jan 1 1970 out_voltage_scale_available | ||
+ | drwxrwxrwx 2 root root 0 Jan 1 1970 power | ||
+ | lrwxrwxrwx 1 root root 0 Jan 1 1970 subsystem -> ../ | ||
+ | -rw-rw-rw- 1 root root 4096 Jan 1 1970 uevent | ||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | dev:252:2 | ||
+ | in_temp_offset: | ||
+ | in_temp_raw: | ||
+ | in_temp_scale: | ||
+ | in_voltage1_raw: | ||
+ | in_voltage2_raw: | ||
+ | in_voltage3_raw: | ||
+ | in_voltage_scale: | ||
+ | in_voltage_scale_available: | ||
+ | name: | ||
+ | out_voltage0_raw: | ||
+ | out_voltage2_raw: | ||
+ | out_voltage3_raw: | ||
+ | out_voltage_scale: | ||
+ | out_voltage_scale_available: | ||
+ | uevent: | ||
+ | uevent: | ||
+ | uevent: | ||
+ | uevent: | ||
+ | uevent: | ||
+ | uevent: | ||
+ | uevent: | ||
+ | </ | ||
+ | |||
+ | == Example obtaining the temperature in °C == | ||
+ | |||
+ | |||
+ | |||
+ | T = ( in_temp_raw + in_temp_offset ) * in_temp_scale | ||
+ | |||
+ | T = ( 810 - 753 ) * 376.78975 = 21477 mdeg C = 21.5 °C | ||
+ | |||
+ | For more information see also here: [[git.linux.org> | ||
+ | |||
+ | === GPIO Testing | ||
+ | |||
+ | The GPIO sysfs interface allows users to manipulate any GPIO from userspace. Userspace utilizes a sysfs control interface to dynamically request and release individual GPIOs. Once a GPIO has been requested, writing to the newly created path allows you to control the direction and the data while reading from it returns the GPIO data (which usually corresponds to a 0 or 1 which represents the signal level). | ||
+ | |||
+ | For more information see also here: [[git.linux.org> | ||
+ | |||
+ | < | ||
+ | root@linaro-ubuntu-desktop: | ||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | export | ||
+ | |||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | |||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | total 0 | ||
+ | drwxr-xr-x 3 root root 0 Jan 1 1970 . | ||
+ | drwxr-xr-x 3 root root 0 Jan 1 1970 .. | ||
+ | -r--r--r-- 1 root root 4096 Feb 23 08:06 base | ||
+ | lrwxrwxrwx 1 root root 0 Feb 23 08:06 device -> ../ | ||
+ | -r--r--r-- 1 root root 4096 Feb 23 08:06 label | ||
+ | -r--r--r-- 1 root root 4096 Feb 23 08:06 ngpio | ||
+ | drwxr-xr-x 2 root root 0 Feb 23 08:06 power | ||
+ | lrwxrwxrwx 1 root root 0 Jan 1 1970 subsystem -> ../ | ||
+ | -rw-r--r-- 1 root root 4096 Jan 1 1970 uevent | ||
+ | |||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | base:890 | ||
+ | label: | ||
+ | ngpio:8 | ||
+ | |||
+ | |||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | total 0 | ||
+ | drwxr-xr-x 3 root root 0 Feb 23 08:06 . | ||
+ | drwxr-xr-x 4 root root 0 Feb 23 08:06 .. | ||
+ | -rw-r--r-- 1 root root 4096 Feb 23 08:06 active_low | ||
+ | lrwxrwxrwx 1 root root 0 Feb 23 08:06 device -> ../ | ||
+ | -rw-r--r-- 1 root root 4096 Feb 23 08:06 direction | ||
+ | drwxr-xr-x 2 root root 0 Feb 23 08:06 power | ||
+ | lrwxrwxrwx 1 root root 0 Feb 23 08:06 subsystem -> ../ | ||
+ | -rw-r--r-- 1 root root 4096 Feb 23 08:06 uevent | ||
+ | -rw-r--r-- 1 root root 4096 Feb 23 08:06 value | ||
+ | |||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | in | ||
+ | |||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | 0 | ||
+ | |||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | |||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | out | ||
+ | |||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | 0 | ||
+ | |||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | |||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | 1 | ||
</ | </ |