Wiki

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
resources:tools-software:linux-drivers:iio-adc:ad7124 [15 Oct 2018 17:00] – Driver testing Stefan Poparesources:tools-software:linux-drivers:iio-adc:ad7124 [01 Feb 2019 11:02] (current) – Update driver links with upstream version Stefan Popa
Line 21: Line 21:
  
 ^ Source ^ Mainlined? ^ ^ Source ^ Mainlined? ^
-| [[linux.github>master/drivers/iio/adc/ad7124.c|git]] | [In progress...] |+| [[git.linux.org>drivers/iio/adc/ad7124.c|git]] | [[git.linux.org>drivers/iio/adc/ad7124.c|Yes] |
  
 ===== Files ===== ===== Files =====
  
 ^ Function ^ File ^ ^ Function ^ File ^
-| driver  | [[linux.github>master/drivers/iio/adc/ad7124.c]] | +| driver  | [[git.linux.org>drivers/iio/adc/ad7124.c]] | 
-| devicetree bindings | [[linux.github>master?Documentation/devicetree/bindings/iio/adc/adi,ad7124.txt | Documentation/devicetree/bindings/iio/adc/adi,ad7124.txt]] |+| devicetree bindings | [[git.linux.org>Documentation/devicetree/bindings/iio/adc/adi,ad7124.txt | Documentation/devicetree/bindings/iio/adc/adi,ad7124.txt]] |
  
 ====== Driver testing ====== ====== Driver testing ======
Line 44: Line 44:
 iio:device0 iio:device0
  
 +root:/sys/bus/iio/devices> **cd iio\:device0**
  
 +root:/sys/bus/iio/devices/iio:device0> **ls -l**
 +drwxr-xr-x 2 root root    0 Jun 23 21:46 buffer
 +-r--r--r-- 1 root root 4096 Jun 23 21:46 dev
 +-rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage0-voltage1_offset
 +-rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage0-voltage1_raw
 +-rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage0-voltage1_sampling_frequency
 +-rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage0-voltage1_scale
 +-rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage2-voltage3_offset
 +-rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage2-voltage3_raw
 +-rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage2-voltage3_sampling_frequency
 +-rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage2-voltage3_scale
 +-rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage4-voltage5_offset
 +-rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage4-voltage5_raw
 +-rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage4-voltage5_sampling_frequency
 +-rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage4-voltage5_scale
 +-rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage6-voltage7_offset
 +-rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage6-voltage7_raw
 +-rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage6-voltage7_sampling_frequency
 +-rw-r--r-- 1 root root 4096 Jun 23 21:46 in_voltage6-voltage7_scale
 +-r--r--r-- 1 root root 4096 Jun 23 21:46 name
 +lrwxrwxrwx 1 root root    0 Jun 23 21:46 of_node -> ../../../../../../../../firmware/devicetree/base/soc/spi@7e204000/ad7124-4@0
 +drwxr-xr-x 2 root root    0 Jun 23 21:46 power
 +drwxr-xr-x 2 root root    0 Jun 23 21:46 scan_elements
 +lrwxrwxrwx 1 root root    0 Jun 23 21:46 subsystem -> ../../../../../../../../bus/iio
 +drwxr-xr-x 2 root root    0 Jun 23 21:46 trigger
 +-rw-r--r-- 1 root root 4096 Jun 23 21:46 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**
 +ad7124-4
 +</xterm></WRAP>
 +
 +=== Show channel scale and offset ===
 +
 +**Description:**\\
 +Scales and offsets to be applied to in_voltagex_voltagey_raw in order to obdatin 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 in_voltage0-voltage1_scale **
 +0.000149011
 +root:/sys/bus/iio/devices/iio:device0> **cat in_voltage0-voltage1_offset **
 +0
 +root:/sys/bus/iio/devices/iio:device0> **cat in_voltage0-voltage1_raw **
 +2679470
 +</xterm></WRAP>
 +
 +**Description:**
 +Channel Ainp0-Ainm1 is configured as unipolar, with a gain of 1\\
 +**U** = //in_voltage0-voltage1_raw * in_voltage0-voltage1_scale - in_voltage0-voltage1_offset // = 2679470 * 0.000149011 - 0 = **399.27 //mV//**
 +
 +<WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap>
 +<xterm>
 +root:/sys/bus/iio/devices/iio:device0> **cat in_voltage2-voltage3_scale **
 +0.000298023
 +root:/sys/bus/iio/devices/iio:device0> **cat in_voltage2-voltage3_offset **
 +-2500
 +root:/sys/bus/iio/devices/iio:device0> **cat in_voltage2-voltage3_raw **
 +9716211
 +</xterm></WRAP>
 +
 +**Description:**
 +Channel Ainp2-Ainm3 is configured as bipolar, with a gain of 1\\
 +**U** = //in_voltage2-voltage3_raw * in_voltage2-voltage3_scale - in_voltage2-voltage3_offset // = 9716211* 0.000298023 - 2500= **395.65 //mV//**
 +
 +=== Set sampling frequency ===
 +
 +**Description:**
 +The output data rate depends on the master clock frequency (fclk) which in turn determines the power mode:\\
 +  * Full power (fCLK = 614.4 kHz): 9.38 SPS to 19,200 SPS
 +  * Mid power (fCLK = 153.6 kHz): 2.34 SPS to 4800 SPS
 +  * Low power (fCLK = 76.8 kHz): 1.17 SPS to 2400 SPS
 +
 +<WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap>
 +<xterm>
 +root:/sys/bus/iio/devices/iio:device0> **cat in_voltage0-voltage1_sampling_frequency**
 +10
 +root:/sys/bus/iio/devices/iio:device0> **cat in_voltage2-voltage3_sampling_frequency**
 +960
 +root:/sys/bus/iio/devices/iio:device0> **echo 2400 > in_voltage0-voltage1_sampling_frequency**
 +root:/sys/bus/iio/devices/iio:device0> **cat in_voltage0-voltage1_sampling_frequency**
 +2400
 +root:/sys/bus/iio/devices/iio:device0> **echo 5000 > in_voltage2-voltage3_sampling_frequency**
 +root:/sys/bus/iio/devices/iio:device0> **cat in_voltage2-voltage3_sampling_frequency**
 +4800
 +</xterm></WRAP>
 +
 +====== More Information ======
 +
 +{{page>software:linux:docs:iio:iio_snippets#iio pointers&noheader&firstseconly&noeditbtn}}
resources/tools-software/linux-drivers/iio-adc/ad7124.1539615641.txt.gz · Last modified: 15 Oct 2018 17:00 by Stefan Popa