Wiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
resources:tools-software:linux-drivers:iio-dac:ad5758 [23 May 2018 11:07]
Stefan Popa Devicetree example
resources:tools-software:linux-drivers:iio-dac:ad5758 [15 Oct 2018 16:25] (current)
Stefan Popa adc->dac
Line 21: Line 21:
  
 ^ Source ^ Mainlined? ^ ^ Source ^ Mainlined? ^
-| [[https://​github.com/​analogdevicesinc/​linux/blob/rpi-4.9.y/drivers/​iio/​dac/​ad5758.c|git]] | [In progress...] |+| [[git.linux.org>drivers/​iio/​dac/​ad5758.c|git]] | [[git.linux.org>​drivers/​iio/​dac/​ad5758.c|Yes] |
  
 ===== Files ===== ===== Files =====
  
 ^ Function ^ File ^ ^ Function ^ File ^
-| driver ​ | [[https://​github.com/​analogdevicesinc/​linux/blob/rpi-4.9.y/drivers/​iio/​dac/​ad5758.c]] |+| driver ​ | [[git.linux.org>drivers/​iio/​dac/​ad5758.c]] |
  
 ===== Devicetree ===== ===== Devicetree =====
Line 62: Line 62:
                 adi,range = <1>;                 adi,range = <1>;
 </​code>​ </​code>​
 +
 +====== Driver testing ======
 +
 +<WRAP box bggreen><​wrap info>​This specifies any shell prompt running on the target</​wrap>​
 +<​xterm>​
 +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 May 23 09:14 dev
 +-rw-r--r-- 1 root root 4096 May 23 09:14 out_voltage0_powerdown
 +-rw-r--r-- 1 root root 4096 May 23 09:14 out_voltage0_raw
 +-rw-r--r-- 1 root root 4096 May 23 09:14 out_voltage_scale
 +-r--r--r-- 1 root root 4096 May 23 09:14 name
 +drwxr-xr-x 2 root root    0 May 23 09:14 power
 +lrwxrwxrwx 1 root root    0 May 23 09:14 subsystem -> ../​../​../​../​../​../​../​../​bus/​iio
 +-rw-r--r-- 1 root root 4096 May 23 09:14 uevent
 +</​xterm></​WRAP>​
 +
 +=== Show device name ===
 +
 +<WRAP box bggreen><​wrap info>​This specifies any shell prompt running on the target</​wrap>​
 +<​xterm>​
 +root:/​sys/​bus/​iio/​devices/​iio:​device0>​ **cat name**
 +ad5758
 +</​xterm></​WRAP>​
 +
 +=== Show scale ===
 +
 +**Description:​**\\
 +scale to be applied to in_voltage0_raw in order to obtain the measured voltage in millivolts.
 +
 +<WRAP box bggreen><​wrap info>​This specifies any shell prompt running on the target</​wrap>​
 +<​xterm>​
 +root:/​sys/​bus/​iio/​devices/​iio:​device0>​ **cat out_voltage_scale **
 +0.152587890
 +</​xterm></​WRAP>​
 +
 +=== Set channel 0 output voltage ===
 +
 +**Description:​**\\
 +/​sys/​bus/​iio/​devices/​deviceX/​out_voltage0_raw\\
 +
 +Raw (unscaled, no bias etc.) output voltage for
 +channel 0.
 +
 +
 +<WRAP box bggreen><​wrap info>​This specifies any shell prompt running on the target</​wrap>​
 +<​xterm>​
 +root:/​sys/​bus/​iio/​devices/​iio:​device0>​ **echo 32767 > out_voltage0_raw**
 +</​xterm></​WRAP>​
 +
 +**U** = //​out_voltage0_raw * out_voltage_scale//​ = 32767 * 0.152587890 = **4999.84 //mV//**
 +
 +=== Enable power down mode on output 0 ===
 +
 +/​sys/​bus/​iio/​devices/​deviceX/​out_voltage0_powerdown
 +
 +**Description:​**\\
 +Writing 1 causes output 0 to enter the power down mode. Clearing returns to
 +normal operation.
 +
 +<WRAP box bggreen><​wrap info>​This specifies any shell prompt running on the target</​wrap>​
 +<​xterm>​
 +root:/​sys/​bus/​iio/​devices/​iio:​device0>​ **echo 1 > out_voltage0_powerdown**
 +root:/​sys/​bus/​iio/​devices/​iio:​device0> ​ **cat out_voltage0_powerdown**
 +1
 +root:/​sys/​bus/​iio/​devices/​iio:​device0>​ **echo 0 > out_voltage0_powerdown**
 +root:/​sys/​bus/​iio/​devices/​iio:​device0> ​ **cat out_voltage0_powerdown**
 +0
 +</​xterm></​WRAP>​
 +
 +====== More Information ======
 +
 +{{page>​software:​linux:​docs:​iio:​iio_snippets#​iio pointers&​noheader&​firstseconly&​noeditbtn}}
 +
resources/tools-software/linux-drivers/iio-dac/ad5758.1527066472.txt.gz · Last modified: 23 May 2018 11:07 by Stefan Popa