资料介绍
Table of Contents
AD5933 IIO Impedance Converter and Network Analyzer Linux Driver
Supported Devices
Evaluation Boards
Reference Circuits
Description
This is a Linux industrial I/O (IIO) subsystem driver, targeting Impedance Converters and Network Analyzers. 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.
Source Code
Status
Files
Function | File |
---|---|
driver | drivers/staging/iio/impedance-analyzer/ad5933.c |
Example platform device initialization
For compile time configuration, it’s common Linux practice to keep board- and application-specific configuration out of the main driver file, instead putting it into the board support file.
For devices on custom boards, as typical of embedded and SoC-(system-on-chip) based hardware, Linux uses platform_data to point to board-specific structures describing devices and how they are connected to the SoC. This can include available ports, chip variants, preferred modes, default initialization, additional pin roles, and so on. This shrinks the board-support packages (BSPs) and minimizes board and application specific #ifdefs in drivers.
The reference voltage or external reference clock may vary between boards and models. The platform_data for the device's “struct device” holds this information.
File: drivers/staging/iio/impedance-analyzer/ad5933.h:ad5933_platform_data
/** * struct ad5933_platform_data - platform specific data * @ext_clk_Hz: the external clock frequency in Hz, if not set * the driver uses the internal clock (16.776 MHz) * @vref_mv: the external reference voltage in millivolt */ struct ad5933_platform_data { unsigned long ext_clk_Hz; unsigned short vref_mv; };
static struct ad5933_platform_data ad5933_pdata = { .vref_mv = 3300, };
In case platform_data is not present or set to NULL, the driver will use the AD5933 internal 16.776MHz reference clock.
Declaring I2C devices
Unlike PCI or USB devices, I2C devices are not enumerated at the hardware level. Instead, the software must know which devices are connected on each I2C bus segment, and what address these devices are using. For this reason, the kernel code must instantiate I2C devices explicitly. There are different ways to achieve this, depending on the context and requirements. However the most common method is to declare the I2C devices by bus number.
This method is appropriate when the I2C bus is a system bus, as in many embedded systems, wherein each I2C bus has a number which is known in advance. It is thus possible to pre-declare the I2C devices that inhabit this bus. This is done with an array of struct i2c_board_info, which is registered by calling i2c_register_board_info().
So, to enable such a driver one need only edit the board support file by adding an appropriate entry to i2c_board_info.
For more information see: Documentation/i2c/instantiating-devices
Depending on the converter IC used, you may need to set the I2C_BOARD_INFO name accordingly, matching your part name.
ADI part number | I2C_BOARD_INFO Name |
---|---|
AD5933 | ad5933 |
AD5934 | ad5934 |
static struct i2c_board_info __initdata board_i2c_board_info[] = { #if defined(CONFIG_AD5933) || defi ned(CONFIG_AD5933_MODULE) { I2C_BOARD_INFO("ad5933", 0x0D), .platform_data = (void *)&ad5933_pdata, /* optional */ }, #endif };
static int __init board_init(void) { [--snip--] i2c_register_board_info(0, board_i2c_board_info, ARRAY_SIZE(board_i2c_board_info)); [--snip--] return 0; } arch_initcall(board_init);
Adding Linux driver support
Configure kernel with “make menuconfig” (alternatively use “make xconfig” or “make qconfig”)
The driver depends on CONFIG_I2C
Linux Kernel Configuration Device Drivers ---> [*] Staging drivers ---> <*> Industrial I/O support ---> --- Industrial I/O support -*- Enable ring buffer support within IIO -*- Industrial I/O lock free software ring -*- Enable triggered sampling support [--snip--] *** Network Analyzer, Impedance Converters *** <*> Analog Devices AD5933, AD5934 driver [--snip--]
Hardware configuration
Driver testing
Each and every IIO device, typically a hardware chip, has a device folder under /sys/bus/iio/devices/iio:deviceX. Where X is the IIO index of the device. Under every of these directory folders reside a set of files, depending on the characteristics and features of the hardware device in question. These files are consistently generalized and documented in the IIO ABI documentation. In order to determine which IIO deviceX corresponds to which hardware device, the user can read the name file /sys/bus/iio/devices/iio:deviceX/name. In case the sequence in which the iio device drivers are loaded/registered is constant, the numbering is constant and may be known in advance.
This specifies any shell prompt running on the target
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:deviceX> ls -l drwxr-xr-x 4 root root 0 Jan 1 21:48 buffer -rw-r--r-- 1 root root 4096 Jan 1 21:48 in_voltage0_scale -r--r--r-- 1 root root 4096 Jan 1 21:48 in_voltage0_scale_available -r--r--r-- 1 root root 4096 Jan 1 21:48 name -rw-r--r-- 1 root root 4096 Jan 1 21:48 out_voltage0_freq_increment -rw-r--r-- 1 root root 4096 Jan 1 21:48 out_voltage0_freq_points -rw-r--r-- 1 root root 4096 Jan 1 21:48 out_voltage0_freq_start -rw-r--r-- 1 root root 4096 Jan 1 21:48 out_voltage0_scale -r--r--r-- 1 root root 4096 Jan 1 21:48 out_voltage0_scale_available -rw-r--r-- 1 root root 4096 Jan 1 21:48 out_voltage0_settling_cycles drwxr-xr-x 2 root root 0 Jan 1 21:48 power lrwxrwxrwx 1 root root 0 Jan 1 21:48 subsystem -> ../../../o -r--r--r-- 1 root root 4096 Jan 1 21:48 in_temp0_raw -rw-r--r-- 1 root root 4096 Jan 1 21:48 uevent
Show device name
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:deviceX> cat name ad5933
Set sweep start frequency
Description: /sys/bus/iio/devices/iio:deviceX/out_voltageY_freq_start
Frequency sweep start frequency in Hz.
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:deviceX> echo 15000 > out_voltage0_freq_start root:/sys/bus/iio/devices/iio:deviceX> cat out_voltage0_freq_start 14999
Set frequency increment
Description: /sys/bus/iio/devices/iio:deviceX/out_voltageY_freq_increment
Frequency increment in Hz (step size) between consecutive frequency points along the sweep.
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:deviceX> echo 200 > out_voltageY_freq_increment
Set number of frequency points
Description: /sys/bus/iio/devices/iio:deviceX/out_voltage0_freq_points
Number of frequency points (steps) in the frequency sweep.
This value, in conjunction with the out_voltageY_freq_start and the
out_voltageY_freq_increment, determines the frequency sweep range
for the sweep operation.
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:deviceX> echo 100 > out_voltage0_freq_points root:/sys/bus/iio/devices/iio:deviceX> cat out_voltage0_freq_points 100
Set number of settling time cycles
Description: /sys/bus/iio/devices/iio:deviceX/out_voltage0_settling_cycles
Number of output excitation cycles (settling time cycles)
that are allowed to pass through the unknown impedance,
after each frequency increment, and before the ADC is triggered
to perform a conversion sequence of the response signal.
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:deviceX> echo 15 > out_voltage0_settling_cycles root:/sys/bus/iio/devices/iio:deviceX> cat out_voltage0_settling_cycles 15
Show available output ranges
Description: /sys/bus/iio/devices/iio:deviceX/out_voltage0_scale_available
List available output scales/ranges in millivolt.
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:deviceX> cat out_voltage0_scale_available 1980 970 383 198
Set output range
Description: /sys/bus/iio/devices/iio:deviceX/out_voltage0_scale
Sets output scale/range in millivolt.
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:deviceX> echo 1980 > out_voltage0_scale root:/sys/bus/iio/devices/iio:deviceX> cat out_voltage0_scale 1980
Show available input scales
Description: /sys/bus/iio/devices/iio:deviceX/in_voltage0_scale_available
List available input scales. Programmable gain amplifier (PGA) options.
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:deviceX> cat in_voltage0_scale_available 1 0.2
Set input scale
Description: /sys/bus/iio/devices/iio:deviceX/in_voltage0_scale
Sets input scale. Controls programmable gain amplifier (PGA).
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:deviceX> echo 0.2 > in_voltage0_scale root:/sys/bus/iio/devices/iio:deviceX> cat in_voltage0_scale 0.2Show internal temperature
Description: /sys/bus/iio/devices/iio:deviceX/in_temp0_input
Shows temperature in milli degrees Celsius.
The on-chip temperature sensor allows an accurate measurement of the ambient device temperature. The measurement range of the sensor is −40°C to +125°C.
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:deviceX> cat in_temp0_input 27987
Buffer management
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:deviceX/buffer> ls enable length root:/sys/bus/iio/devices/iio:deviceX/buffer>
The Industrial I/O subsystem provides support for various ring buffer based data acquisition methods. Apart from device specific hardware buffer support, the user can chose between two different software ring buffer implementations. One is the IIO lock free software ring, and the other is based on Linux kfifo. Devices with buffer support feature an additional sub-folder in the /sys/bus/iio/devices/deviceX/ folder hierarchy. Called deviceX:bufferY, where Y defaults to 0, for devices with a single buffer.
Every buffer implementation features a set of files:
length
Get/set the number of sample sets that may be held by the buffer.
enable
Enables/disables the buffer. This file should be written last, after length and selection of scan elements.
watermark
A single positive integer specifying the maximum number of scan
elements to wait for.
Poll will block until the watermark is reached.
Blocking read will wait until the minimum between the requested
read amount or the low water mark is available.
Non-blocking read will retrieve the available samples from the
buffer even if there are less samples then watermark level. This
allows the application to block on poll with a timeout and read
the available samples after the timeout expires and thus have a
maximum delay guarantee.
data_available
A read-only value indicating the bytes of data available in the
buffer. In the case of an output buffer, this indicates the
amount of empty space available to write data to. In the case of
an input buffer, this indicates the amount of data available for
reading.
length_align_bytes
Using the high-speed interface. DMA buffers may have an alignment requirement for the buffer length.
Newer versions of the kernel will report the alignment requirements
associated with a device through the `length_align_bytes` property.
scan_elements
The scan_elements directory contains interfaces for elements that will be captured for a single triggered sample set in the buffer.
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:deviceX/scan_elements> ls in_voltage0_imag_en in_voltage0_imag_type in_voltage0_real_index in_voltage0_imag_index in_voltage0_real_en in0_voltage_real_type
in_voltageX_en / in_voltageX-voltageY_en / timestamp_en:
Scan element control for triggered data capture.
Writing 1 will enable the scan element, writing 0 will disable it
in_voltageX_type / in_voltageX-voltageY_type / timestamp_type:
Description of the scan element data storage within the buffer
and therefore in the form in which it is read from user-space.
Form is [s|u]bits/storage-bits. s or u specifies if signed
(2's complement) or unsigned. bits is the number of bits of
data and storage-bits is the space (after padding) that it
occupies in the buffer. Note that some devices will have
additional information in the unused bits so to get a clean
value, the bits value must be used to mask the buffer output
value appropriately. The storage-bits value also specifies the
data alignment. So u12/16 will be a unsigned 12 bit integer
stored in a 16 bit location aligned to a 16 bit boundary.
For other storage combinations this attribute will be extended
appropriately.
in_voltageX_index / in_voltageX-voltageY_index / timestamp_index:
A single positive integer specifying the position of this
scan element in the buffer. Note these are not dependent on
what is enabled and may not be contiguous. Thus for user-space
to establish the full layout these must be used in conjunction
with all _en attributes to establish which channels are present,
and the relevant _type attributes to establish the data storage
format.
This specifies any shell prompt running on the target
root:/sys/bus/iio/devices/iio:deviceX/scan_elements> grep “” * in_voltage0_imag_en: 1 in_voltage0_imag_index: 1 in_voltage0_imag_type: s16/16>>0 in_voltage0_real_en: 1 in_voltage0_real_index: 0 in_voltage0_real_type: s16/16>>0
Buffer Example
This specifies any shell prompt running on the target - Example command sequence
> cd /sys/bus/iio/devices/iio:device0 > echo 10000 > out_voltage0_freq_start > echo 100 > out_voltage0_freq_increment > echo 100 > out_voltage0_freq_points > echo 512 > buffer/length > echo 1 > buffer/enable
Data interpretation
index | datum | type |
---|---|---|
0 | Real Sample f0 | signed short 16-bit |
1 | Imag Sample f0 | signed short 16-bit |
[fn * 2] | Real Sample fn | signed short 16-bit |
[fn * 2] + 1 | Imag Sample fn | signed short 16-bit |
Z = in_voltage0_real + i * in_voltage0_imag
This specifies any shell prompt running on the target
root:> hexdump -d /dev/iio:device0* 0000000 09451 01627** 09541 01663 09622 01697 09708 01734 0000010 09799 01757 09889 01791 09985 01820 10079 01856 0000020 10172 01887 10264 01922 10357 01962 10451 02005 0000030 10543 02044 10628 02082 10714 02123 10798 02153 0000040 10889 02188 10983 02230 11069 02268 11157 02302 0000050 11246 02339 11335 02381 11429 02423 11514 02461 0000060 11603 02500 11688 02539 11782 02573 11871 02618 0000070 11955 02659 12045 02703 12135 02743 12221 02787 0000080 12307 02828 12393 02877 12481 02910 12567 02951 0000090 12659 02991 12750 03034 12840 03080 12927 03130 00000a0 13010 03173 13102 03220 13185 03268 13271 03313 00000b0 13356 03358 13443 03401 13525 03445 13612 03491 00000c0 13700 03536 13791 03584 13875 03630 13958 03684 00000d0 14047 03729 14135 03785 14216 03834 14302 03879 00000e0 14383 03930 14469 03982 14555 04028 14634 04084 00000f0 14722 04131 14805 04183 14890 04231 14972 04291 0000100 15052 04340 15136 04389 15216 04445 15301 04495 0000110 15377 04549 15455 04604 15526 04651 15595 04703 0000120 15661 04758 15731 04809 15782 04856 15836 04905 0000130 15885 04943 15939 04990 15993 05043 16035 05083 0000140 16077 05131 16118 05174 16165 05223 16198 05265 0000150 16241 05311 16275 05351 16300 05389 16336 05438 0000160 16373 05482 16405 05522 16441 05559 16470 05603 0000170 16498 05644 16534 05690 16554 05742 16577 05780 0000180 16601 05827 16621 05874 16640 05904 16668 05943 0000190 16686 05983 0000194
More Information
- IIO mailing list: linux [dash] iio [at] vger [dot] kernel [dot] org
- AD2S90 IIO旋转变压器-数字转换器Linux驱动程序
- AD2S1200 IIO旋转变压器-数字转换器Linux驱动程序
- ADIS16080 IIO偏航率陀螺仪Linux驱动程序
- IIO单通道串行ADC Linux驱动程序
- AD2S1210 IIO旋转变压器-数字转换器Linux驱动程序
- UG-364:评估AD5933 1 MSPS,12位阻抗转换器网络分析仪
- AD9834 IIO直接数字合成Linux驱动程序
- AD5934:250 kSPS,12位阻抗转换器,网络分析仪数据表
- AD9832 IIO直接数字合成Linux驱动程序
- AD7998 IIO ADC Linux驱动程序
- ADIS16130 IIO高精度角速率陀螺仪Linux驱动程序
- AD5933: 1 MSPS, 12位阴抗转换器和网络分析仪
- 网络分析仪基础 97次下载
- 用AD5933测量接地阻抗特性 72次下载
- AD5933中文资料,12 bit阻抗转换器和网络分析器
- 基于矢量网络分析仪的时域测量技术 854次阅读
- 如何使用双端口网络分析仪测量差分阻抗 1221次阅读
- 矢量网络分析仪的技术指标 500次阅读
- 矢量网络分析仪的用途有哪些 1045次阅读
- 矢量网络分析仪和频谱分析仪的区别 1032次阅读
- 矢量网络分析仪使用步骤 617次阅读
- 网络分析仪的分类 318次阅读
- 网络分析仪的工作原理 464次阅读
- 网络分析仪的作用和应用 594次阅读
- 什么是网络分析仪 428次阅读
- 如何验证网络分析仪否正常?网络分析仪有什么常见故障呢? 676次阅读
- 矢量网络分析仪使用教程 1.5w次阅读
- 如何判断网络分析仪的阻抗测量范围呢? 1.8w次阅读
- 网络分析仪有什么具体作用 3.7w次阅读
- 转换器输入阻抗计算方法及测量技巧 2958次阅读
下载排行
本周
- 1电子电路原理第七版PDF电子教材免费下载
- 0.00 MB | 1491次下载 | 免费
- 2单片机典型实例介绍
- 18.19 MB | 95次下载 | 1 积分
- 3S7-200PLC编程实例详细资料
- 1.17 MB | 27次下载 | 1 积分
- 4笔记本电脑主板的元件识别和讲解说明
- 4.28 MB | 18次下载 | 4 积分
- 5开关电源原理及各功能电路详解
- 0.38 MB | 11次下载 | 免费
- 6100W短波放大电路图
- 0.05 MB | 4次下载 | 3 积分
- 7基于单片机和 SG3525的程控开关电源设计
- 0.23 MB | 4次下载 | 免费
- 8基于AT89C2051/4051单片机编程器的实验
- 0.11 MB | 4次下载 | 免费
本月
- 1OrCAD10.5下载OrCAD10.5中文版软件
- 0.00 MB | 234313次下载 | 免费
- 2PADS 9.0 2009最新版 -下载
- 0.00 MB | 66304次下载 | 免费
- 3protel99下载protel99软件下载(中文版)
- 0.00 MB | 51209次下载 | 免费
- 4LabView 8.0 专业版下载 (3CD完整版)
- 0.00 MB | 51043次下载 | 免费
- 5555集成电路应用800例(新编版)
- 0.00 MB | 33562次下载 | 免费
- 6接口电路图大全
- 未知 | 30320次下载 | 免费
- 7Multisim 10下载Multisim 10 中文版
- 0.00 MB | 28588次下载 | 免费
- 8开关电源设计实例指南
- 未知 | 21539次下载 | 免费
总榜
- 1matlab软件下载入口
- 未知 | 935053次下载 | 免费
- 2protel99se软件下载(可英文版转中文版)
- 78.1 MB | 537793次下载 | 免费
- 3MATLAB 7.1 下载 (含软件介绍)
- 未知 | 420026次下载 | 免费
- 4OrCAD10.5下载OrCAD10.5中文版软件
- 0.00 MB | 234313次下载 | 免费
- 5Altium DXP2002下载入口
- 未知 | 233046次下载 | 免费
- 6电路仿真软件multisim 10.0免费下载
- 340992 | 191183次下载 | 免费
- 7十天学会AVR单片机与C语言视频教程 下载
- 158M | 183277次下载 | 免费
- 8proe5.0野火版下载(中文版免费下载)
- 未知 | 138039次下载 | 免费
评论
查看更多