AD5933 IIO阻抗轉(zhuǎn)換器和網(wǎng)絡(luò)分析儀Linux驅(qū)動程序
資料介紹
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旋轉(zhuǎn)變壓器-數(shù)字轉(zhuǎn)換器Linux驅(qū)動程序
- AD2S1200 IIO旋轉(zhuǎn)變壓器-數(shù)字轉(zhuǎn)換器Linux驅(qū)動程序
- ADIS16080 IIO偏航率陀螺儀Linux驅(qū)動程序
- IIO單通道串行ADC Linux驅(qū)動程序
- AD2S1210 IIO旋轉(zhuǎn)變壓器-數(shù)字轉(zhuǎn)換器Linux驅(qū)動程序
- UG-364:評估AD5933 1 MSPS,12位阻抗轉(zhuǎn)換器網(wǎng)絡(luò)分析儀
- AD9834 IIO直接數(shù)字合成Linux驅(qū)動程序
- AD5934:250 kSPS,12位阻抗轉(zhuǎn)換器,網(wǎng)絡(luò)分析儀數(shù)據(jù)表
- AD9832 IIO直接數(shù)字合成Linux驅(qū)動程序
- AD7998 IIO ADC Linux驅(qū)動程序
- ADIS16130 IIO高精度角速率陀螺儀Linux驅(qū)動程序
- AD5933: 1 MSPS, 12位陰抗轉(zhuǎn)換器和網(wǎng)絡(luò)分析儀
- 網(wǎng)絡(luò)分析儀基礎(chǔ) 97次下載
- 用AD5933測量接地阻抗特性 72次下載
- AD5933中文資料,12 bit阻抗轉(zhuǎn)換器和網(wǎng)絡(luò)分析器
- 基于矢量網(wǎng)絡(luò)分析儀的時域測量技術(shù) 854次閱讀
- 如何使用雙端口網(wǎng)絡(luò)分析儀測量差分阻抗 1221次閱讀
- 矢量網(wǎng)絡(luò)分析儀的技術(shù)指標 500次閱讀
- 矢量網(wǎng)絡(luò)分析儀的用途有哪些 1045次閱讀
- 矢量網(wǎng)絡(luò)分析儀和頻譜分析儀的區(qū)別 1032次閱讀
- 矢量網(wǎng)絡(luò)分析儀使用步驟 617次閱讀
- 網(wǎng)絡(luò)分析儀的分類 318次閱讀
- 網(wǎng)絡(luò)分析儀的工作原理 464次閱讀
- 網(wǎng)絡(luò)分析儀的作用和應(yīng)用 594次閱讀
- 什么是網(wǎng)絡(luò)分析儀 428次閱讀
- 如何驗證網(wǎng)絡(luò)分析儀否正常?網(wǎng)絡(luò)分析儀有什么常見故障呢? 676次閱讀
- 矢量網(wǎng)絡(luò)分析儀使用教程 1.5w次閱讀
- 如何判斷網(wǎng)絡(luò)分析儀的阻抗測量范圍呢? 1.8w次閱讀
- 網(wǎng)絡(luò)分析儀有什么具體作用 3.7w次閱讀
- 轉(zhuǎn)換器輸入阻抗計算方法及測量技巧 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開關(guān)電源原理及各功能電路詳解
- 0.38 MB | 11次下載 | 免費
- 6100W短波放大電路圖
- 0.05 MB | 4次下載 | 3 積分
- 7基于單片機和 SG3525的程控開關(guān)電源設(shè)計
- 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 專業(yè)版下載 (3CD完整版)
- 0.00 MB | 51043次下載 | 免費
- 5555集成電路應(yīng)用800例(新編版)
- 0.00 MB | 33562次下載 | 免費
- 6接口電路圖大全
- 未知 | 30320次下載 | 免費
- 7Multisim 10下載Multisim 10 中文版
- 0.00 MB | 28588次下載 | 免費
- 8開關(guān)電源設(shè)計實例指南
- 未知 | 21539次下載 | 免費
總榜
- 1matlab軟件下載入口
- 未知 | 935053次下載 | 免費
- 2protel99se軟件下載(可英文版轉(zhuǎn)中文版)
- 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十天學(xué)會AVR單片機與C語言視頻教程 下載
- 158M | 183277次下載 | 免費
- 8proe5.0野火版下載(中文版免費下載)
- 未知 | 138039次下載 | 免費
評論
查看更多