Wiki

Differences

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

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
resources:tools-software:linux-drivers:iio-adc:ad400x [01 Nov 2018 15:55] – created Mircea Caprioruresources:tools-software:linux-drivers:iio-adc:ad400x [14 Nov 2018 11:25] – [AD4003/AD4007/AD4011/AD4020 Linux Driver] Mircea Caprioru
Line 1: Line 1:
-====== AD4003/AD4007/AD4011/AD4020 Linux Driver ======+====== AD4003/AD4007/AD4011/AD4020/ADAQ40XX Linux Driver ======
  
 +===== Supported Devices =====
 +
 +
 +  * [[adi>AD4003]]
 +  * [[adi>AD4007]]
 +  * [[adi>AD4011]]
 +  * [[adi>AD4020]]
 +  * [[adi>ADAQ4003]]
 +
 +===== Evaluation Boards =====
 +
 +  * [[adi>EVAL-AD400xFMCZ]]
 +
 +===== Description =====
 +
 +This is a Linux industrial I/O (IIO) subsystem driver, targeting single channel serial interface ADCs. 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.
 +
 +===== Status =====
 +
 +^ Source ^ Mainlined? ^
 +| [[linux.github>master/drivers/iio/adc/ad400x.c|git]] | [In progress...] |
 +
 +===== Files =====
 +
 +^ Function ^ File ^
 +| driver  | [[linux.github>master/drivers/iio/adc/ad400x.c]] |
 +| devicetree bindings | [[linux.github>master?Documentation/devicetree/bindings/iio/adc/adi,ad7124.txt | Documentation/devicetree/bindings/iio/adc/ad400x.txt]] |
 +
 +====== Driver setup ======
 +Since AD4003/4007/4011/4020 are high speed analog-to-digital converters with speeds up to 2 Msps additional components are required in order to achieve high performance. In this scenario the following hdl components are required:
 +  * [[resources:fpga:peripherals:spi_engine|SPI Engine]]
 +  * [[resources:fpga:docs:axi_dmac|High-Speed DMA Controller Peripheral]]
 +
 +The device will interface with these components and follow the device tree bindings. 
 +
 +<WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap>
 +<xterm>
 +&fpga_axi {                                                                      
 +         rx_dma: rx-dmac@44a30000 {                                               
 +                 compatible = "adi,axi-dmac-1.00.a";                              
 +                 reg = <0x44a30000 0x1000>;                                       
 +                 #dma-cells = <1>;                                                
 +                 interrupts = <0 57 0>;                                           
 +                 clocks = <&clkc 16>;                                             
 +                                                                                  
 +                 adi,channels {                                                   
 +                         #size-cells = <0>;                                       
 +                         #address-cells = <1>;                                    
 +                                                                                  
 +                         dma-channel@0 {                                          
 +                                 reg = <0>;                                       
 +                                 adi,source-bus-width = <32>;                     
 +                                 adi,source-bus-type = <1>;                       
 +                                 adi,destination-bus-width = <64>;                
 +                                 adi,destination-bus-type = <0>;                  
 +                         };                                                       
 +                 };                                                               
 +         };                                                                       
 +                                                                                  
 +         axi_spi_engine_0: axi-spi-engine@44a00000 {                              
 +                 compatible = "adi,axi-spi-engine-1.00.a";                        
 +                 reg = <0x44a00000 0x1000>;                                       
 +                 interrupt-parent = <&intc>;                                      
 +                 interrupts = <0 56 4>;                                           
 +                 clocks = <&clkc 15 &clkc 15>;                                    
 +                 clock-names = "s_axi_aclk", "spi_clk";                           
 +                 num-cs = <1>;                                                    
 +                                                                                 
 +                 #address-cells = <0x1>;                                          
 +                 #size-cells = <0x0>;                                             
 +                                                                                  
 +                 ad4020: adc@0 {                                                  
 +                         compatible = "ad4020";                                   
 +                         reg = <0>;                                               
 +                         spi-max-frequency = <71000000>;                          
 +                                                                                  
 +                         dmas = <&rx_dma 0>;                                      
 +                         dma-names = "rx";                                        
 +                                                                                  
 +                         vref-supply = <&vref>;                                   
 +                         #io-channel-cells = <1>;                                 
 +                 };                                                               
 +         };                                                                       
 + };    
 +</xterm></WRAP>
 +
 +====== Driver testing ======
 +
 +{{page>software:linux:docs:iio:iio_snippets#iio device files&noheader&firstseconly&noeditbtn}}
 +
 +<WRAP top tip round box 60%>**TIP:**
 +An example program which uses the interface can be found here:
 +  * [[resources:tools-software:linux-software:iio_oscilloscope|IIO Oscilloscope]]
 +</WRAP>\\
 +
 +<WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap>
 +<xterm>
 +root@analog:/sys/bus/iio/devices# ls -l
 +total 0
 +lrwxrwxrwx 1 root root 0 Jan  1  1970 iio:device0 -> ../../../devices/soc0/fpga-axi@0/44a00000.axi-spi-engine/spi_master/spi0/spi0.0/iio:device0
 +lrwxrwxrwx 1 root root 0 Jan  1  1970 iio:device1 -> ../../../devices/soc0/amba/f8007100.adc/iio:device1
 +lrwxrwxrwx 1 root root 0 Jan  1  1970 iio_sysfs_trigger -> ../../../devices/iio_sysfs_trigger
 +
 +root@analog:/sys/bus/iio/devices# 
 +root@analog:/sys/bus/iio/devices# cd iio\:device0
 +root@analog:/sys/bus/iio/devices/iio:device0# ls -l
 +total 0
 +drwxrwxrwx 2 root root    0 Jan  1  1970 buffer
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 dev
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 in_voltage0_raw
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 in_voltage0_scale
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 name
 +lrwxrwxrwx 1 root root    0 Nov  2 08:43 of_node -> ../../../../../../../../firmware/devicetree/base/fpga-axi@0/axi-spi-engine@44a00000/adc@0
 +drwxrwxrwx 2 root root    0 Jan  1  1970 power
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 sampling_frequency
 +drwxrwxrwx 2 root root    0 Jan  1  1970 scan_elements
 +lrwxrwxrwx 1 root root    0 Nov  2 08:43 subsystem -> ../../../../../../../../bus/iio
 +-rw-rw-rw- 1 root root 4096 Jan  1  1970 uevent
 +
 +</xterm></WRAP>
 +
 +=== Show device name ===
 +
 +<WRAP box bggreen><wrap info>This specifies any shell prompt running on the target</wrap>
 +<xterm>
 +root@analog:/sys/bus/iio/devices/iio:device0# cat name
 +ad4020
 +</xterm></WRAP>
 +
 +=== Show channel scale ===
 +
 +**Description:**\\
 +Scale to be applied to in_voltagex_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@analog:/sys/bus/iio/devices/iio:device0# cat in_voltage0_scale 
 +0.002384185
 +</xterm></WRAP>
 +
 +====== More Information ======
 +
 +{{page>software:linux:docs:iio:iio_snippets#iio pointers&noheader&firstseconly&noeditbtn}}
resources/tools-software/linux-drivers/iio-adc/ad400x.txt · Last modified: 01 Feb 2024 21:48 by Marcelo Schmitt