資料介紹
Table of Contents
AD9523 Low Jitter Clock Generator Linux Driver
Supported Devices
Evaluation Boards
Description
This is a Linux industrial I/O (IIO) subsystem driver, targeting serial interface PLL Synthesizers. 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/iio/frequency/ad9523.c |
include | include/linux/iio/frequency/ad9523.h |
Documentation | Documentation/ABI/testing/sysfs-bus-iio-frequency-ad9523 |
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 frequency and GPIO numbers may vary between boards. The platform_data for the device's “struct device” holds this information.
/** * struct ad9523_channel_spec - Output channel configuration * * @channel_num: Output channel number. * @divider_output_invert_en: Invert the polarity of the output clock. * @sync_ignore_en: Ignore chip-level SYNC signal. * @low_power_mode_en: Reduce power used in the differential output modes. * @use_alt_clock_src: Channel divider uses alternative clk source. * @output_dis: Disables, powers down the entire channel. * @driver_mode: Output driver mode (logic level family). * @divider_phase: Divider initial phase after a SYNC. Range 0..63 LSB = 1/2 of a period of the divider input clock. * @channel_divider: 10-bit channel divider. * @extended_name: Optional descriptive channel name. */ ? struct ad9523_channel_spec { unsigned channel_num; bool divider_output_invert_en; bool sync_ignore_en; bool low_power_mode_en; /* CH0..CH3 VCXO, CH4..CH9 VCO2 */ bool use_alt_clock_src; bool output_dis; enum outp_drv_mode driver_mode; unsigned char divider_phase; unsigned short channel_divider; char extended_name[16]; }; ? /** * struct ad9523_platform_data - platform specific information * * @vcxo_freq: External VCXO frequency in Hz * @refa_diff_rcv_en: REFA differential/single-ended input selection. * @refb_diff_rcv_en: REFB differential/single-ended input selection. * @zd_in_diff_en: Zero Delay differential/single-ended input selection. * @osc_in_diff_en: OSC differential/ single-ended input selection. * @refa_cmos_neg_inp_en: REFA single-ended neg./pos. input enable. * @refb_cmos_neg_inp_en: REFB single-ended neg./pos. input enable. * @zd_in_cmos_neg_inp_en: Zero Delay single-ended neg./pos. input enable. * @osc_in_cmos_neg_inp_en: OSC single-ended neg./pos. input enable. * @refa_r_div: PLL1 10-bit REFA R divider. * @refb_r_div: PLL1 10-bit REFB R divider. * @pll1_feedback_div: PLL1 10-bit Feedback N divider. * @pll1_charge_pump_current_nA: Magnitude of PLL1 charge pump current (nA). * @zero_delay_mode_internal_en: Internal, external Zero Delay mode selection. * @osc_in_feedback_en: PLL1 feedback path, local feedback from * the OSC_IN receiver or zero delay mode * @pll1_loop_filter_rzero: PLL1 Loop Filter Zero Resistor selection. * @ref_mode: Reference selection mode. * @pll2_charge_pump_current_nA: Magnitude of PLL2 charge pump current (nA). * @pll2_ndiv_a_cnt: PLL2 Feedback N-divider, A Counter, range 0..4. * @pll2_ndiv_b_cnt: PLL2 Feedback N-divider, B Counter, range 0..63. * @pll2_freq_doubler_en: PLL2 frequency doubler enable. * @pll2_r2_div: PLL2 R2 divider, range 0..31. * @pll2_vco_diff_m1: VCO1 divider, range 3..5. * @pll2_vco_diff_m2: VCO2 divider, range 3..5. * @rpole2: PLL2 loop filter Rpole resistor value. * @rzero: PLL2 loop filter Rzero resistor value. * @cpole1: PLL2 loop filter Cpole capacitor value. * @rzero_bypass_en: PLL2 loop filter Rzero bypass enable. * @num_channels: Array size of struct ad9523_channel_spec. * @channels: Pointer to channel array. * @name: Optional alternative iio device name. */ ? struct ad9523_platform_data { unsigned long vcxo_freq; ? /* Differential/ Single-Ended Input Configuration */ bool refa_diff_rcv_en; bool refb_diff_rcv_en; bool zd_in_diff_en; bool osc_in_diff_en; ? /* * Valid if differential input disabled * if false defaults to pos input */ bool refa_cmos_neg_inp_en; bool refb_cmos_neg_inp_en; bool zd_in_cmos_neg_inp_en; bool osc_in_cmos_neg_inp_en; ? /* PLL1 Setting */ unsigned short refa_r_div; unsigned short refb_r_div; unsigned short pll1_feedback_div; unsigned short pll1_charge_pump_current_nA; bool zero_delay_mode_internal_en; bool osc_in_feedback_en; enum pll1_rzero_resistor pll1_loop_filter_rzero; ? /* Reference */ enum ref_sel_mode ref_mode; ? /* PLL2 Setting */ unsigned int pll2_charge_pump_current_nA; unsigned char pll2_ndiv_a_cnt; unsigned char pll2_ndiv_b_cnt; bool pll2_freq_doubler_en; unsigned char pll2_r2_div; unsigned char pll2_vco_diff_m1; /* 3..5 */ unsigned char pll2_vco_diff_m2; /* 3..5 */ ? /* Loop Filter PLL2 */ enum rpole2_resistor rpole2; enum rzero_resistor rzero; enum cpole1_capacitor cpole1; bool rzero_bypass_en; ? /* Output Channel Configuration */ int num_channels; struct ad9523_channel_spec *channels; ? char name[SPI_NAME_SIZE]; };
struct ad9523_channel_spec ad9523_channels[] = { { /* ZD output */ .channel_num = 0, .extended_name = "ZD_OUTPUT", .divider_output_invert_en = false, .sync_ignore_en = false, .low_power_mode_en = false, .driver_mode = LVDS_4mA, .divider_phase = 0, .channel_divider = 8, .use_alt_clock_src = false, .output_dis = false, }, { /* DAC CLK */ .channel_num = 1, .extended_name = "DAC_CLK", .divider_output_invert_en = false, .sync_ignore_en = false, .low_power_mode_en = false, .driver_mode = LVPECL_8mA, .divider_phase = 0, .channel_divider = 2, }, { /* ADC CLK */ .channel_num = 2, .extended_name = "ADC_CLK", .divider_output_invert_en = false, .sync_ignore_en = false, .low_power_mode_en = false, .driver_mode = LVDS_7mA, .divider_phase = 0, .channel_divider = 4, }, { /* DAC REF CLK */ .channel_num = 4, .extended_name = "DAC_REF_CLK", .divider_output_invert_en = false, .sync_ignore_en = false, .low_power_mode_en = false, .driver_mode = LVDS_4mA, .divider_phase = 0, .channel_divider = 16, }, { /* TX LO REF */ .channel_num = 5, .extended_name = "TX_LO_REF_CLK", .divider_output_invert_en = false, .sync_ignore_en = false, .low_power_mode_en = false, .driver_mode = CMOS_CONF3, /* HiZ on - */ .divider_phase = 0, .channel_divider = 8, }, { /* DAC DCO */ .channel_num = 6, .extended_name = "DAC_DCO_CLK", .divider_output_invert_en = false, .sync_ignore_en = false, .low_power_mode_en = false, .driver_mode = LVDS_7mA, .divider_phase = 0, .channel_divider = 2, }, { /* ADC SYNC */ .channel_num = 8, .extended_name = "ADC_SYNC_CLK", .divider_output_invert_en = false, .sync_ignore_en = false, .low_power_mode_en = false, .driver_mode = CMOS_CONF3, /* HiZ on - */ .divider_phase = 1, .channel_divider = 32, .output_dis = false, }, { /* RX LO REF */ .channel_num = 9, .extended_name = "RX_LO_REF_CLK", .divider_output_invert_en = false, .sync_ignore_en = false, .low_power_mode_en = false, .driver_mode = CMOS_CONF3, /* HiZ on - */ .divider_phase = 0, .channel_divider = 8, }, }; ? struct ad9523_platform_data ad9523_pdata_lpc = { .vcxo_freq = 122880000, ? /* Single-Ended Input Configuration */ .refa_diff_rcv_en = true, .refb_diff_rcv_en = false, .zd_in_diff_en = true, .osc_in_diff_en = false, .osc_in_cmos_neg_inp_en = true, ? .refa_r_div = 0, .refb_r_div = 0, .pll1_feedback_div = 4, .pll1_charge_pump_current_nA = 2000, .zero_delay_mode_internal_en = true, .osc_in_feedback_en = false, .refb_cmos_neg_inp_en = true, .pll1_loop_filter_rzero = 3, ? .ref_mode = REVERT_TO_REFA, ? .pll2_charge_pump_current_nA = 420000, .pll2_ndiv_a_cnt = 0, .pll2_ndiv_b_cnt = 3, .pll2_freq_doubler_en = true, .pll2_r2_div = 1, .pll2_vco_diff_m1 = 3, .pll2_vco_diff_m2 = 3, ? .rpole2 = 0, .rzero = 2, .cpole1 = 2, .rzero_bypass_en = false, ? /* Output Channel Configuration */ .num_channels = ARRAY_SIZE(ad9523_channels), .channels = ad9523_channels, .name = "ad9523-lpc" };
Declaring SPI slave devices
Unlike PCI or USB devices, SPI devices are not enumerated at the hardware level. Instead, the software must know which devices are connected on each SPI bus segment, and what slave selects these devices are using. For this reason, the kernel code must instantiate SPI devices explicitly. The most common method is to declare the SPI devices by bus number.
This method is appropriate when the SPI bus is a system bus, as in many embedded systems, wherein each SPI bus has a number which is known in advance. It is thus possible to pre-declare the SPI devices that inhabit this bus. This is done with an array of struct spi_board_info, which is registered by calling spi_register_board_info().
For more information see: Documentation/spi/spi-summary
Depending on the IC used, you may need to set the modalias accordingly, matching your part name. It may also required to adjust max_speed_hz. Please consult the datasheet, for maximum spi clock supported by the device in question.
static struct spi_board_info board_spi_board_info[] __initdata = { #if defined(CONFIG_AD9523) || defined(CONFIG_AD9523_MODULE) { .modalias = "ad9523-1", .max_speed_hz = 1000000, /* max spi clock (SCK) speed in HZ */ .bus_num = 0, .chip_select = 3, .platform_data = &ad9523_pdata_lpc, /* spi_driver specific config */ .mode = SPI_MODE_0, /* optional set SPI_3WIRE */ }, };
static int __init board_init(void) { [--snip--] ? spi_register_board_info(board_spi_board_info, ARRAY_SIZE(board_spi_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 AD9523 Driver depends on CONFIG_SPI
Linux Kernel Configuration Device Drivers ---> <*> Industrial I/O support ---> --- Industrial I/O support Frequency Synthesizers DDS/PLL ---> Clock Generator/Distribution ---> [--snip--] <*> Analog Devices AD9523 Low Jitter Clock Generator [--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> iio:device0 root:/> ls -l total 0 drwxr-xr-x 2 root root 0 Jan 1 00:00 . drwxr-xr-x 3 root root 0 Jan 1 00:00 .. -r--r--r-- 1 root root 4096 Jan 1 00:00 dev -r--r--r-- 1 root root 4096 Jan 1 00:00 name -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage0_ZD_OUTPUT_frequency -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage0_ZD_OUTPUT_phase -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage0_ZD_OUTPUT_raw -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage1_DAC_CLK_frequency -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage1_DAC_CLK_phase -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage1_DAC_CLK_raw -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage2_ADC_CLK_frequency -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage2_ADC_CLK_phase -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage2_ADC_CLK_raw -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage4_DAC_REF_CLK_frequency -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage4_DAC_REF_CLK_phase -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage4_DAC_REF_CLK_raw -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage5_TX_LO_REF_CLK_frequency -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage5_TX_LO_REF_CLK_phase -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage5_TX_LO_REF_CLK_raw -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage6_DAC_DCO_CLK_frequency -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage6_DAC_DCO_CLK_phase -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage6_DAC_DCO_CLK_raw -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage8_ADC_SYNC_CLK_frequency -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage8_ADC_SYNC_CLK_phase -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage8_ADC_SYNC_CLK_raw -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage9_RX_LO_REF_CLK_frequency -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage9_RX_LO_REF_CLK_phase -rw-r--r-- 1 root root 4096 Jan 1 00:00 out_altvoltage9_RX_LO_REF_CLK_raw -r--r--r-- 1 root root 4096 Jan 1 00:00 pll1_locked -r--r--r-- 1 root root 4096 Jan 1 00:00 pll1_reference_clk_a_present -r--r--r-- 1 root root 4096 Jan 1 00:00 pll1_reference_clk_b_present -r--r--r-- 1 root root 4096 Jan 1 00:00 pll1_reference_clk_test_present -r--r--r-- 1 root root 4096 Jan 1 00:00 pll2_feedback_clk_present -r--r--r-- 1 root root 4096 Jan 1 00:00 pll2_locked -r--r--r-- 1 root root 4096 Jan 1 00:00 pll2_reference_clk_present --w------- 1 root root 4096 Jan 1 00:00 store_eeprom lrwxrwxrwx 1 root root 0 Jan 1 00:00 subsystem -> ../../../../../../../../../bus/iio --w------- 1 root root 4096 Jan 1 00:00 sync_dividers -rw-r--r-- 1 root root 4096 Jan 1 00:00 uevent -r--r--r-- 1 root root 4096 Jan 1 00:00 vcxo_clk_present
Show device name
This specifies any shell prompt running on the target
root:/> cd /sys/bus/iio/devices/iio/:device0/ root:/> cat name ad9523-lpc
Set ChannelY Output Frequency
/sys/bus/iio/devices/iio:deviceX/out_altvoltageY_frequency
Output frequency for channel Y in Hz. The number must always be specified and unique if the output corresponds to a single channel.
This specifies any shell prompt running on the target
root:/> cat out_altvoltage1_DAC_CLK_frequency 491520000 root:/> echo 245760000 > out_altvoltage1_DAC_CLK_frequency root:/> cat out_altvoltage1_DAC_CLK_frequency 245760000
Set ChannelY Output Divider Phase
/sys/bus/iio/devices/iio:deviceX/out_altvoltageY_phase
Phase in radians of one frequency/clock output Y (out_altvoltageY) relative to another frequency/clock output (out_altvoltageZ) of the device X. The number must always be specified and unique if the output corresponds to a single channel.
This specifies any shell prompt running on the target
root:/> cat out_altvoltage1_DAC_CLK_phase 0.000000 root:/> echo 3.142 > out_altvoltage1_DAC_CLK_phase root:/> cat out_altvoltage1_DAC_CLK_phase 3.1415920
Disable / Power Down ChannelY
/sys/bus/iio/devices/iio:deviceX/out_altvoltageY_phase
Writing '0' powers down channelY, while writing any any value > 0 enables the channel.
This specifies any shell prompt running on the target
root:/> cat out_altvoltage1_DAC_CLK_raw 1 root:/> echo 0 > out_altvoltage1_DAC_CLK_raw root:/> cat out_altvoltage1_DAC_CLK_raw 0
Query Device Status
/sys/bus/iio/devices/iio:deviceX/pll1_locked
/sys/bus/iio/devices/iio:deviceX/pll1_reference_clk_a_present
/sys/bus/iio/devices/iio:deviceX/pll1_reference_clk_b_present
/sys/bus/iio/devices/iio:deviceX/pll1_reference_clk_test_present
/sys/bus/iio/devices/iio:deviceX/pll2_feedback_clk_present
/sys/bus/iio/devices/iio:deviceX/pll2_locked
/sys/bus/iio/devices/iio:deviceX/pll2_reference_clk_present
/sys/bus/iio/devices/iio:deviceX/vcxo_clk_present
Reading returns either '1' or '0'. '1' means that the clock in question is present or the pllY is locked. '0' means that the clock is missing or the pllY is unlocked.
This specifies any shell prompt running on the target
root:/> cat pll1_locked 1 root:/> grep “” pll* vcxo* pll1_locked:1 pll1_reference_clk_a_present:1 pll1_reference_clk_b_present:0 pll1_reference_clk_test_present:0 pll2_feedback_clk_present:1 pll2_locked:1 pll2_reference_clk_present:1 vcxo_clk_present:1
Save Current Device Config to EEPROM
/sys/bus/iio/devices/iio:deviceX/store_eeprom
Writing '1' stores the current device configuration into on-chip EEPROM. After power-up or chip reset the device will automatically load the saved configuration.
This specifies any shell prompt running on the target
root:/> echo 1 > store_eeprom
SYNC Device
/sys/bus/iio/devices/iio:deviceX/sync_dividers
Writing '1' triggers the clock distribution synchronization functionality. All dividers are reset and the channels start with their predefined phase offsets (out_altvoltageY_phase). Writing this file has the effect as driving the external /SYNC pin low.
This specifies any shell prompt running on the target
root:/> echo 1 > sync_dividers
More Information
- IIO mailing list: linux [dash] iio [at] vger [dot] kernel [dot] org
- 風電發電機并網方式
- 塔基系統H82-2.0MW風力發電機組原理圖 82次下載
- AD9523參考代碼
- 低速高效垂直軸風力發電機及其特性分析 1次下載
- AD9523數據手冊 15次下載
- 直流低速測速發電機紋波系數測試討論 11次下載
- 基于虛擬同步發電機的船舶岸電電源控制策略_郜克存 0次下載
- 低噪聲時鐘AD9523、AD9524和AD9523-1的電源考慮 49次下載
- AD9523-1 低抖動時鐘發生器 50次下載
- 同步發電機勵磁原理培訓
- 發電機拆裝與檢修 0次下載
- 汽車電器的交流發電機及調節器原理及構成
- 大機組中發電機斷路器應用的探討
- 離網型低速高效永磁風力發電機的研制
- 小型交流永磁風力發電機設計特點:小型風能發電及其發電機
- 發電機發電原理 1233次閱讀
- 風力發電機的工作原理是什么 9601次閱讀
- 核對發電機和電網相序的方法 2.6w次閱讀
- 發電機負載就熄火是什么原因_發電機負載增加轉速下降 2.8w次閱讀
- 發電機進相運行現象_發電機進相運行危害 2w次閱讀
- 感應發電機原理_感應發電機應用前景 6429次閱讀
- 勵磁變壓器與發電機是怎么連接的 1.2w次閱讀
- 發電機勵磁繞組的接線方法都有那些? 2.9w次閱讀
- 船用發電機的維護及日常保養 8984次閱讀
- 自制發電機教程 6.9w次閱讀
- 汽車發電機充電電路圖大全(六管交流發電機/九管交流發電機/充電器) 8.2w次閱讀
- 發電機勵磁方式有哪些_三種發電機勵磁方式 7.6w次閱讀
- 發電機avr工作原理 4.2w次閱讀
- 發電機進相運行的危害 9558次閱讀
- 什么是發電機進相運行 2.4w次閱讀
下載排行
本周
- 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次下載 | 免費
評論
查看更多