This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
resources:tools-software:linux-drivers:iio-dac:ad5593r [07 Jun 2016 16:36] – [Status] Michael Hennerich | resources:tools-software:linux-drivers:iio-dac:ad5593r [19 Jan 2018 10:12] (current) – rename xcomm_zynq -> master Alexandru Ardelean | ||
---|---|---|---|
Line 18: | Line 18: | ||
The AD5593R have eight I/Ox pins (I/O0 to I/O7) that can be independently configured as digital-to-analog converter (DAC) outputs, analog-to-digital converter (ADC) inputs, digital outputs, or digital inputs. | The AD5593R have eight I/Ox pins (I/O0 to I/O7) that can be independently configured as digital-to-analog converter (DAC) outputs, analog-to-digital converter (ADC) inputs, digital outputs, or digital inputs. | ||
- | |||
When an I/Ox pin is configured as an analog output, it is driven by a 12-bit DAC. The output range of the DAC is 0 V to VREF or 0 V to 2 × VREF. | When an I/Ox pin is configured as an analog output, it is driven by a 12-bit DAC. The output range of the DAC is 0 V to VREF or 0 V to 2 × VREF. | ||
- | |||
When an I/Ox pin is configured as an analog input, it is connected to a 12-bit ADC via an analog multiplexer. The input range of the ADC is 0 V to VREF or 0 V to 2 × VREF. The ADC has a total throughput rate of 400 kSPS. | When an I/Ox pin is configured as an analog input, it is connected to a 12-bit ADC via an analog multiplexer. The input range of the ADC is 0 V to VREF or 0 V to 2 × VREF. The ADC has a total throughput rate of 400 kSPS. | ||
- | |||
The I/Ox pins can also be configured as digital, general-purpose input or output (GPIO) pins. The state of the GPIO pins can be set or read back by accessing the GPIO write data register or the GPIO read configuration register, respectively, | The I/Ox pins can also be configured as digital, general-purpose input or output (GPIO) pins. The state of the GPIO pins can be set or read back by accessing the GPIO write data register or the GPIO read configuration register, respectively, | ||
- | |||
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. | ||
Line 37: | Line 33: | ||
^ Function ^ File ^ | ^ Function ^ File ^ | ||
- | | driver | + | | driver |
- | | include | + | | include |
- | | driver | + | | driver |
- | | include | + | | include |
- | | Documentation | + | | Documentation |
====== Hardware configuration ====== | ====== Hardware configuration ====== | ||
Line 82: | Line 78: | ||
* " | * " | ||
* **reg**: I2C address of the chip (generally 0x10). | * **reg**: I2C address of the chip (generally 0x10). | ||
- | * **channel-modes**: An array of eight 8-bit values (one per channel) describing | + | * **#address-cells**: Should be 1. |
- | * CH_MODE_ADC (the pin is ADC input) | + | * **#size-cells**: Should be 0. |
- | * CH_MODE_DAC (the pin is DAC output) | + | * **channel nodes**: |
- | * CH_MODE_DAC_AND_ADC (the pin is DAC output but can be monitored by an ADC) | + | * Each child node represents |
- | * CH_MODE_UNUSED_PULL_DOWN | + | * **Required properties**: |
- | * CH_MODE_UNUSED_OUT_LOW (the pin is output low) | + | * **reg**: Pin on which this channel is connected to. |
- | * CH_MODE_UNUSED_OUT_HIGH (the pin is output high) | + | * **adi,mode**: Mode or function |
- | * CH_MODE_UNUSED_OUT_TRISTATE (the pin is tristated | + | * CH_MODE_UNUSED (the pin is unused) |
- | * CH_MODE_GPIO (the pin is registered with GPIOLIB) | + | * CH_MODE_ADC (the pin is ADC input) |
- | * CH_MODE_GPIO_OPEN_DRAIN (the pin is configured open drain and registered with GPIOLIB) | + | |
+ | | ||
+ | | ||
+ | * **Optional properties**: | ||
+ | * **adi, | ||
+ | * CH_OFFSTATE_PULLDOWN | ||
+ | * CH_OFFSTATE_OUT_LOW | ||
+ | * CH_OFFSTATE_OUT_HIGH | ||
+ | * CH_OFFSTATE_OUT_TRISTATE | ||
+ | |||
==== Optional properties ==== | ==== Optional properties ==== | ||
* **vref-supply**: | * **vref-supply**: | ||
- | * **reset-gpios**: | + | * **reset-gpios** : GPIO spec for the RESET pin. If specified, it will be asserted during driver probe. |
+ | * **gpio-controller**: | ||
+ | * **# | ||
+ | | ||
==== 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 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. The other I/Os are registered with the Linux GPIO subsystem. | 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. The other I/Os are registered with the Linux GPIO subsystem. | ||
Line 113: | Line 121: | ||
status = " | status = " | ||
clock-frequency = < | clock-frequency = < | ||
- | |||
ad5593r@10 { | ad5593r@10 { | ||
+ | # | ||
+ | # | ||
+ | # | ||
compatible = " | compatible = " | ||
reg = < | reg = < | ||
+ | gpio-controller; | ||
- | channel-modes | + | channel@0 { |
- | CH_MODE_DAC | + | reg |
- | CH_MODE_ADC | + | adi,mode = <CH_MODE_DAC>; |
- | CH_MODE_DAC_AND_ADC | + | adi, |
- | CH_MODE_DAC_AND_ADC | + | }; |
- | CH_MODE_UNUSED_PULL_DOWN | + | channel@1 { |
- | CH_MODE_GPIO | + | reg = < |
- | CH_MODE_GPIO | + | adi,mode = <CH_MODE_ADC>; |
- | CH_MODE_GPIO | + | adi, |
- | >; | + | }; |
+ | channel@2 { | ||
+ | reg = < | ||
+ | adi,mode = <CH_MODE_DAC_AND_ADC>; | ||
+ | adi, | ||
+ | }; | ||
+ | channel@6 { | ||
+ | reg = <6>; | ||
+ | adi,mode = <CH_MODE_GPIO>; | ||
+ | adi, | ||
+ | }; | ||
vref-supply = <& | vref-supply = <& | ||
reset-gpios = <& | reset-gpios = <& | ||
+ | |||
}; | }; | ||
+ | |||
}; | }; | ||
</ | </ | ||
- | ==== Driver testing ==== | + | ====== Driver testing ====== |
If the driver correctly detected the device, the " | If the driver correctly detected the device, the " | ||
Line 181: | Line 205: | ||
</ | </ | ||
- | === IIO sysfs interface === | + | ====== IIO sysfs interface |
< | < | ||
Line 236: | Line 260: | ||
</ | </ | ||
- | == Example obtaining the temperature in °C == | ||
+ | ===== Show device name ===== | ||
+ | |||
+ | <WRAP box bggreen>< | ||
+ | < | ||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | ad5593r | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Scales ===== | ||
+ | |||
+ | The output range of the DAC is 0 V to VREF or 0 V to 2 × VREF. | ||
+ | **out_voltage_scale** is used to select the high or low range. | ||
+ | Without external reference the driver selects the internal 2500mV VREF reference. | ||
+ | So the scale computes as 2500mV/2^12 = 0.610351562 or 5000mV/2^12 = 1.220703124. | ||
+ | |||
+ | The input range of the ADC is 0 V to VREF or 0 V to 2 × VREF. | ||
+ | **in_voltage_scale** is used to select the high or low range. | ||
+ | Without external reference the driver selects the internal 2500mV VREF reference. | ||
+ | So the scale computes as 2500mV/2^12 = 0.610351562 or 5000mV/2^12 = 1.220703124. | ||
+ | |||
+ | ==== Show current scale ==== | ||
+ | |||
+ | **Description: | ||
+ | scale to be applied to out_voltageY_raw/ | ||
+ | |||
+ | <WRAP box bggreen>< | ||
+ | < | ||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | 0.610351562 | ||
+ | </ | ||
+ | |||
+ | ==== Show available scales ==== | ||
+ | |||
+ | **Description: | ||
+ | scale to be applied to out_voltageY_raw/ | ||
+ | |||
+ | <WRAP box bggreen>< | ||
+ | < | ||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | 0.610351562 1.220703124 | ||
+ | </ | ||
+ | |||
+ | ==== Change scales ==== | ||
+ | |||
+ | **Description: | ||
+ | scale to be applied to out_voltageY_raw/ | ||
+ | |||
+ | <WRAP box bggreen>< | ||
+ | < | ||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | 1.220703124 | ||
+ | </ | ||
+ | |||
+ | ===== Get channel Y input voltage ===== | ||
+ | |||
+ | Description: | ||
+ | Raw unscaled voltage measurement on channel Y | ||
+ | |||
+ | This specifies any shell prompt running on the target | ||
+ | |||
+ | <WRAP box bggreen>< | ||
+ | < | ||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | 1491 | ||
+ | </ | ||
+ | |||
+ | U = in_voltage3_raw * in_voltage_scale = 1491 * 0.610351562 = 910 mV | ||
+ | |||
+ | |||
+ | ===== Set channel Y output voltage ===== | ||
+ | |||
+ | **Description: | ||
+ | Raw (unscaled, no bias etc.) output voltage for channel Y. | ||
+ | |||
+ | <WRAP box bggreen>< | ||
+ | < | ||
+ | root@linaro-ubuntu-desktop:/ | ||
+ | </ | ||
+ | |||
+ | **U** = // | ||
+ | |||
+ | ===== Example obtaining the temperature in °C ===== | ||
Line 246: | Line 353: | ||
For more information see also here: [[git.linux.org> | For more information see also here: [[git.linux.org> | ||
- | === GPIO Testing | + | ===== 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). | 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). |